syslog-ng
syslog-ng copied to clipboard
Increasing `disk-buf-size()` can make the disk-buffer file corrupt
syslog-ng
Version of syslog-ng
3.33 and upwards
Platform
Not platform specific
Issue
Failure
Increasing disk-buf-size()
can make the disk-buffer file corrupt if the disk-buffer file is in "wrapped" state.
Steps to reproduce
- Use the config below
- Start syslog-ng with
rm -rf ./var/syslog-ng* ; ./sbin/syslog-ng -Fe
- Send messages with loggen:
./bin/loggen -S --rate 10000 --active-connections 10 localhost 12345
- Wait for disk-buffer full messages to arrive, then stop loggen:
Destination reliable queue full, dropping message;
- Open the listener server, and close it quickly, when messages start to arrive, so we only read a couple of messages:
netcat -l localhost 12346
- Repeat steps 3 and 4
- Change the
disk-buf-size()
in the config to200MiB
- Reload syslog-ng:
./sbin/syslog-ng-ctl reload
- Open the listener server
netcat -l localhost 12346
- Observe the error message:
Error reading disk-queue file, cannot read record-length;
Configuration
@version: 3.37
source s_network {
network(port(12345));
};
destination d_network {
network(
"localhost"
port(12346)
time-reopen(2)
disk-buffer(
reliable(yes)
disk-buf-size(100MiB)
# disk-buf-size(200MiB)
)
);
};
log {
source(s_network);
destination(d_network);
};
Input and output logs
[2022-07-06T10:27:48.388516] Error reading disk-queue file, cannot read record-length; error='short read', filename='/home/alltilla/Work/install/OSE/var/syslog-ng-00000.rqf', offset='104858032'
[2022-07-06T10:27:48.388527] Cannot read correct message from disk-queue file; filename='/home/alltilla/Work/install/OSE/var/syslog-ng-00000.rqf', read_head='104858032'
[2022-07-06T10:27:48.388530] Error reading from disk-queue file, dropping disk queue; filename='/home/alltilla/Work/install/OSE/var/syslog-ng-00000.rqf'