1

I am new to this scripting world, and trying to learn things in my limited time. Could someone help me compose a script that will get me response time from my log.

The current log format is:

2017-05-26 15:38:15,15224 [Dispatcher-13] INFO  someinforServerHelper  - Received request to host/auth/sessions/xyxyxyxy from IP
2017-05-26 15:38:15,15587 [Dispatcher-13] INFO  infolib.rest.XmlRepresentation  - XML Representation Accepted Encodings : identity--The default encoding with no transformation
2017-05-26 15:38:15,15685 [Dispatcher-13] INFO  info.Component.Server  - more info
2017-05-26 15:38:15        ip   -       ip   port   GET     /auth/sessions/xyxyxyxy       -       200     -       -       3       host

My idea was to extract in two files, using awk, the timestamp, the Dispatcher, and the session ID.

So I will have one file auth _request

2017-05-26 15:38:15,15224 [Dispatcher-13] host/auth/sessions/xyxyxyxy

and the second file auth response

2017-05-26 15:38:15,15685 [Dispatcher-13] /auth/sessions/xyxyxyxy

Now comes the part where I fail.

Can someone assist me with a script that take the input of those two files, reads them line by line comparing the unique id's of the session or/and Dispatcher and make a difference of the timestamps so i can get a number that means actually a response time.

I know there are many easier ways with time wget/curl but unfortunately those are not available to me. In my mind he script looks like:

  1. read line 1 of file one,
  2. compare it to lines in file two until a match is found,
  3. calculate timestamps difference and after move to next line in file 1
  4. and so on until file 1 or file 2 ends.

I've searched for this over the internet many hours and could not find this exact combination of request.

  • I formatted the log so that it was readable. @Haleluia, please check that it's still valid and that you text still makes sense. – Kusalananda Jun 2 '17 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.