I need to analyze the output of apache server-status. I need to match every entry which has high delays in "Sending Reply" parsing the stastic page. The content looks like this:
11-1 24986 7/9/7288 K 0.08 3 1 77.5 0.08 23.17 IP-CLIENT
hostname:80 GET /static/img/securoty.png HTTP/1.1
12-1 23648 65/108/8176 K 5.74 2 51 90.6 0.16 24.50 IP-CLIENT
hostname:80 POST /php/toolbar_ajax.php HTTP/1.1
13-1 22887 95/118/7672 K 5.38 2 47 140.5 0.17 18.65 IP-CLIENT
hostname:80 POST /php/toolbar_ajax.php HTTP/1.1
14-1 24987 4/6/8016 K 0.09 4 379 288.5 0.28 22.42 IP-CLIENT
hostname:80 GET /static/img/bg_dealers.jpg HTTP/1.1
15-1 24518 7/43/8425 K 2.36 4 53 10.2 0.18 23.24 IP-CLIENT
hostname:80 POST /php/toolbar_ajax.php HTTP/1.1
40-3 12970 14/27/5335 W 10.37 0 0 26.7 0.05 18.44 IP-CLIENT
hostname:80 GET /php/r_fin_new3_std.php HTTP/1.1
Every odd line has this legend:
__________________________________________________________________
Srv Child Server number - generation
PID OS process ID
Acc Number of accesses this connection / this child / this slot
M Mode of operation
CPU CPU usage, number of seconds
SS Seconds since beginning of most recent request
Req Milliseconds required to process most recent request
Conn Kilobytes transferred this connection
Child Megabytes transferred this child
Slot Total megabytes transferred this slot
__________________________________________________________________
Every even line contains the asked URL by the client. I need to match every line containing "Mode of operation" in "W" (Sending Reply) and the "SS" (Seconds since beginning of most recent request) greather then 10. After matching these lines I need to print out the line and the line after. In this case I would need to print:
40-3 12970 14/27/5335 W 10.37 0 0 26.7 0.05 18.44 IP-CLIENT
hostname:80 GET /php/r_fin_new3_std.php HTTP/1.1
- First line, column 4 (Mode of operation) is "W" = TRUE
- First line, column 5 (Seconds since beginning of most recent request) is 10.37 > 10 = TRUE
Then print the first line and the next one, which gives me the asked URL.
I've the server-status saved (append) every 5 minutes in a logfile. If I use this command I get all "Sending Reply" and the line after, but cannot filter by those greater than 10:
grep " W " -A 1 /var/log/server-status.log
Any idea?