as for /etc/logrotate.conf
its configuration is :
# see "man logrotate" for details
# global options do not affect preceding include directives
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# system-specific logs may also be configured here.
as for /etc/logrotate.d/netdata
:
/opt/netdata/var/log/netdata/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /opt/netdata/var/run/netdata/netdata.pid 2>/dev/null` 2>/dev/null || true
endscript
}
ls -la /opt/netdata/var/log/netdata
output is:
total 75556
drwxr-xr-x. 1 netdata netdata 56 Feb 13 20:25 .
drwxrwxr-x. 1 netdata netdata 14 Feb 13 02:26 ..
-rw-r--r--. 1 netdata netdata 276 Feb 13 20:25 access.log
-rw-r--r--. 1 netdata netdata 0 Feb 13 20:25 debug.log
-rw-r--r--. 1 netdata netdata 77364988 Apr 5 19:42 error.log
ls -la /etc/logrotate.d
output is:
total 56
drwxr-xr-x. 1 root root 176 Apr 3 16:12 .
drwxr-xr-x. 1 root root 4908 Apr 5 07:57 ..
-rw-r--r--. 1 root root 91 Mar 31 2021 bootlog
-rw-r--r--. 1 root root 130 Oct 14 2019 btmp
-rw-r--r--. 1 root root 160 Dec 16 14:17 chrony
-rw-r--r--. 1 root root 88 Mar 14 12:56 dnf
-rw-r--r--. 1 root root 93 Mar 25 22:31 firewalld
-rw-r--r--. 1 root root 331 Mar 17 18:26 httpd
-rw-r--r--. 1 root root 172 Mar 11 2021 iscsiuiolog
-rw-r--r--. 1 root root 239 Feb 13 20:25 netdata
-rw-r--r--. 1 root root 136 Jul 23 2021 ppp
-rw-r--r--. 1 root root 408 Jul 23 2021 psacct
-rw-r--r--. 1 root root 155 Mar 16 18:49 samba
-rw-r--r--. 1 root root 237 Jan 25 14:03 sssd
-rw-r--r--. 1 root root 100 Jan 26 19:06 wpa_supplicant
-rw-r--r--. 1 root root 145 Oct 14 2019 wtmp
also edited netdata.cof
:
[abdalrahmanazab@fedora ~]$ sudo su -
[sudo] password for abdalrahmanazab:
[root@fedora ~]# sudo gedit /etc/logrotate.d/netdata
#added su netdata netdata
to it
[root@fedora ~]# semanage fcontext -a -t var_log_t "/opt/netdata/var/log/netdata(/.*)?"
[root@fedora ~]# restorecon -Rv /opt/netdata/var/log/netdata
Relabeled /opt/netdata/var/log/netdata from unconfined_u:object_r:usr_t:s0 to unconfined_u:object_r:var_log_t:s0
Relabeled /opt/netdata/var/log/netdata/debug.log from system_u:object_r:usr_t:s0 to system_u:object_r:var_log_t:s0
Relabeled /opt/netdata/var/log/netdata/error.log from system_u:object_r:usr_t:s0 to system_u:object_r:var_log_t:s0
Relabeled /opt/netdata/var/log/netdata/access.log from system_u:object_r:usr_t:s0 to system_u:object_r:var_log_t:s0
[root@fedora ~]# logrotate -v --force /etc/logrotate.d/netdata.conf
error: cannot stat /etc/logrotate.d/netdata.conf: No such file or directory
Reading state from file: /var/lib/logrotate/logrotate.status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Handling 0 logs
set default create context to system_u:object_r:logrotate_var_lib_t:s0
[root@fedora ~]#
then ls -la /opt/netdata/var/log/netdata
again:
[root@fedora ~]# ls -la /opt/netdata/var/log/netdata
total 75572
drwxr-xr-x. 1 netdata netdata 56 Feb 13 20:25 .
drwxrwxr-x. 1 netdata netdata 14 Feb 13 02:26 ..
-rw-r--r--. 1 netdata netdata 276 Feb 13 20:25 access.log
-rw-r--r--. 1 netdata netdata 0 Feb 13 20:25 debug.log
-rw-r--r--. 1 netdata netdata 77378119 Apr 5 20:21 error.log
and ls -la /etc/logrotate.d
again :
[root@fedora ~]# ls -la /etc/logrotate.d
total 56
drwxr-xr-x. 1 root root 176 Apr 5 20:20 .
drwxr-xr-x. 1 root root 4908 Apr 5 07:57 ..
-rw-r--r--. 1 root root 91 Mar 31 2021 bootlog
-rw-r--r--. 1 root root 130 Oct 14 2019 btmp
-rw-r--r--. 1 root root 160 Dec 16 14:17 chrony
-rw-r--r--. 1 root root 88 Mar 14 12:56 dnf
-rw-r--r--. 1 root root 93 Mar 25 22:31 firewalld
-rw-r--r--. 1 root root 331 Mar 17 18:26 httpd
-rw-r--r--. 1 root root 172 Mar 11 2021 iscsiuiolog
-rw-r--r--. 1 root root 259 Apr 5 20:20 netdata
-rw-r--r--. 1 root root 136 Jul 23 2021 ppp
-rw-r--r--. 1 root root 408 Jul 23 2021 psacct
-rw-r--r--. 1 root root 155 Mar 16 18:49 samba
-rw-r--r--. 1 root root 237 Jan 25 14:03 sssd
-rw-r--r--. 1 root root 100 Jan 26 19:06 wpa_supplicant
-rw-r--r--. 1 root root 145 Oct 14 2019 wtmp
i think that nothing changed 
also should my logrotate.config
to be containing su root adm
or not
by default it isnt but i read some people r saying that so idk
maybe i have to wait a couple of days / until the next rotation date to see if the same error appeared again or it has been solved ?
Thank you for your encouragement/help btw C: