Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-05-2010, 05:10 AM
|
#1
|
Member
Registered: Sep 2010
Posts: 71
Rep:
|
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.???
|
|
|
10-05-2010, 06:05 AM
|
#2
|
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824
|
/var/log/maillog.0* or /var/log/maillog.1* if logrotate is running (which I assume it is)
|
|
|
10-05-2010, 06:19 AM
|
#3
|
Member
Registered: Sep 2010
Posts: 71
Original Poster
Rep:
|
Quote:
Originally Posted by AlucardZero
/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
|
|
|
10-05-2010, 07:31 AM
|
#4
|
Member
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638
Rep: 
|
Quote:
Originally Posted by mohdsuboor23
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,
|
|
|
10-05-2010, 09:30 AM
|
#5
|
Member
Registered: Sep 2010
Posts: 71
Original Poster
Rep:
|
Quote:
Originally Posted by sem007
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.
|
|
|
10-05-2010, 09:50 AM
|
#6
|
Member
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638
Rep: 
|
Quote:
Originally Posted by mohdsuboor23
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
|
|
|
10-05-2010, 10:46 AM
|
#7
|
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: 
|
Quote:
Originally Posted by mohdsuboor23
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.
|
|
|
10-05-2010, 11:02 AM
|
#8
|
Member
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707
Rep:
|
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,
|
|
|
10-06-2010, 01:43 AM
|
#9
|
Member
Registered: Sep 2010
Posts: 71
Original Poster
Rep:
|
Quote:
Originally Posted by vinaytp
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
|
|
|
10-06-2010, 03:59 AM
|
#10
|
Member
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707
Rep:
|
Quote:
Originally Posted by mohdsuboor23
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.
|
|
|
10-07-2010, 11:22 AM
|
#11
|
Member
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284
Rep:
|
I recommend using logwatch, it will compile the logs for the services you want it to summarized and mail them to you.
|
|
|
All times are GMT -5. The time now is 09:32 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|