Hello,
I am trying to search an IIS log file for a specific email address (inputted by the user @ runtime).
I can match the address fine, but what I need to do is grab the preceding lines from the string "0 EHLO - +" and then the all the lines from then up to the same string match.
I am lost on how best to do this.
Can anyone advise?
sample log entry below. would be searching for PersonToSendTo@anotherDomain.com address, but get all the data back (As below).
thank you in advance
I am trying to search an IIS log file for a specific email address (inputted by the user @ runtime).
I can match the address fine, but what I need to do is grab the preceding lines from the string "0 EHLO - +" and then the all the lines from then up to the same string match.
I am lost on how best to do this.
Can anyone advise?
sample log entry below. would be searching for PersonToSendTo@anotherDomain.com address, but get all the data back (As below).
thank you in advance
C#:
2021-03-19 00:08:31 xx.198.1.xx OWNEROR-PC SMTPSVC1 OWNEROR-PC xx.198.1.xxx 0 EHLO - +OWNEROR-PC 250 0 246 20 0 SMTP - - - -
2021-03-19 00:08:31 xx.198.1.xxx OWNEROR-PC SMTPSVC1 OWNEROR-PC xx.198.1.xxx 0 AUTH - OWNEROR-PC 235 0 18 51 0 SMTP - - - -
2021-03-19 00:08:31 xx.198.1.xxx OWNEROR-PC SMTPSVC1 OWNEROR-PC xx.198.1.xxx 0 MAIL - +FROM:<senders@address.co.uk> 250 0 54 41 0 SMTP - - - -
2021-03-19 00:08:31 xx.198.1.xxx OWNEROR-PC SMTPSVC1 OWNEROR-PC xx.198.1.xxx 0 RCPT - +TO:<PersonToSendTo@anotherDomain.com> 250 0 35 32 0 SMTP - - - -
2021-03-19 00:08:31 xx.198.1.xxx OWNEROR-PC SMTPSVC1 OWNEROR-PC xx.198.1.xxx 0 RCPT - +TO:<CCaddress@domain.co.uk> 250 0 43 40 0 SMTP - - - -
2021-03-19 00:08:31 xx.198.1.xxx OWNEROR-PC SMTPSVC1 OWNEROR-PC xx.198.1.xxx 0 DATA - <OWNEROR-PCGNso0002e105@smtp-relay.com> 250 0 135 5269 47 SMTP - - - -
2021-03-19 00:08:31 xx.198.1.xxx OWNEROR-PC SMTPSVC1 OWNEROR-PC xx.198.1.xxx 0 QUIT - OWNEROR-PC 240 47 71 4 0 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 220+eu-smtp-1.mimecast.com+ESMTP;+Fri,+19+Mar+2021+00:08:31++0000 0 0 65 0 16 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 EHLO - smtp-relay.com 0 0 4 0 16 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 250-eu-smtp-1.mimecast.com+Hello+[xx.198.1.xxx] 0 0 47 0 31 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 MAIL - FROM:<senders@address.co.uk> 0 0 4 0 31 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 250+Sender+OK+[1bb1wKQqP42RYekw68P00w.uk40] 0 0 43 0 63 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 RCPT - TO:<CCaddress@domain.co.uk> 0 0 4 0 63 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 250+Recipient+OK+[1bb1wKQqP42RYekw68P00w.uk40] 0 0 46 0 109 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 DATA - - 0 0 4 0 109 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.217.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 354+Start+mail+data,+end+with+CRLF.CRLF+[1bb1wKQqP42RYekw68P00w.uk40] 0 0 69 0 125 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.57.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 220+DM6N.mail.nam1.somedomainname.com+name+ESMTP+MAIL+Service+ready+at+Fri,+19+Mar+2021+00:08:31++0000 0 0 115 0 125 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.57.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 EHLO - smtp-relay.com 0 0 4 0 125 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.57.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 250-DM6N.mail.protection.somedomainname.com+Hello+[xx.198.1.xxx] 0 0 66 0 249 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.57.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 MAIL - FROM:<renders@address.co.uk>+SIZE=5609 0 0 4 0 249 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.57.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 250+2.1.0+Sender+OK 0 0 19 0 374 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.57.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 RCPT - TO:<PersonToSendTo@anotherDomain.com> 0 0 4 0 374 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.57.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 250+2.1.5+Recipient+OK 0 0 22 0 515 SMTP - - - -
2021-03-19 00:08:31 xxx.xxx.57.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 BDAT - 5609+LAST 0 0 4 0 515 SMTP - - - -
2021-03-19 00:08:32 xxx.xxx.217.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 250+SmtpThread-8306465-1616112512239@uk-xxx-xx.uk.mimecast.lan+Received+OK+[1bb1wKQqP42RYekw68P00w.uk40] 0 0 104 0 936 SMTP - - - -
2021-03-19 00:08:32 xxx.xxx.217.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 QUIT - - 0 0 4 0 936 SMTP - - - -
2021-03-19 00:08:32 xxx.xxx.217.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 221+Service+closing+transmission+channel+[_-P-hI3lOxW3_giuQ6Ldbg.uk40] 0 0 70 0 967 SMTP - - - -
2021-03-19 00:08:34 xxx.xxx.57.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 250+2.6.0+<OWNEROR-PCGNso0002e105@smtp-relay.com>+[InternalId=54649163886184,+Hostname=DM6NAM11HT152.eop-nam1.somedomainname.com]+12114+bytes+in+0.797,+14.825+KB/sec+Queued+mail+for+delivery+->+250+2.1.5 0 0 226 0 2449 SMTP - - - -
2021-03-19 00:08:34 xxx.xxx.57.xxx OutboundConnectionCommand SMTPSVC1 OWNEROR-PC - 25 QUIT - - 0 0 4 0 2449 SMTP - - - -
2021-03-19 00:08:34 xxx.xxx.57.xxx OutboundConnectionResponse SMTPSVC1 OWNEROR-PC - 25 - - 221+2.0.0+Service+closing+transmission+channel 0 0 46 0 2574 SMTP - - - -
2021-03-19 00:09:15 157.xxx.5.xxx DCQPC SMTPSVC1 OWNEROR-PC xx.198.1.xxx 0 QUIT - DCQPC 240 86113 71 4 0 SMTP - - - -