rsyslog client postrotate script contains invalid command
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack-Ansible |
Fix Released
|
High
|
Jean-Philippe Evrard |
Bug Description
Both 14 (Newton) and 15 (Ocata) tags
From rsyslog_
```
rsyslog_
- name: postrotate
content: "restart rsyslog 2>&1 || true"
```
This gets deployed as the following in logrotate files, e.g. /etc/logrotate.
```
/var/log/
[...22 more logfiles...]
{
weekly
missingok
rotate 14
compress
dateext
maxage 60
notifempty
nocreate
postrotate
restart rsyslog 2>&1 || true
endscript
}
```
Unfortunately, `restart` is an upstart-ism and doesn't exist in the systemd world of Ubuntu 16.04, so this doesn't actually restart the rsyslog service.
It appears that now with Ocata, logrotate scripts are now also deployed to hosts (not just containers), to rotate the logfiles for each LXC. My hosts email me the contents of stderr from anything run by cron, so now this shows up in my email:
```
/etc/cron.
logrotate_script: 2: logrotate_script: restart: not found
[...22 more identical lines...]
```
I tried changing the postrotate script to `systemctl restart rsyslog 2>&1 || true`. This doesn't cause an error which results in an email, but it also doesn't actually restart the rsyslog service, and I don't know why. Maybe it's a file permissions issue, or something with selinux?
We should be templating depending on the ansible_ service_ mgr: if "upstart", include this rule, if systemd, do something different.