Minion sometimes stops logging after logrotate
It appears that after a logrotate has occurred the minion stops logging:
root@shared01:/var/log/salt# ls -alh
total 360K
drwxr-xr-x 2 root root 4,0K jun 15 06:42 .
drwxrwxr-x 14 root syslog 4,0K jun 19 06:37 ..
-rw------- 1 root root 0 jun 15 06:42 minion
-rw------- 1 root root 75K jun 11 09:58 minion.1.gz
-rw------- 1 root root 13K jun 10 10:47 minion.2.gz
-rw------- 1 root root 2,4K jun 5 16:01 minion.3.gz
-rw------- 1 root root 43K mei 26 10:58 minion.4.gz
-rw------- 1 root root 133 mei 14 01:40 minion.5.gz
-rw------- 1 root root 72K mei 7 10:05 minion.6.gz
-rw------- 1 root root 134K mei 2 14:50 minion.7.gz
I have checked another minion and there it is logging properly though.
Logging has not explicitly been configured in the minion configuration so it uses the default values.
Version report:
Salt: 2014.1.5
Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.3.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
PyYAML: 3.10
PyZMQ: 14.0.1
ZMQ: 4.0.4
Thanks for the report, we'll investigate this. Keep us posted if you can find any way to consistently reproduce this.
@s0undt3ch any idea what might be going on here?
If python logging can't detect that we lost the current file.... it should at least error out...
I'll see what's going on here...
I can confirm I'm experiencing this problem as well with this logrotate configuration:
$ cat /etc/logrotate.d/salt-minion /var/log/salt/minion { missingok notifempty rotate 7 daily sharedscripts delaycompress postrotate /sbin/service salt-minion condrestart endscript }
Do we have a status on this?
That would be @s0undt3ch -- did you ever have a chance to look into this?
Still haven't had time to investigate this
Seeing the same sort of thing here.
Salt: 2014.7.0
Python: 2.6.9 (unknown, Sep 13 2014, 00:25:11)
Jinja2: 2.7.2
M2Crypto: 0.20.2
msgpack-python: 0.1.13 msgpack-pure: Not Installed pycrypto: 2.6.1 libnacl: Not Installed PyYAML: 3.10 ioflo: Not Installed PyZMQ: 14.3.1 RAET: Not Installed ZMQ: 3.2.4 Mako: Not Installed
Also, I'm also seeing the minion getting stuck in state.sls after log rotation.
The function "state.sls" is running as PID 26980 and was started at 2014, Nov 25 18:11:39.264444 with jid 20141125181139264444
Restarting the minion seems to fix it until the next log rotation.
I think I am experiencing this one as well.
Ubuntu 12.04 and Ubuntu 14.04
$ salt-minion --versions
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.3.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
Moreover, on my systems, minions fails to respond to master after that rotation occured.
For now, I added a postrotate script to restart the service after a rotation
/var/log/salt/minion {
weekly
missingok
rotate 7
compress
notifempty
postrotate
sudo service salt-minion restart
endscript
}
I'm also seeing minions getting wedged after logrotation. It doesn't happen on all of the hosts, but on many. I ended up updating the logrotate routine to bounce the minion too
Centos6, salt-minion-2014.1.10-4.el5
Is there a pattern? Or is it different machines each time?
For me there wasn't a pattern - different machines on different days. I didn't track it specifically since postrotate minion restart "fixed" it
My pattern was : every thursday morning, I had down minions. After
investigation, it matched the weekly option of my /etc/logrotate.d/salt- common which, I guess, came with the Ubuntu package.
Le lundi 5 janvier 2015, 11:57:55 David Nguyen a écrit :
For me there wasn't a pattern - different machines on different days. I didn't track it specifically since postrotate minion restart "fixed" it
Reply to this email directly or view it on GitHub: https://github.com/saltstack/salt/issues/13558#issuecomment-68767249
@s0undt3ch You need to use the WatchedFileHandler class if you expect external software to rotate your logs.
Any update on this issue ? Here is my exact pattern :
- minions runnings
- logrotate rotates
/var/log/salt/minion - minions keep responding to
salt-call manage.up - let pass a few days (or any arbitrary amount of time) doing nothing with salt
- run a command from the master
salt * test.ping - minions crashes (sometimes not immediately, but after a few commands)
- call admin to ssh into minions and resurect them
Today, I noticed that all minions crashed, but I didnot targetted them all. I mean i runned salt 'G@env:dev' test.ping and all minions crashed (I expected just those matching G@env:dev to crash)
I think salt minion should rotate its own logs instead of outsourcing its job to logrotate.
@thedrow we do use WatchedFileHandler for Py >= 2.6 @crocket sysadmins are used to having logorate do the logs rotation, a feature required to specify rotation could be opened though and the conversation about it could be continued there.
@s0undt3ch In that case I have no idea what could be wrong. What happens if you just remove the log file using rm? Does salt still stop logging?
Guess we need to add a test case to try exactly that....