Hello,
I am trying to create a macro that will parse a web servers log files for certain events.
On occasion, some Http sessions fail from one client in particular and I would like to copy all occurences of this and place them in a seperate file.
My source data looks like this:
0-14 23:14:59.77] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent - turnOnSSL
[2008-10-14 23:14:59.77] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 768
[2008-10-14 23:14:59.785] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 1024
[2008-10-14 23:14:59.879] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 2048
[2008-10-14 23:14:59.973] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 4096
[2008-10-14 23:15:00.067] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 2966
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 357
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 768
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 1024
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 2048
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 4096
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 2966
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: ReceivedNumber of bytes: 1217
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[HTTP/1.1 202 Accepted]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Date: Wed, 15 Oct 2008 06:15:00 GMT]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Server: Jetty/4.2.24 (Windows 2003/5.2 x86 java/1.4.2_06)]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Connection: close]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Content-Type: Application/xml]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Content-Length: 6124]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Sending to Client:[
HTTP/1.1 202 Accepted
Date:Wed, 15 Oct 2008 06:15:00 GMT
Server:SSP 2.0.00
Connection:close
Content-Type:Application/xml
Content-Length:6124
]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: SendingNumber of bytes: 149
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: SendingNumber of bytes: 1024
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: ReceivedNumber of bytes: 3072
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: SendingNumber of bytes: 3072
[2008-10-14 23:15:01.207] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: ReceivedNumber of bytes: 2028
[2008-10-14 23:15:01.207] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: SendingNumber of bytes: 2028
[2008-10-14 23:15:01.207] INFO 999999999999 SSP.Session.SSP102I Session: 56834 - Control:ServerAgent Connection closed (CloseCode.EOF): Bytes Received: 6317
Bytes Sent: 11259
[2008-10-14 23:15:01.207] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent - sending conduit.close() code: CloseCode.NORMAL_CLOSE
[2008-10-14 23:15:01.207] INFO 999999999999 SSP.Session.SSP102I Session: 56834 - Control:ClientAgent Connection closed (CloseCode.FULL_CLOSE): Bytes Received: 11246
Bytes Sent: 6273
[2008-10-14 23:16:35.832] INFO 999999999999 SSP.Session.SSP104I Session: 56841 - Session Proceeding after Node match: Public_Inbound_HTTPS_Node_3
[2008-10-14 23:16:35.832] DEBUG 000000000000 GLOBAL_SCOPE Session :56841 (IN: Public_Inbound_HTTPS_Node_3, ON: ) - Using StubAuthenticator for Authentication.
[2008-10-14 23:16:35.832] DEBUG 000000000000 GLOBAL_SCOPE Session :56841 (IN: Public_Inbound_HTTPS_Node_3, ON: ) - Out bound port range: 0
[2008-10-14 23:16:35.832] DEBUG 000000000000 GLOBAL_SCOPE Session :56841 (IN: Public_Inbound_HTTPS_Node_3, ON: ) - Control:ClientAgent - turnOnSSL
[2008-10-14 23:16:36.144] INFO 999999999999 SSP.Session.SSP102I Session: 56841 - Control:ClientAgent Connection closed (CloseCode.CONNECTION_RESET): Bytes Received: 0
Bytes Sent: 0
In particular, I need to isolate out the failed sessions. "Bytes Sent : 0" is the end of these failed sessions and the start is the first "[" after the preceeding CRLF.
My macro looks like this:
InsertMode
ColumnModeOff
HexOff
UnixReOn
Clipboard 9
Bottom
IfColNum 1
Else
"
"
EndIf
Top
ClearClipboard
Loop
Find "Bytes Sent: 0"
IfFound
StartSelect
Find Up Select "^p"
EndSelect
CopyAppend
Else
ExitLoop
EndIf
EndLoop
NewFile
Paste
SaveAs "C:\UETmp.txt"
EndIf
ClearClipboard
Clipboard 0
A new output file is created but the first line is always blank. The rest of of the lines are only populated with "Bytes Sent : 0" but not the rest of of data below the preceeding CRLF.
Any suggestions would be appreciated.
Keith
I am trying to create a macro that will parse a web servers log files for certain events.
On occasion, some Http sessions fail from one client in particular and I would like to copy all occurences of this and place them in a seperate file.
My source data looks like this:
0-14 23:14:59.77] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent - turnOnSSL
[2008-10-14 23:14:59.77] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 768
[2008-10-14 23:14:59.785] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 1024
[2008-10-14 23:14:59.879] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 2048
[2008-10-14 23:14:59.973] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 4096
[2008-10-14 23:15:00.067] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: ReceivedNumber of bytes: 2966
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 357
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 768
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 1024
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 2048
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 4096
[2008-10-14 23:15:00.551] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: SendingNumber of bytes: 2966
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: ReceivedNumber of bytes: 1217
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[HTTP/1.1 202 Accepted]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Date: Wed, 15 Oct 2008 06:15:00 GMT]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Server: Jetty/4.2.24 (Windows 2003/5.2 x86 java/1.4.2_06)]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Connection: close]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Content-Type: Application/xml]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[Content-Length: 6124]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Received from Server:[]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Sending to Client:[
HTTP/1.1 202 Accepted
Date:Wed, 15 Oct 2008 06:15:00 GMT
Server:SSP 2.0.00
Connection:close
Content-Type:Application/xml
Content-Length:6124
]
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: SendingNumber of bytes: 149
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: SendingNumber of bytes: 1024
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: ReceivedNumber of bytes: 3072
[2008-10-14 23:15:01.192] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: SendingNumber of bytes: 3072
[2008-10-14 23:15:01.207] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ServerAgent: ReceivedNumber of bytes: 2028
[2008-10-14 23:15:01.207] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent: SendingNumber of bytes: 2028
[2008-10-14 23:15:01.207] INFO 999999999999 SSP.Session.SSP102I Session: 56834 - Control:ServerAgent Connection closed (CloseCode.EOF): Bytes Received: 6317
Bytes Sent: 11259
[2008-10-14 23:15:01.207] DEBUG 000000000000 GLOBAL_SCOPE Session :56834 (IN: Public_Inbound_HTTPS_Node_3, ON: Public_Outbound_HTTPS_Node) - Control:ClientAgent - sending conduit.close() code: CloseCode.NORMAL_CLOSE
[2008-10-14 23:15:01.207] INFO 999999999999 SSP.Session.SSP102I Session: 56834 - Control:ClientAgent Connection closed (CloseCode.FULL_CLOSE): Bytes Received: 11246
Bytes Sent: 6273
[2008-10-14 23:16:35.832] INFO 999999999999 SSP.Session.SSP104I Session: 56841 - Session Proceeding after Node match: Public_Inbound_HTTPS_Node_3
[2008-10-14 23:16:35.832] DEBUG 000000000000 GLOBAL_SCOPE Session :56841 (IN: Public_Inbound_HTTPS_Node_3, ON: ) - Using StubAuthenticator for Authentication.
[2008-10-14 23:16:35.832] DEBUG 000000000000 GLOBAL_SCOPE Session :56841 (IN: Public_Inbound_HTTPS_Node_3, ON: ) - Out bound port range: 0
[2008-10-14 23:16:35.832] DEBUG 000000000000 GLOBAL_SCOPE Session :56841 (IN: Public_Inbound_HTTPS_Node_3, ON: ) - Control:ClientAgent - turnOnSSL
[2008-10-14 23:16:36.144] INFO 999999999999 SSP.Session.SSP102I Session: 56841 - Control:ClientAgent Connection closed (CloseCode.CONNECTION_RESET): Bytes Received: 0
Bytes Sent: 0
In particular, I need to isolate out the failed sessions. "Bytes Sent : 0" is the end of these failed sessions and the start is the first "[" after the preceeding CRLF.
My macro looks like this:
InsertMode
ColumnModeOff
HexOff
UnixReOn
Clipboard 9
Bottom
IfColNum 1
Else
"
"
EndIf
Top
ClearClipboard
Loop
Find "Bytes Sent: 0"
IfFound
StartSelect
Find Up Select "^p"
EndSelect
CopyAppend
Else
ExitLoop
EndIf
EndLoop
NewFile
Paste
SaveAs "C:\UETmp.txt"
EndIf
ClearClipboard
Clipboard 0
A new output file is created but the first line is always blank. The rest of of the lines are only populated with "Bytes Sent : 0" but not the rest of of data below the preceeding CRLF.
Any suggestions would be appreciated.
Keith