Linux Commands and Scripts

Cron logs are showing incorrect time in CentOS 7

If your logs are showing incorrect time in CentOS 7, this tutorial will help you.

To check cron logs, use following command using root access:

# tail -n1 /var/log/cron

n1 = it will print one line.

You will get the result like:

Apr 10 09:17:01 [hostname] CROND[11570]: (nginx)

And your server’s actual time is different, like shown below:

# date
Fri Apr 10 10:17:01 EDT 2020

You are getting time difference because the timezone was changed, but rsyslog and crond services were not restarted and continue using the old timezone.

To resolve it, restart rsyslog and crond services

# systemctl restart rsyslog

# systemctl restart crond

Now, verify it by checking the log file.

# tail -n1 /var/log/cron

If you are still unable to fix the error, contact us. Our server experts will solve the issue.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles