Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logrotate permissions and ownerships need adjusting #1456

Closed
wongjtf99 opened this issue Dec 27, 2016 · 11 comments · Fixed by #1458 or #1459
Closed

Logrotate permissions and ownerships need adjusting #1456

wongjtf99 opened this issue Dec 27, 2016 · 11 comments · Fixed by #1458 or #1459
Labels

Comments

@wongjtf99
Copy link

Hello,

Logrotate of the netdata logs was not working on my Debian systems (Debian Jessie, Ubuntu 16.04 LTS, Ubuntu 14.04 LTS, Elementary O/S Loki, Linux Mint Cinnamon 18) ntil I made the following adjustments:

sudo chmod ugo-x /etc/logrotate.d/netdata
sudo chown root /var/log/netdata
sudo chgrp root /var/log/netdata

Hope the above solution helps somebody. Thanks.

@ktsaou
Copy link
Member

ktsaou commented Dec 27, 2016

thanks!

I am fixing the permissions of the logrotate file.

However, if /var/log/netdata is owned by root:root, netdata will not be able to create files there. Just delete the logs and restart netdata.

ktsaou added a commit to ktsaou/netdata that referenced this issue Dec 27, 2016
@wongjtf99
Copy link
Author

wongjtf99 commented Dec 27, 2016 via email

@wongjtf99
Copy link
Author

wongjtf99 commented Dec 28, 2016 via email

@wongjtf99
Copy link
Author

wongjtf99 commented Dec 28, 2016 via email

@ktsaou
Copy link
Member

ktsaou commented Dec 28, 2016

I think this will fix it:

/var/log/netdata/*.log {
        su netdata netdata
        daily
        missingok
        rotate 14
        compress
        delaycompress
        notifempty
        sharedscripts
        postrotate
                /bin/kill -HUP `pidof netdata 2>/dev/null` 2>/dev/null || true
        endscript
}

added line su netdata netdata.

I tested here and it works.

Can you test it?

@wongjtf99
Copy link
Author

wongjtf99 commented Dec 28, 2016 via email

@ktsaou
Copy link
Member

ktsaou commented Dec 28, 2016

Yes it is ok.

@ktsaou
Copy link
Member

ktsaou commented Dec 28, 2016

Check:

OS without su with su
ArchLinux FAILS
parent directory has insecure permissions
OK
Ubuntu 16.10 OK OK
Alpine 3.5 OK OK
AWS AMI OK FAILS
unknown option su

hm... I stopped.

I think the best option is to set mode 0755 to /var/log/netdata, while owned by netdata:netdata, without adding the su line. In this case ArchLinux works and AMI seems to work too.

ktsaou added a commit to ktsaou/netdata that referenced this issue Dec 28, 2016
@ktsaou
Copy link
Member

ktsaou commented Dec 28, 2016

I made another change. The directory will be owned by netdata:root with permissions 0755. This seems to work everywhere...

@ktsaou
Copy link
Member

ktsaou commented Dec 28, 2016

merged the change.
Just update your netdata and the installer will fix the permissions.

@wongjtf99
Copy link
Author

wongjtf99 commented Dec 29, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants