Syslog-ng stores information about disk-buffers in the persist file.
The IP:PORT or DNS:PORT of the destinations and the name of the disk-buffer file.
/opt/syslog-ng/bin/persist-tool dump /opt/syslog-ng/var/syslog-ng.persist | grep '_qfile' | sed -e 's/\\//g'
Example output:
afsocket_dd_qfile(stream,10.21.10.112:514) = { "queue_file": "/opt/syslog-ng/var/syslog-ng-00000.rqf" }
/opt/syslog-ng/bin/persist-tool dump /opt/syslog-ng/var/syslog-ng.persist | awk -F '["=]' '/(qfile\(|\.queue)/ { gsub(/[ \t]+/, "", $5); gsub(/^[0-9A-Fa-f]{8}/, "", $5); "echo "$5"|xxd -r -p"|& getline QUEUE; printf("%s ==> %s\n",$1,QUEUE)}'
Example output:
afsocket_dd_qfile(stream,10.21.10.20:601) ==> /opt/syslog-ng/var/syslog-ng-00000.rqf
Note: If you get "xxd: command not found" error, install vim-common package in your system.
/opt/syslog-ng/bin/dqtool info DISK_QUEUE_FILE
/opt/syslog-ng/bin/dqtool info /opt/syslog-ng/var/syslog-ng-00000.qf
Disk-buffer state loaded; filename='/opt/syslog-ng/var/syslog-ng-00000.qf', qout_length='0', qbacklog_length='0', qoverflow_length='0', qdisk_length='0'
/opt/syslog-ng/bin/dqtool info /opt/syslog-ng/var/syslog-ng-00000.rqf
Reliable disk-buffer state loaded; filename='/opt/syslog-ng/var/syslog-ng-00000.rqf', queue_length='3519', size='1995952'
for qfile in /opt/syslog-ng/var/*.?(r)qf ; do /opt/syslog-ng/bin/dqtool info $qfile 2>&1 ; done | cut -f2 -d ";" | awk -F \' '/_length/ { if ($4 > 0) { print "\nNON-EMPTY DISK-BUFFER\t"$0; } else { print "\nEmpty disk-buffer\t"$0 } }'
Command syntax
/opt/syslog-ng/bin/dqtool cat DISK_QUEUE_FILE
Example (Short output)
/opt/syslog-ng/bin/dqtool cat /opt/syslog-ng/var/syslog-ng-00000.rqf
Reliable disk-buffer state loaded; filename='/opt/syslog-ng/var/syslog-ng-00000.rqf', queue_length='2952', size='-437712'
Jul 31 12:33:48.226 10.21.10.10 2019-07-31T12:33:36 localhost prg00000[1234]: seq: 0000000838, thread: 0000, runid: 1564569216, stamp: 2019-07-31T12:33:36 PADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADD
...
Syslog-ng creates a new disk-buffer file instead of using the old one in certain situations, for example, after modifying the disk-buffer configuration or losing the persist information.
Get the list of disk-buffer files from the persist file (see above) and compare it with the content of the disk-buffer files' saving directory.
Example
Disk-buffer file list from persist file:
afsocket_dd_qfile(stream,10.21.10.112:514) = { "queue_file": "/opt/syslog-ng/var/syslog-ng-00001.rqf" }
Disk-buffer files' saving directory content:
The disk-buffer files syslog-ng-00000.qf and syslog-ng-00000.rqf don't exist in the persist file, so they are orphan.
© 2024 One Identity LLC. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center