fix logging: add logrotate

This commit is contained in:
Alexey Avramov 2019-03-20 19:21:50 +09:00
parent a6171e85b8
commit 7d13107463
4 changed files with 14 additions and 10 deletions

View File

@ -17,6 +17,8 @@ install:
install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/$(VERSION)
install -m0644 ./nohang.conf $(DESTDIR)/$(PREFIX)/etc/nohang/nohang.conf.default
install -m0644 ./nohang.logrotate $(DESTDIR)/$(PREFIX)/etc/logrotate.d/nohang
install -d $(DESTDIR)/$(PREFIX)/usr/share/man/man1
gzip -k -c nohang.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/nohang.1.gz
gzip -k -c oom-sort.1 > $(DESTDIR)/$(PREFIX)/usr/share/man/man1/oom-sort.1.gz
@ -37,6 +39,7 @@ uninstall:
rm -fv $(PREFIX)/usr/share/man/man1/oom-trigger.1.gz
rm -fv $(PREFIX)/lib/systemd/system/nohang.service
rm -fvr $(PREFIX)/etc/nohang/
rm -fvr $(PREFIX)/etc/logrotate.d/nohang
rm -fvr $(PREFIX)/var/log/nohang/
systemd:

9
nohang
View File

@ -1740,13 +1740,6 @@ else:
exit(1)
if 'log_dir' in config_dict:
log_dir = config_dict['log_dir']
else:
errprint('log_dir is not in config\nExit')
exit(1)
print_total_stat = conf_parse_bool('print_total_stat')
print_proc_table = conf_parse_bool('print_proc_table')
@ -1758,6 +1751,8 @@ if separate_log:
from logging import basicConfig
from logging import info
log_dir = '/var/log/nohang'
try:
os.mkdir(log_dir)
except PermissionError:

View File

@ -384,9 +384,6 @@ max_ancestry_depth = 1
separate_log = False
log_dir = /var/log/nohang
#####################################################################
9. Misc

9
nohang.logrotate Normal file
View File

@ -0,0 +1,9 @@
/var/log/nohang/*.log {
missingok
copytruncate
notifempty
size 1M
rotate 5
compress
delaycompress
}