The syslog-ng PE application can store log messages securely in encrypted, compressed and timestamped binary files. Timestamps can be requested from an external Timestamping Authority (TSA).
Logstore files consist of individual chunks, every chunk can be encrypted, compressed, and timestamped separately. Chunks contain compressed log messages and header information needed for retrieving messages from the logstore file.
The syslog-ng PE application generates an SHA-1 hash for every chunk to verify the integrity of the chunk. The hashes of the chunks are chained together to prevent injecting chunks into the logstore file. The syslog-ng PE application can encrypt the logstore using various algorithms, using the aes128 encryption algorithm in CBC mode and the hmac-sha1 hashing (HMAC) algorithm as default.
In the following example, a simple logstore destination is added which stores logs with maximum compression.
To store messages in encrypted files
-
Open the /opt/syslog-ng/etc/syslog-ng.conf configuration file in a text editor
-
Locate the line starting with destination d_messages
-
Add the following line right below:
destination d_logstore { logstore("/var/log/messages.lgs" compress(9) ); };
-
Locate the line containing destination(d_messages)
-
Add the following line right below:
destination(d_logstore)
-
Restart syslog-ng for the configuration changes to take effect
-
Validating the changes
You can verify that logs are arriving to the logstore using the following command:
/opt/syslog-ng/bin/logcat /var/log/messages.lgs