How to set log rotation for asxdr.log [Resolved]


#1

Is there a log rotation for asxdr.log, does the size of asxdr.log always increase? How to control the size of asxdr.log? Thanks,


#2

Please see our info on logrotate to handle the xdr log rotation. Size of asxdr may vary depending on errors.

Links: https://www.aerospike.com/docs/operations/configure/log/logrotate.html

Sample code:

  [ ~]# cd /etc/logrotate.d/
    [logrotate.d]# ls -ltrh
    -rw-r--r--  1 root root 191 Jul 28 23:25 aerospike
    -rw-r--r--  1 root root 203 Jul 28 23:25 aerospike_xdr
    [root@v16 logrotate.d]# cat aerospike_xdr 
    /var/log/aerospike/asxdr.log {
        daily
        rotate 90
        dateext
        compress
        olddir /var/log/aerospike/
        missingok
        postrotate 
    	kill -HUP `cat /var/run/aerospike/asxdr.pid`
        endscript
    }

#3

It seems this log rotation doesn’t work: I had set a log rotate at 2015-08-01 while it doesn’t work

cat /etc/logrotate.d/aerospike_xdr
/var/log/aerospike/asxdr.log {
    daily
    rotate 90
    dateext
    compress
    olddir /var/log/aerospike/
    missingok
    postrotate
	kill -HUP `cat /var/run/aerospike/asxdr.pid`
    endscript
}

The asxdr.log doesn’t rotate:

ll /var/log/aerospike/asxdr* -rw------- 1 root root 107050354 8月 28 03:49 /var/log/aerospike/asxdr.log


#4

Is xdr-pidfile configured to this path in the xdr section ? Else, logrotate will not know the pid of the xdr process.


#5

yes

> xdr {
        enable-xdr      true
        namedpipe-path  /opt/aerospike/xdr_pipe
        digestlog-path  /opt/aerospike/digestlog 100000000
        errorlog-path   /var/log/aerospike/asxdr.log # Where errors XDR encounters are
        xdr-pidfile     /var/run/aerospike/asxdr.pid # Where to store the PID file for XDR

#6

Can you let us know which OS and version of logrotate you are using? Also please try to run the process manually to see if you get an error:

sudo logrotate -f /etc/logrotate.conf

and provide content of /etc/logrotate.conf

and directory permissions for: /etc/logrotate.d/


#7
sudo logrotate -f /etc/logrotate.conf
cmahealthd: no process found
cmastdeqd: no process found
cmahostd: no process found
cmathreshd: no process found
cmaperfd: no process found
cmasm2d: no process found
cmapeerd: no process found
cmaeventd: no process found
cmafcad: no process found
cmasasd: no process found
cmaidad: no process found
cmaided: no process found
cmascsid: no process found
sudo cat /etc/logrotate.conf
weekly
rotate 4
create
dateext
include /etc/logrotate.d
/var/log/wtmp {
    monthly
    create 0664 root utmp
	minsize 1M
    rotate 1
}
 /var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}
 ll /etc/logrotate.d/aerospike_xdr
-rw-r--r-- 1 root root 203 5  13 2014 /etc/logrotate.d/aerospike_xdr
ll /etc/logrotate.d/aerospike
-rw-r--r-- 1 root root 191 12 17 2014 /etc/logrotate.d/aerospike

Thanks


#8

Can you run the logrotate command in verbose mode with -v option and share the output.

sudo logrotate -f /etc/logrotate.conf -v

#9

Fixed, thanks a lot.


#10

Can you share with us what solved the problem. It may help others.


#11

hi,

Change the permissions for /etc/logrotate.d/aerospike_xdr to root:root就可以了