I am trying to rotate a log file using logrorate. Following is the configuration:/etc/logrotate.conf:/var/log/test.log {        size 1M        rotate 6        create        dateext        nocompress}Then I dump some data using seq command to /var/log/test.log, but the file is not being rotated automatically.ls -ltrh test.log-rw-r--r-- 1 root root 1.3M Jan 27 09:56 test.logWhen I try to rotate it forcefully using logrotate -f test.log, the output would be:error: test.log:37156 lines must begin with a keyword or a filename (possibly in double quotes)error: test.log:37157 lines must begin with a keyword or a filename (possibly in double quotes)error: test.log:37158 lines must begin with a keyword or a filename (possibly in double quotes)error: test.log:37159 lines must begin with a keyword or a filename (possibly in double quotes)Suggest if any corrections needed.
Logrotate: Log file not being rotated
linux;logs;logrotate
The argument to logrotate is supposed to be a configuration file, hence the errors about test.log being a malformed configuration file.  Try:logrotate -f /etc/logrotate.confIf that doesn't work, you may try with debug logging turned on using the -d options.  Finally, I've run into cases where the only way to coax logrotate into rotating the log file is to modify its state file /var/lib/logrotate.status.  The file has the format:logrotate state -- version 2/path/to/a.log 2015-1-26-11:0:0/path/to/another.log 2015-1-26-11:0:0where the second column is the date the file was last modified.  You can push the date further into the past to convince logrotate to run; but, this shouldn't be necessary given your config since you are using a size based rotation.