Hello,
I have a centos 7 rsyslog server that I am using for my network gear (SRX). getting the logs is working great but I am trying to setup to rotate the logs. the log is located in /var/log/<filename.log>. I have log rotate setup as,
/var/log/<filename.log> {
missingok
weekly
rotate 5
maxsize 10m
compress
}
when I do a test run i get long list of error saying lines must begin with a keyword or file.
any help would be appreciated.
logrotate: error: lines must begin with a keyword or a filename (possibly in double quotes)
-
- Posts: 2
- Joined: 2017/01/04 15:28:49
-
- Posts: 1521
- Joined: 2014/05/21 20:16:00
- Location: Central New York, USA
Re: logrotate: error: lines must begin with a keyword or a filename (possibly in double quotes)
Exactly what file are you editing in the quest for your desired result (a given log to 'rotate')? I remember having issues myself a year or two ago. When I installed CentOS, logrotate was all setup by default.
What exactly is your "test run"?
What exactly is your "test run"?
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
Re: logrotate: error: lines must begin with a keyword or a filename (possibly in double quotes)
Run logrotate command in debug mode and only for your specific logrotate file and provide full output here.
Something like:
Something like:
Code: Select all
logrotate -df /etc/logrotate.d/my.conf
-
- Posts: 2
- Joined: 2017/01/04 15:28:49
Re: logrotate: error: lines must begin with a keyword or a filename (possibly in double quotes)
I am editing the /etc/logrotate.conf file. I added my log file which is /var/log/ATLFW01_*.log this is the file all my logs are going to. when I try to do a test run of logrotate -d /var/log/ATLFW01_*.log i get a bunch of lines that say the error above.
Re: logrotate: error: lines must begin with a keyword or a filename (possibly in double quotes)
Then you almost certainly have a syntax error in your additions - most likely you forgot to close a {} pair or something like that.
It's not intended that you edit that file anyway. Logrotate is set up so that each service and/or file that you want it to process should be in a separate file in /etc/logrotate.d as those are all included from logrotate.conf using "include /etc/logrotate.d".
Also, I just noticed that you invoked logrotate and pointed to the logfile you want to process when you should be pointing it to the _config_ file that you want to process. It's trying to read your logfile as a config file and not finding any valid syntax in it (unsurprisingly).
It's not intended that you edit that file anyway. Logrotate is set up so that each service and/or file that you want it to process should be in a separate file in /etc/logrotate.d as those are all included from logrotate.conf using "include /etc/logrotate.d".
Also, I just noticed that you invoked logrotate and pointed to the logfile you want to process when you should be pointing it to the _config_ file that you want to process. It's trying to read your logfile as a config file and not finding any valid syntax in it (unsurprisingly).
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
-
- Posts: 2
- Joined: 2015/11/17 09:23:49
Re: logrotate: error: lines must begin with a keyword or a filename (possibly in double quotes)
I ran into this today. You most likely created the file on a windows machine. You need to make sure the Unix EOL format is used. This error gets thrown up when a <CR> character is encountered.