CarlC

Registered
Aug 29, 2003
4
0
151
I'm having a heck of a time getting logrotate to work. I've searched the web and read the directions from various sources and keep coming up with the same tye of errors. Below is my logrotate.conf

# see "man logrotate" for details
# rotate log files daily
daily

# keep 7 days worth of backlogs
rotate 7

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
weekly
create 0664 root utmp
rotate 3
}

# system-specific logs may be also be configured here.


This is the main errors I'm trying to find out why they are happening.

/usr/sbin/logrotate -vf /etc/logrotate.conf
reading config file /etc/logrotate.conf
error: /etc/logrotate.conf:3 unexpected text
error: /etc/logrotate.conf:4 lines must begin with a keyword or a filename (possibly in double quotes)
error: /etc/logrotate.conf:6 unexpected text
error: /etc/logrotate.conf:7 lines must begin with a keyword or a filename (possibly in double quotes)
error: /etc/logrotate.conf:9 unexpected text
error: /etc/logrotate.conf:10 lines must begin with a keyword or a filename (possibly in double quotes)
error: /etc/logrotate.conf:12 unexpected text
error: /etc/logrotate.conf:13 lines must begin with a keyword or a filename (possibly in double quotes)
including /etc/logrotate.d
error: Ignoring named.rpmnew, because of .rpmnew ending
error: Ignoring syslog.rpmorig, because of .rpmorig ending
error: Ignoring rpm.rpmnew, because of .rpmnew ending
error: Ignoring cups.rpmnew, because of .rpmnew ending
reading config file cups
reading config info for /var/log/cups/*_log
reading config file exim
reading config info for /var/log/exim_mainlog
reading config info for /var/log/exim_paniclog
reading config info for /var/log/exim_rejectlog
reading config file httpd
reading config info for /var/log/httpd/*log
error: httpd:1 lines must begin with a keyword or a filename (possibly in double quotes)
error: httpd:2 unexpected text
error: httpd:3 unexpected text
error: httpd:4 unexpected text
error: httpd:5 unexpected text
error: httpd:6 unexpected text
error: httpd:7 unexpected text
error: httpd:8 unexpected text
error: httpd:9 unexpected text
error: httpd:prerotate or postrotate without endscript


Does anyone have any ideas, I've been trying to figure this out now for 2 days.

Appreciate any input
Thanks in advance

BTW I'm running Apache 1.3.33, on a linux server with WHM cPanel 10.x
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Do you have Linux linefeeds in /etc/logrotate.conf or could they be DOS ones by mistake?

If you edit the file using:

pico -w /etc/logrotate.conf does it report DOS lines in the file at the bottom of the page? If so, do a <ctrl-o> to force a write, exit, and then try the logrotate again.
 

CarlC

Registered
Aug 29, 2003
4
0
151
Well I guess I learned something the hard way, I was using Crimson Editor thinking that it wouldn't be a problem. Now the config file isn't giving errors instead I'm getting the following

reading config file /etc/logrotate.conf
including /etc/logrotate.d
error: Ignoring named.rpmnew, because of .rpmnew ending
error: Ignoring syslog.rpmorig, because of .rpmorig ending
error: Ignoring rpm.rpmnew, because of .rpmnew ending
error: Ignoring cups.rpmnew, because of .rpmnew ending
reading config file cups
reading config info for /var/log/cups/*_log
reading config file exim
reading config info for /var/log/exim_mainlog
reading config info for /var/log/exim_paniclog
reading config info for /var/log/exim_rejectlog
reading config file httpd
reading config info for /var/log/httpd/*log
error: httpd:1 lines must begin with a keyword or a filename (possibly in double quotes)
error: httpd:2 unexpected text
error: httpd:3 unexpected text
error: httpd:4 unexpected text
error: httpd:5 unexpected text
error: httpd:6 unexpected text
error: httpd:7 unexpected text
error: httpd:8 unexpected text
error: httpd:9 unexpected text
error: httpd:prerotate or postrotate without endscript


I'm not sure what the first 4 lines mean - is it good or bad
The httpd must be messed up somehow I copied it below

/var/log/httpd/*log {
weekly
missingok
rotate 4
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate

/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}

I did notice that the logs except for error_log.1 was empty in that directory.
 

CarlC

Registered
Aug 29, 2003
4
0
151
Well I guess I had the same problem with httpd in logrotate.d directory, I don't remember doing anything there but maybe I did.

The only error left is below

error: bad line 80 in state file /var/lib/logrotate.status

I sure do appreciate the help, it at least gave me some things to check and I learned something new.

Thanks again
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
You should be able to simply delete that file and then rerun logrotate. If it then errors again, post the contents of the status file.