Thursday, 5 February 2015

The simple blog entries are sometimes the best - awk

I’m tracing through JD Edwards log files and am searching for an IP address that is having connection issues in the jdenet log files.  They are easily identifiable by grepping for my problem IP address:

>grep 10.32.8.40 * |more

jde_3680.log:   10054-Error from Host=<10.32.8.40> in recv returned 10054 (WSAECONNRESET): Connection was reset by peer
jde_3680.log:   10054-Error from Host=<10.32.8.40> in recv returned 10054 (WSAECONNRESET): Connection was reset by peer
jde_3680.log:   10054-Error from Host=<10.32.8.40> in recv returned 10054 (WSAECONNRESET): Connection was reset by peer
jde_3680.log:   10054-Error from Host=<10.32.8.40> in recv returned 10054 (WSAECONNRESET): Connection was reset by peer
jde_3680.log:   10054-Error from Host=<10.32.8.40> in recv returned 10054 (WSAECONNRESET): Connection was reset by peer
jde_3680.log:   10054-Error from Host=<10.32.8.40> in recv returned 10054 (WSAECONNRESET): Connection was reset by peer

But I need the timestamp, so I want the previous line in the log file, oh wait – we are on a totally legendary OS like unix or linux and this is massively easy:

>grep -B1 10.32.8.40 * |more

jde_11156.log-11156/11692 MAIN_THREAD                           Sun Feb 01 01:04:11.728000      NETRCV.C443
jde_11156.log:  10054-Error from Host=<10.32.8.40> in recv returned 10054 (WSAECONNRESET): Connection was reset by peer
--
jde_11156.log-11156/11692 MAIN_THREAD                           Mon Feb 02 23:00:42.996000      NETRCV.C443
jde_11156.log:  10054-Error from Host=<10.32.8.40> in recv returned 10054 (WSAECONNRESET): Connection was reset by peer

Wow, so now I can start reconciling the timestamps and the errors.  Fantastic!

-B num, --before-context=num
        Print num lines of leading context before each match.  See also the -A and -C options.

2 comments:

Anonymous said...

Hi, do you fix this problem of deconnexion? we are facing the same errors and we don't find anything to correct this.
Have you any clue to help us ?

Best Regards,
David

Unknown said...

Hi

HELP!!!!.. I have the same issue. Do you have any clue to resolve it? THANK!!!!

Best Regards

Javier

Extending JDE to generative AI