Hi,
I have two log messages like this:
2011-09-22 14:35:21,441 [Thread-20] DEBUG NHTTPClient2 - Execute http POST request for : http://na.api.inrix.com/V3/Traffic/Inrix.ashx
2011-09-22 14:35:22,122 [New I/O client worker #1-1] INFO NHTTPClient2 - Http request complete status 200 OK, Url http://na.api.inrix.com/V3/Traffic/Inrix.ashx
Log 1 is the request and log 2 is the response. I want to find out how many requests were being made and their corresponding response time in the last 24 hours and for the last one week.
How to query this requirement.
Any help is much appreciated!!
Sorry for bothering you again. The query which you have provided me is fetching the results for all the URLs but I need the results only for this URL:
http://na.api.inrix.com/V3/Traffic/Inrix.ashx
How to get that? Thanks!!
limit the search going into the transaction command, it'll be faster,
|rex field=_raw "(?<url>http://[A-z0-9./]+)"
|search url="http://na.api.inrix.com/V3/Traffic/Inrix.ashx"
|transaction url startswith="POST request" endswith="request complete" maxevents=2
|stats count as Total_Requests avg(duration) as Average_Response_Time
Hi,
I am not successful in extracting the url in this case. I am using the following query but I am not getting the expected result.
sourcetype="mysourcetype" | transaction "http://na.api.inrix.com/V3/Traffic/Inrix.ashx" startswith="POST request for : " endswith="Http request complete status 200 OK" maxevents=2 | stats count as Total_Requests avg(duration) as Average_Response_Time
Any help on this please!!
and then if you only care about the 200's do a search afterwards | search "status 200 OK"
so your final search would be:
|rex field=_raw "(?<url>http://[A-z0-9./]+)"
|transaction url startswith="POST request" endswith="request complete" maxevents=2
|stats count as Total_Requests avg(duration) as Average_Response_Time
to extract the text into a field, you either need to use a regex expression in props.conf / transforms.conf or you can use the "rex" command. In your case, assuming the url is only printed 1x on each line, use:
|rex field=_raw "(?<url>http://[A-z0-9./]+)"
then use the transaction command exactly as I have above:
|transaction url startswith="POST request" endswith="request complete" maxevents=2 | top url by duration | sort - duration
As a side note, your endswith will only close a transaction if the response code was a 200, you may want to capture all responses as I have in mine.
if you extract the url from both lines, you could use the transaction command,
|transaction url startswith="POST request" endswith="request complete" maxevents=2 | stats count as Total_Requests avg(duration) as Average_Response_Time
This will show you the total requests and the average duration of each request. By using the transaction command you get the "duration" field automatically. Without doing the stats command you'll be able to see the duration of each event and search on duration. For instance you could do things like:
|transaction url startswith="POST request" endswith="request complete" maxevents=2 | top url by duration | sort - duration
This would list the top durations and their corresponding URL's so you can see which pages take the longest to load.
or
|stats max(duration) by url
to see what was the longest amount of time taken to load any url.