5

My Cron job is not running and i want to see what's problem in the syslog.

But that log is only showing current date only ,

Is there any way to keep logs for the last 10 days?

EEAA
  • 109,363
  • 18
  • 175
  • 245

2 Answers2

9

The logs are most likely being rotated by the logrotate process. Look in /etc/logrotate.conf. You should see something like this:

daily

rotate 1

Change that to:

daily

rotate 10

You could also do something like this to keep 4 weeks of logs:

weekly

rotate 4
EEAA
  • 109,363
  • 18
  • 175
  • 245
  • i want to keep logs in one file only like in syslog for 1 month. how can i do that –  Apr 29 '10 at 00:58
  • Keeping more then a couple of days in a single file is a *really* bad idea for any server out on the internet, as there's a bunch of things that people can do to cause your server to log junk. Having logrotate keep logs longer is ok. `man logrotate` should help. – LapTop006 Apr 29 '10 at 14:22
8

Yesterdays log is /var/log/syslog.1. They are rotated daily about 6 in the morning. Previous days logs are syslog.2.gz... Use zless or zgrep to look at the compressed logs.

Data is likely in /var/log/messages as well. This is rotated weekly, and has four weeks of old logs.

BillThor
  • 27,737
  • 3
  • 37
  • 69