logrorate: error: lines must begin with a keyword or a filename (possibly in double quotes)

Logrotate command returns the following error:

# logrotate -vf /etc/logrotate.d/mylog

reading config file mylog
reading config info for /var/log/mylog.log 
error: iptables:1 lines must begin with a keyword or a filename (possibly in double quotes)

Solution

This error appear because you the logrotate configuration file is not a valid Unix file. Execute the following command to convert the logrotate file to unix format.

# dos2unix -b /etc/logrotate.d/mylog

where -b stands for backup.

Alternative command is:
# tr -d '\r' < /etc/logrotate.d/mylog > /etc/logrotate.d/mylog


You May Also Like

avatar

About the Author: TekFik

TekFik is a technical blogging site helps techies and engineers to solve their day to day issues and also allows everyone to share knowledge and feedback. Please feel free to contact us at tekfik.rd@gmail.com if there is anything.

Leave a Reply

Your email address will not be published. Required fields are marked *