CENTOS 5.x | Sendmail
Hello All,
I hope this is a simple question. =) I need to generate a report summary of messages that triggered a specific DSN code. For example:
Jan 11 07:43:34 server-example sendmail[12732]: p937blksdh3: to=<someuser@recipientdomain.com>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=102537, relay=mta.recipientdomain.com. [12.34.56.78], dsn=5.7.1, stat=Service unavailable
Normally, I would just grep for this information (something like: grep -i "dsn=5.7.1" /var/log/maillog). But the problem is that this only returns a line like above and doesn't tell me the sender of the message.
Ideally, I'm looking for a one-liner that can do the following:
- Search sendmail maillog for specific DSN.
- Identify the message-id for the email. (I'm guessing awk '{print $}' would be used?)
- Return the message details for each (presumably grepping for the the message id retrieved from step 2).
I'm a n00b at scripting/one-liners so I'm sure there's probably an easier way to do this. Any thoughts?
Thanks,
-M