Syslog Error: imjournal: fscanf on state file `/var/lib/rsyslog/imjournal.state’ failed


Syslog Stopped working and not printing the message logs. Error Log Shows the message : imjournal: fscanf on state file imjournal.state

Error

#systemctl status rsyslog.service shows the following error

imjournal: fscanf on state file `/var/lib/rsyslog/imjournal.state’ failed  [v8.23.0 try http://www.rsyslog.com/e/2027 ]

Reason

File /var/lib/rsyslog/imjournal.state got corrupted due to bad I/O.

Solution:

Remove /var/lib/rsyslog/imjournal.state file and restart the rsyslog service

#rm /var/lib/rsyslog/imjournal.state
#systemctl restart  rsyslog.service