LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-05-2010, 05:10 AM   #1
mohdsuboor23
Member
 
Registered: Sep 2010
Posts: 71

Rep: Reputation: 2
how to check logs for previous day


Hi every one.i want to know how to check maillogs for previous days.
wht is command to check log for yesturday in sendmail8.14 .fedora os
i know /var/log/maillog.this gives o/p for today but wht abut yesturday.???
 
Old 10-05-2010, 06:05 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
/var/log/maillog.0* or /var/log/maillog.1* if logrotate is running (which I assume it is)
 
Old 10-05-2010, 06:19 AM   #3
mohdsuboor23
Member
 
Registered: Sep 2010
Posts: 71

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by AlucardZero View Post
/var/log/maillog.0* or /var/log/maillog.1* if logrotate is running (which I assume it is)
hi tnx for ur reply. i tried that but its going to dec 6 or april 13 but not going to previous days is tail command will or anything.plz telme how to find that
 
Old 10-05-2010, 07:31 AM   #4
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
Originally Posted by mohdsuboor23 View Post
hi tnx for ur reply. i tried that but its going to dec 6 or april 13 but not going to previous days is tail command will or anything.plz telme how to find that
Try this

Code:
# tail /var/log/maillog | grep "Oct  4"     <- two space between Oct and 4
# tail /var/log/maillog.1 | grep "Oct  4"   <- two space between Oct and 4
this will display logs of 4th Oct.

Regards,
 
Old 10-05-2010, 09:30 AM   #5
mohdsuboor23
Member
 
Registered: Sep 2010
Posts: 71

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by sem007 View Post
Try this

Code:
# tail /var/log/maillog | grep "Oct  4"     <- two space between Oct and 4
# tail /var/log/maillog.1 | grep "Oct  4"   <- two space between Oct and 4
this will display logs of 4th Oct.

Regards,
tnx 4 ur reply.that command is also not working.its giving no value.plz any other commands.help appreciated.its important 4 me.
 
Old 10-05-2010, 09:50 AM   #6
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
Originally Posted by mohdsuboor23 View Post
tnx 4 ur reply.that command is also not working.its giving no value.plz any other commands.help appreciated.its important 4 me.
ok try grep command

Code:
# grep "Oct  4" /var/log/maillog
Did you try other file?
How many log files in log directory?

Code:
# ls -l /var/log/mail*
Are you able to view today's log?

There is possibility that your service not started on yesterday.

also post lines from below command

Code:
#tail -n5 /var/log/maillog
#tail -n5 /var/log/maillog.1
Regards,

Last edited by sem007; 10-05-2010 at 10:59 AM. Reason: add command
 
Old 10-05-2010, 10:46 AM   #7
ordinary
Member
 
Registered: Apr 2007
Location: the Rocket City
Distribution: Debian, Ubuntu, CentOS; in days past Fedora, Solaris, SunOS, 4.2BSD, 4.3BSD, SVR4, AIX, HP-UX
Posts: 101

Rep: Reputation: Disabled
Quote:
Originally Posted by mohdsuboor23 View Post
tnx 4 ur reply.that command is also not working.its giving no value.plz any other commands.help appreciated.its important 4 me.
That it's important for you doesn't mean it is for anyone else. If you want help, have enough respect to ask decipherable questions; use words rather than text-speek.

Next, just how did the advice given by sem007 fail? Did it produce no output at all? Did it produce an error?

Rather than grepping the tail of the logs, try grepping the entire log file.
 
Old 10-05-2010, 11:02 AM   #8
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
Hi mohdsuboor23,

You need to match the date with rotated maillog files.

Try this

Code:
# find /var/log -name "maillog*" | xargs grep "Oct  4"
Warm Regards,
 
Old 10-06-2010, 01:43 AM   #9
mohdsuboor23
Member
 
Registered: Sep 2010
Posts: 71

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by vinaytp View Post
Hi mohdsuboor23,

You need to match the date with rotated maillog files.

Try this

Code:
# find /var/log -name "maillog*" | xargs grep "Oct  4"
Warm Regards,
tnx all of u 4 ur replys.i tried all commands but when im pressing enter its going back to root no data or error its showing.its really imp 4 me to know this.is there anything i can do here.i have 4 logs files they are going 6 month back but not previous days....any sugestions plz
 
Old 10-06-2010, 03:59 AM   #10
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
Quote:
Originally Posted by mohdsuboor23 View Post
tnx all of u 4 ur replys.i tried all commands but when im pressing enter its going back to root no data or error its showing.its really imp 4 me to know this.is there anything i can do here.i have 4 logs files they are going 6 month back but not previous days....any sugestions plz
Hi,

It entirly depends on your logrotation policy defined for the rotation of maillogs.

Read this log rotation guide

Also check the files /etc/logrotate.conf and any other logrotation configuration used for rotating maillog under /etc/logrotate.d/

Warm Regards,

Last edited by vinaytp; 10-06-2010 at 04:02 AM.
 
Old 10-07-2010, 11:22 AM   #11
mago
Member
 
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284

Rep: Reputation: 33
I recommend using logwatch, it will compile the logs for the services you want it to summarized and mail them to you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenOffice.org Calc formula to check if day is last day of the month win32sux Linux - Software 1 01-19-2009 12:38 PM
previous day date display script tmaxx Linux - General 3 04-20-2007 01:20 AM
Can you restore a cron from previous day? Rustylinux SUSE / openSUSE 1 01-15-2007 05:07 PM
previous system boot logs xcr Linux - General 1 03-05-2006 03:29 AM
date command getting previous day swinchen Programming 6 08-23-2004 12:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration