Regular Expressions

This is the place for you, if you got rsyslog up and running but wonder how to make it do what you want.

Moderator: rgerhards

Regular Expressions

Postby GregBeason on Thu Jul 12, 2007 7:12 am

Does anyone have some examples of regular expressions used in the messages. I have the following line and need to be able to extract the last part:

Code: Select all
RECV from@fromdomain.com to@todomain.com 2 14 550 <to@todomain.com>: Sender address rejected: Domain not found


It is in the format of:

Code: Select all
[METHOD] [FROM EMAIL] [TO EMAIL] [VAR1] [VAR2] [VAR TEXT]

I have been trying to build a regular expression; however, I have been severely unsucessful in capturing the end of the string.

I have tried the following regexp that I tried using a testing and works with online regexp testers, but gives **NO MATCH**.

Code: Select all
RECV [^\s]+\s[^\s]+\s\d+\s\d+\s(.*)$


Thanks for any help.
GregBeason
New
 
Posts: 1
Joined: Thu Jul 12, 2007 6:59 am

Google Ads


Return to Configuration

Who is online

Users browsing this forum: Google Adsense [Bot] and 1 guest

cron