- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- how to check the mail logs of "02-05-08" and for u...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2008 10:45 PM
тАО07-02-2008 10:45 PM
how to check the mail logs of "02-05-08" and for user "test"
# tail -f /var/log/mail |grep "test"
Jul 3 12:16:02 tiger postfix/local[6981]: 036A23178E: to=
.
.
shows all the messages related to user "test",
but I need to ADD another condition..the "date", i.e I need to grep messages of user test *but only of the specific date*
I did the following
# tail -f /var/log/mail |grep "test" |grep "Jul 2"
no results ;(
need to redirect messages related to user test on June 29 on a separate file.. following also doesn't works.
grep test /var/log/mail |grep "Jun 29" >/logs/test_mail_on_JUL29.txt
or
grep test /var/log/mail |grep "Jun 29" - >/logs/test_mail_on_JUL29.txt
help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-03-2008 12:56 AM
тАО07-03-2008 12:56 AM
Re: how to check the mail logs of "02-05-08" and for user "test"
Looks like your two step grep process will do the job.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-03-2008 06:03 AM
тАО07-03-2008 06:03 AM
Re: how to check the mail logs of "02-05-08" and for user "test"
This command:
grep test /var/log/mail |grep "Jun 29" >/logs/test_mail_on_JUL29.txt
Should do the job. I would like to see the output of the command before the pipe.
Maybe you just don't have any mail to "test" on "Jun 29".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-03-2008 09:49 PM
тАО07-03-2008 09:49 PM
Re: how to check the mail logs of "02-05-08" and for user "test"
following works fine
tail -f /var/log/mail |grep "test"
following doesnt works
tail -f /var/log/mail |grep "test" |grep "Jul 4"
two spaces in b/w "Jul and 4".
neither following works
tail -f /var/log/mail |grep "test" |grep "Jul +4"
but following works ;)
tail -f /var/log/mail |grep "test" |grep "Jul\ 4"
here two spaces after backslash(\), and before "4".
and following also works
# grep test /var/log/mail |grep "Jun\ 29" > mails.txt
here two spaces after backslash(\), and before "29".
i.e have to insert "
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-04-2008 04:07 PM
тАО07-04-2008 04:07 PM
Re: how to check the mail logs of "02-05-08" and for user "test"
"+" is an ERE, for egrep. Use "*" for a RE.
>here two spaces after backslash(\), and before "4".
Hmm, I wouldn't think you would need a "\".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2008 08:22 PM
тАО07-07-2008 08:22 PM
Re: how to check the mail logs of "02-05-08" and for user "test"
>"+" is an ERE, for egrep. Use "*" for a RE.
Yes following also works
# tail -f /var/log/mail |grep "test" |grep "Jul *8"
# grep test /var/log/mail |grep "Jul *8" >
mails.txt
i.e