Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Logrotate not able to read /etc/logrotate.conf #2161

Closed
superseb opened this issue Dec 4, 2017 · 4 comments
Closed

Logrotate not able to read /etc/logrotate.conf #2161

superseb opened this issue Dec 4, 2017 · 4 comments

Comments

@superseb
Copy link
Contributor

superseb commented Dec 4, 2017

RancherOS Version: (ros os version)
1.1.0

$ system-docker restart logrotate
logrotate
$ system-docker logs logrotate
Handling 0 logs 
error: Ignoring /etc/logrotate.conf because of bad file mode - must be 0644 or 0444. 
Reading state from file: /var/lib/logrotate.status 
Allocating hash table for state file, size 64 entries
@niusmallnan
Copy link
Contributor

niusmallnan commented Dec 11, 2017

@superseb
Do you have a detailed way to reproduce it?
I boot a ROS(v1.1.0) by docker-machine, try this issue, but cannot see these errors.

Checked the logrotate.conf, the file mode is 644.

[docker@v1 ~]$ ls -al /etc/logrotate.conf
-rw-r--r--   19 root     root           207 Jul 26 20:13 /etc/logrotate.conf

@superseb
Copy link
Contributor Author

The system-cron kicks it off hourly, to trigger it, execute system-docker restart logrotate

@niusmallnan
Copy link
Contributor

@superseb
It should be fixed in v1.1.1.
When you have a chance, can you confirm again in v1.1.1?

The root cause:
Run with os-logrotate:v1.1.0

system-docker run --rm -it --entrypoint /bin/bash rancher/os-logrotate:v1.1.0
bash-4.4# ls -al /etc/logrotate.conf
-rw-rw-r--    2 root     root            35 Jul 17 11:19 /etc/logrotate.conf

Run with os-logrotate:v1.1.1

system-docker run --rm -it --entrypoint /bin/bash rancher/os-logrotate:v1.1.1
bash-4.4# ls -al /etc/logrotate.conf
-rw-r--r--    2 root     root            35 Dec  8 03:32 /etc/logrotate.conf

The image os-logrotate:v1.1.0 has the wrong file mode.

@superseb
Copy link
Contributor Author

  • docker-machine create -d virtualbox --virtualbox-boot2docker-url https://releases.rancher.com/os/v1.1.1/rancheros.iso rancheros
  • system-docker restart logrotate
# system-docker logs logrotate
reading config file /etc/logrotate.conf
including /etc/logrotate.d
reading config file dhcpcd.debug
reading config file docker
reading config file syslog
Reading state from file: /var/lib/logrotate.status
Allocating hash table for state file, size 64 entries

Handling 3 logs

rotating pattern: /var/log/dhcpcd.debug.log
 after 1 days (7 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/dhcpcd.debug.log
  log /var/log/dhcpcd.debug.log does not exist -- skipping
Creating new state

rotating pattern: /var/log/docker.log
/var/log/system-docker.log
 after 1 days (7 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/docker.log
Creating new state
  Now: 2017-12-12 11:39
  Last rotated at 2017-12-12 11:00
  log does not need rotating (log has been already rotated)
considering log /var/log/system-docker.log
Creating new state
  Now: 2017-12-12 11:39
  Last rotated at 2017-12-12 11:00
  log does not need rotating (log has been already rotated)

rotating pattern: /var/log/messages
/var/log/secure
/var/log/syslog
 after 1 days (7 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/messages
Creating new state
  Now: 2017-12-12 11:39
  Last rotated at 2017-12-12 11:00
  log does not need rotating (log has been already rotated)
considering log /var/log/secure
Creating new state
  Now: 2017-12-12 11:39
  Last rotated at 2017-12-12 11:00
  log does not need rotating (log has been already rotated)
considering log /var/log/syslog
Creating new state
  Now: 2017-12-12 11:39
  Last rotated at 2017-12-12 11:00
  log does not need rotating (log has been already rotated)
not running postrotate script, since no logs were rotated

LGTM

@niusmallnan niusmallnan modified the milestones: v1.1.2, v1.1.1 Dec 12, 2017
@daiyam daiyam mentioned this issue Dec 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants