linuxloggingrhel7

I have accidentally cleared contents from /var/log/messages and now log messages are not getting logged on my RHEL7.6 OS


On my RHEL 7.6 OS system, I have accidentally cleared contents from /var/log/messages and now logs are getting logged.

I have tried restarting the rsyslog using service rsyslog restart, After executing this command in /var/log/messages file below messages got generated. Even though in generated message it says Started System Logging Service still logs not getting logged. please suggest how to make this right.

Feb 10 12:15:31 dragon systemd: Stopping System Logging Service...
Feb 10 12:15:31 dragon rsyslogd: [origin software="rsyslogd" swVersion="8.24.0-34.el7" x-pid="5588" x-info="http://www.rsyslog.com"] exiting on signal 15.
Feb 10 12:15:31 dragon systemd: Stopped System Logging Service.
Feb 10 12:15:31 dragon systemd: Starting System Logging Service...
Feb 10 12:15:31 dragon rsyslogd: [origin software="rsyslogd" swVersion="8.24.0-34.el7" x-pid="20937" x-info="http://www.rsyslog.com"] start
Feb 10 12:15:31 dragon systemd: Started System Logging Service.

Solution

  • for RHEL7 OS, we need to use systemctl restart rsyslog command where service rsyslog restart can be use on RHEL6 servers.

    To test command worked fine, you can try with logger -i "New log is my command reaching.." if the statement gets logged on \var\log\messages then it has restarted logging back.