# logrotate error /var/log/cherokee/cherokee.*

## johnlu

Default logrotate configuration is not working for cherokee, I had to modify some time ago to this:

/etc/logrotate.d/cherokee:

```
# $Header: /var/cvsroot/gentoo-x86/www-servers/cherokee/files/cherokee.logrotate,v 1.1 2011/09/16 11:57:03 matsuu Exp $

# lighttpd logrotate script for Gentoo

/var/log/cherokee/cherokee.* {

  su cherokee cherokee

  missingok

  notifempty

  sharedscripts

  postrotate

  [ -f /var/run/cherokee/cherokee.pid ] && /bin/kill -USR2 `cat /var/run/cherokee.pid`

  endscript

}
```

And now it is not working again...

My /var/log/cherokee is like this before running logrotate:

```
# ls /var/log/cherokee -lh

total 1.7M

-rw-rw---- 1 cherokee cherokee 1.7M Nov 23 13:16 cherokee.access

-rw-rw---- 1 cherokee cherokee 4.6K Nov 17 17:01 cherokee.error

```

# logrotate --verbose /etc/logrotate.d/cherokee

```
reading config file /etc/logrotate.d/cherokee

Handling 1 logs

rotating pattern: /var/log/cherokee/cherokee.*  1048576 bytes (no old logs will be kept)

empty log files are not rotated, old logs are removed

switching euid to 101 and egid to 440

considering log /var/log/cherokee/cherokee.access

  log needs rotating

considering log /var/log/cherokee/cherokee.error

  log does not need rotating

rotating log /var/log/cherokee/cherokee.access, log->rotateCount is 0

dateext suffix '-20111123'

glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'

renaming /var/log/cherokee/cherokee.access.1 to /var/log/cherokee/cherokee.access.2 (rotatecount 1, logstart 1, i 1), 

old log /var/log/cherokee/cherokee.access.1 does not exist

renaming /var/log/cherokee/cherokee.access.0 to /var/log/cherokee/cherokee.access.1 (rotatecount 1, logstart 1, i 0), 

old log /var/log/cherokee/cherokee.access.0 does not exist

log /var/log/cherokee/cherokee.access.2 doesn't exist -- won't try to dispose of it

renaming /var/log/cherokee/cherokee.access to /var/log/cherokee/cherokee.access.1

disposeName will be /var/log/cherokee/cherokee.access.1

running postrotate script

error: error running shared postrotate script for '/var/log/cherokee/cherokee.* '

switching euid to 0 and egid to 0
```

My /var/log/cherokee is like this after running logrotate:

```
# ls -lh /var/log/cherokee

total 1.7M

-rw-rw---- 1 cherokee cherokee 1.7M Nov 23 13:16 cherokee.access.1

-rw-rw---- 1 cherokee cherokee 4.6K Nov 17 17:01 cherokee.error

```

----------

## truc

The only error I see is

```
error: error running shared postrotate script for '/var/log/cherokee/cherokee.* ' 
```

Given you postrotate oneliner, I'd check if that pid file is really updated with cherokee, try that command manually may be

----------

## johnlu

I edited /etc/logrotate.d/cherokee as follows:

```
[ -f /var/run/cherokee.pid ] && /bin/kill -USR2 `cat /var/run/cherokee.pid`
```

Then I ran logrotate --verbose /etc/logrotate.d/cherokee:

```
# logrotate --verbose /etc/logrotate.d/cherokee

reading config file /etc/logrotate.d/cherokee

Handling 1 logs

rotating pattern: /var/log/cherokee/cherokee.*  1048576 bytes (no old logs will 

be kept)   

empty log files are not rotated, old logs are removed

switching euid to 101 and egid to 440

considering log /var/log/cherokee/cherokee.access.1

  log needs rotating

considering log /var/log/cherokee/cherokee.error

  log does not need rotating

rotating log /var/log/cherokee/cherokee.access.1, log->rotateCount is 0

dateext suffix '-20111123'

glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'

renaming /var/log/cherokee/cherokee.access.1.1 to /var/log/cherokee/cherokee.acc

ess.1.2 (rotatecount 1, logstart 1, i 1),

old log /var/log/cherokee/cherokee.access.1.1 does not exist

renaming /var/log/cherokee/cherokee.access.1.0 to /var/log/cherokee/cherokee.acc

ess.1.1 (rotatecount 1, logstart 1, i 0),

old log /var/log/cherokee/cherokee.access.1.0 does not exist

log /var/log/cherokee/cherokee.access.1.2 doesn't exist -- won't try to dispose 

of it

renaming /var/log/cherokee/cherokee.access.1 to /var/log/cherokee/cherokee.acces

s.1.1

disposeName will be /var/log/cherokee/cherokee.access.1.1

running postrotate script

removing old log /var/log/cherokee/cherokee.access.1.1

switching euid to 0 and egid to 0
```

It deleted my old cherokee logs and didn't created a separate log!!  :Sad: 

```
# ls /var/log/cherokee/ -lh

total 12K  

-rw-r----- 1 cherokee cherokee  291 Nov 23 16:18 cherokee.access

-rw-rw---- 1 cherokee cherokee 4.6K Nov 17 17:01 cherokee.error

```

----------

