Checking postfix mail log with AWK


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Checking postfix mail log with AWK
# 1  
Old 06-28-2012
Question Checking postfix mail log with AWK

Hello,

Few days ago I found a person checking his mail log by AWK. But unfortunately I forget to take the command from him. Today I got to need that command badly. Here is a reference.

When I check from my mail log like this it will not show me the details.

Code:
grep "from=<noreply@panix.com>" /var/log/mail.log
Jun 28 08:10:31 mx1 postfix/qmgr[29326]: B98E03262CE: from=<noreply@panix.com>, size=50076, nrcpt=1 (queue active)
Jun 28 09:40:31 mx1 postfix/qmgr[29326]: B98E03262CE: from=<noreply@panix.com>, size=50076, nrcpt=1 (queue active)
Jun 28 11:10:31 mx1 postfix/qmgr[29326]: B98E03262CE: from=<noreply@panix.com>, size=50076, nrcpt=1 (queue active)
Jun 28 12:40:31 mx1 postfix/qmgr[29326]: B98E03262CE: from=<noreply@panix.com>, size=50076, nrcpt=1 (queue active)
Jun 28 14:10:31 mx1 postfix/qmgr[29326]: B98E03262CE: from=<noreply@panix.com>, size=50076, nrcpt=1 (queue active)

To check details I have to do this.
Code:
root@mx1:~# grep B98E03262CE /var/log/mail.log

Jun 28 08:10:31 mx1 postfix/qmgr[29326]: B98E03262CE: from=<noreply@panix.com>, size=50076, nrcpt=1 (queue active)
Jun 28 08:10:33 mx1 postfix/smtp[27281]: B98E03262CE: host mx.panix.com[166.84.1.72] said: 454 <noreply@panix.com>: Sender address rejected: Internal error- please contact staff@panix.com (in reply to RCPT TO command)
Jun 28 08:10:35 mx1 postfix/smtp[27281]: B98E03262CE: to=<mazrob@panix.com>, relay=mx.panix.com[166.84.1.73]:25, delay=75617, delays=75614/0/2.8/0.38, dsn=4.0.0, status=deferred (host mx.panix.com[166.84.1.73] said: 454 <noreply@panix.com>: Sender address rejected: Internal error- please contact staff@panix.com (in reply to RCPT TO command))


My question is, How can I check all mails with their IDs with a single line command. Anybody please help?

Thanks in advanced.

Moderator's Comments:
Mod Comment Video tutorial on how to use code tags in The UNIX and Linux Forums.

Last edited by radoulov; 06-28-2012 at 06:58 AM..
# 2  
Old 06-28-2012
Try (if i understood correctly..)
Code:
 egrep "from=<noreply@panix.com>|B98E03262CE" /var/log/mail.log

# 3  
Old 06-28-2012
Dear Peasant, thank you very much for your reply. But it will show only only log. I want to see all the logs at a time with a single line command.

It can be done bye AWK. I saw a person to do it some days ago.

Any idea?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

I need help configuring postfix mail server within AWS

I am trying to setup the postfix email server on Redhat Linux 6.5 running as an EC2 instance in AWS. I can do reverse port mapping to open a port from our internal network to the AWS linux server, so we should be able to get to our mail server, even though it is a one way path from our internal ... (1 Reply)
Discussion started by: gandolf989
1 Replies

2. UNIX for Advanced & Expert Users

Need an help in configuring Postfix mail relay server

Hello, We have 2 servers, server A and Server B in same domain. I have already configured the Serevr A to send an email to the internet (outside domain) by opening the port 25 to the internet. Now I need to send an email to the outside domain from Server B using server A. I have opened the... (1 Reply)
Discussion started by: sathishbabu89
1 Replies

3. UNIX for Dummies Questions & Answers

Sending Mail with Postfix

im able to install postfix on my ubuntu server. no issues. but ican't send mail. i dont know what to put for the "relayhost". i've googled this endlessly but i'm clueless. isn't there a general smart host i can use that'll allow me to send? i dont care for receiving mail. i just want to be... (1 Reply)
Discussion started by: SkySmart
1 Replies

4. Emergency UNIX and Linux Support

Access denied when sending mail - postfix

i have configured mail server with postfix with dovecot with no encryption: When connecting with Thunderbird imap is working fine. when sending email from another domain to this domain again it is fine. but when i want to send mail frommy domain to another it gives me error and this is... (3 Replies)
Discussion started by: majid.merkava
3 Replies

5. UNIX for Dummies Questions & Answers

Mail tranmission issue: Postfix/Sendmail

Hi, I have email that is being routed from one server to another server it seems. The sending server has postfix running and the receiving server has sendmail running. The sendmail status is receiving connection. The sending server cannot seem to reach the receiving server. Error logs state... (0 Replies)
Discussion started by: mojoman
0 Replies

6. Red Hat

Mail solution for Linux - Postfix

Hi , I am a complete newbie to linux, I have been given a job to install a mail solution (postfix if possible) I would like to know how should I go about installing..) Can any one provide me some steps to go about it.. i have read about postfix and the installation steps, it seems there are... (1 Reply)
Discussion started by: anilhk
1 Replies

7. IP Networking

postfix - reinject mail to postfix from hold queue directory

hi all. Am using smtpd_recipient_restrictions & check_recipient_access in postfix. The hash file looks like this: emailaddress1 HOLD emailaddress2 HOLD The aim is to place email from these recipients in the hold directory,check them then reinject them back in postfix on some... (0 Replies)
Discussion started by: coolatt
0 Replies

8. Ubuntu

Reg:Postfix Mail Server

We have a redhat enterprise linux 4 server.we have configured postfix as our MTA.squirrel mail as webmail and apache is configured for webserver.We configured outlook as mail client.The mail server is working and our users ae saving a copy of mail in the linux server.Our problem is whenever the... (0 Replies)
Discussion started by: ramjimh
0 Replies

9. UNIX for Dummies Questions & Answers

mail command woth Postfix

Hi, maybe someone could help me. This is the thing. I usually use the command "mail" on my scripts to send me info about the linux box, something like: df -k | mail -s "disk usage" lalala@lalala.com. This works fine in all the linuxes that sendmail is installed, but there is one with Postfix... (1 Reply)
Discussion started by: piltrafa
1 Replies

10. UNIX for Dummies Questions & Answers

Configuring my PostFix Mail Server

Hi folks! I have a Postfix email server running on my MacOs x box. I would like to customize this automatic message to portuguese language: ============ This is the Postfix program at host myserver.com. I'm sorry to have to inform you that the message returned below could not... (4 Replies)
Discussion started by: fundidor
4 Replies
Login or Register to Ask a Question