centos 6.8: Deleted /var/log/messages .... it didn't come back?
You need to restart your system logger:
service rsyslog restart
(as root
).
A reboot would also have the same effect, but it's rather overkill.
Log messages go to a system logger, rsyslog
on CentOS, and the logger writes to various files depending on its configuration (or even other loggers on remote systems). rsyslog
opens /var/log/messages
when it starts, and keeps it open; deleting /var/log/messages
makes it disappear from the directory, but the file still exists and is usable by any program which had it open. So rsyslog
continues logging to the deleted file... Restarting it causes it to re-open the file, re-creating it first in this case.