Get Live Help
NOTE: The example presented here is set in a client-relay-server scenario.
Once messages have been written to the disk-buffer file, the relay returns an acknowledgment to the client.
When the server has successfully received and processed the messages in the batch, it sends an acknowledgment of the processed messages to the relay.
It is only at this point that the relay removes log messages from the disk-buffer file because this is when logs are considered "delivered" to the server.
After receiving the acknowledgment, the sender sends another batch of messages.
This configuration gives you the greatest degree of protection against log message loss. ALTP provides acknowledgment about the successful processing of log messages at the level of the application layer. Even if the reception of log messages has been acknowledged by TCP at the transport layer, log messages are considered delivered only when the syslog-ng PE application has received an acknowledgment from the other syslog-ng PE instance about the successful delivery of log messages.
This mechanism guarantees that log messages are not lost between the client and the relay, or between the relay and the server, or on the relay itself. To minimize the risk of message loss on the client or the server, use flow control and reliable disk-buffer.
Figure 38: Flow control, reliable disk-buffer, ALTP
Set flags(flow-control) in the log path.
Configure the disk-buffer option. For details, see Example: Example configuration of the reliable disk-buffer.
disk-buffer( mem-buf-size(10485760) # storing 10 MB messages in memory and on disk disk-buf-size(2147483648) # storing 2 GB of messages only on disk reliable(yes) )
Enable ALTP by setting transport(rltp). For details, see ALTP options.
This configuration minimizes the loss of log messages in the following situations:
Message loss when syslog-ng PE is stopped or restarted: When syslog-ng is stopped or restarted, the contents of the disk-buffer file do not get lost, greatly increasing reliability.
Also note that the memory buffer is only used as a cache in this configuration. Any data stored in the memory has already been written to the disk-buffer file, which, again, results in more reliability.
NOTE: In rare cases, the buffers stored on the disk can become corrupted, in which case syslog-ng PE may not able to process all the logs stored in the disk-buffer file.
This configuration results in the slowest processing time out of all the options described in this chapter.
Choosing the ideal configuration for your environment may not always be a straightforward decision. Depending on your use case, it is worth considering which outcome is more desirable (with the following points representing the two opposite ends of the spectrum):
TIP: If your application sends its logs through a blocking I/O socket and you prefer not to slow down or stop the application when log messages are arriving in volumes greater than syslog-ng PE is able to process, then consider turning flow control off on the client side. This way, you will not be using the whole application-client-server chain at full capacity, and yet still be able to spot the loss of application log messages at the beginning of the chain already, in the internal logs of the client.
This chapter explains the methods that you can use to customize, reformat, and modify log messages using syslog-ng Premium Edition.
Customizing message format using macros and templates explains how to use templates and macros to change the format of log messages, or the names of logfiles and database tables.
Modifying messages using rewrite rules describes how to use rewrite rules to search and replace certain parts of the message content.
Regular expressions lists the different types of regular expressions that can be used in various syslog-ng PE objects like filters and rewrite rules.
The following sections describe how to customize the names of logfiles, and also how to use templates, macros, and template functions.
Formatting messages, filenames, directories, and tablenames explains how macros work.
Modifying messages using rewrite rules describes how to use macros and templates to format log messages or change the names of logfiles and database tables.
Macros of syslog-ng PE lists the different types of macros available in syslog-ng PE.
Using template functions explains what template functions are and how to use them.
Template functions of syslog-ng PE lists the template functions available in syslog-ng PE.