DirectAdmin log retention (/var/log/directadmin)

leolage

Verified User
Joined
Jul 2, 2019
Messages
6
We need log for months, but DirectAdmin automaticly remove log files and only maintance actual file lot and last 5 of access.log , login.log etc in /var/log/directadmin folder

[root@server directadmin]# ls access* -lah
-rw------- 1 root root 960K Mar 24 17:13 access.log
-rw------- 1 root root 2.1M Mar 20 03:51 access.log-20220320
-rw------- 1 root root 396K Mar 21 03:17 access.log-20220321
-rw------- 1 root root 2.4M Mar 22 03:40 access.log-20220322
-rw------- 1 root root 1.5M Mar 23 03:18 access.log-20220323
-rw------- 1 root root 832K Mar 24 03:09 access.log-20220324


Its possible keep these files for months (6 months for example) ? how to do this?

Thanks

Leo
 
I probably found a solution...

I'm editing file: /etc/logrotate.conf

and put:
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 16

# 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

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d





In folder /etc/logrotate.d I edited file directadmin with follow:

/var/log/directadmin/access.log {
daily
rotate 180
missingok
nocreate
}



I will try this configuration.
 
Back
Top