InternalsThere are three basic parts of daemon: UDP listener, message processor and message writer. All these parts run in separate threads: the listener receives messages as fast as possible and passes them to the message processor, the message processor performs time-consuming tasks and message writer performs asynchronous output to files. Datagrams are received by the UDP listener. The listener emits raw messages (struct raw_message) which contain content of datagram, sender address and reference to a source described in configuration file. Raw messages are passed to the main processing thread via queue. Message processing involves the following tasks:
Because destination file name may be a pattern, further multiplexing is performed. Messages with similar HOSTNAME, TAG and CONTENT are coalesced. Log rotation is initiated at process startup or at writing thread startup. Old log files are deleted by the purger which is launched at process startup or by the writing thread after file is closed. mark message +-------------------------------------------------+ | | | +----------------+ +-----+ message +--------------+ +--->|internal sources|--->|queue|-------->| - - - - - | | (log_internal) | +-----+ | \ | +----------------+ | main loop \ | | \| message +------------+ raw message +-----+ | +------+ /|---------> |UDP listener|------------>|queue|-------->|-|parser|- - | +------------+ +-----+ | +------+ | +--------------+ +-----------------+ +------+ +-----------+ +-----------+ --->|charset converter|--->|filter|--->|multiplexer|-+->|destination|+ +-----------------+ +------+ +-----------+ +->+-----------+|+ ^ +-> +-----------+| | +-----------+ +-------+ |logpath|+ +-------+|+ +-------+| +-------+ file +-----------+ +-----+ +--------------+ destination: >--|multiplexer|-+->|queue|+ ---> |writing thread|+ +-----------+ +->+-----+|+ ---> +--------------+|+ ^ +-> +-----+| ---> +--------------+| | +-----+ +--------------+ +----------------+ |filename pattern| +----------------+ relay +--------+ destination: >--|sendto()| +--------+
| |