The purpose of this knowledge article is to explain how to generate log messages.
Log can messages can facilitate troubleshooting, configuration testing, and a variety of other use-cases.
Syslog-ng Premium Edition and Syslog-ng Store Box (SSB) is distributed with a tool called loggen. It can be found at SYSLOG-NG_INSTALL_DIR/bin, that is /opt/syslog-ng/bin/loggen by default.
The loggen application is a tool to test and stress-test your syslog server and the connection to the server. It can send syslog messages to the server at a specified rate, using a number of connection types and protocols, including TCP, UDP, and unix domain sockets. The messages can be generated automatically (repeating the PADD string over and over), or read from a file or the standard input.
Example message generated by loggen:
Dec 4 12:13:04 syslog-ng prg00000[1234]: seq: 0000000000, thread: 0000, runid: 1543921984, stamp: 2018-12-04T12:13:04 PADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPAD
When loggen finishes sending the messages it displays the following statistics:
The following section will show some example use-cases. For more options and details see section "Additional information".
Note that all options have a short and a long name. For better understanding longer names will be used.
loggen 10.10.10.10 514
average rate = 1028.94 msg/sec, count=10291, time=10.001, (average) msg size=256, bandwidth=257.09 kB/sec
If running loggen only with the destination host and port the defaults are the following.
loggen --syslog-proto 10.10.10.10 601
loggen --unix --stream /opt/syslog-ng/var/run/syslog-ng.sock
loggen --dgram 10.10.10.10 514
loggen --rate 2000 --size 4096 10.10.10.10 514
loggen --interval 100 --number 20000 10.10.10.10 514
loggen --syslog-proto --number 1 --sdata '[example@0 class="high"]' 10.10.10.10 601
loggen --use-ssl 10.10.10.10 601
loggen --read-file /path/to/log 10.10.10.10 514
echo "`date '+%b %e %H:%M:%S'` $HOSTNAME loggen test message" | /opt/syslog-ng/bin/loggen 10.10.10.10 514 --read-file -
HEADER="1 `date -Iseconds` $HOSTNAME loggen - - -" MSG="test message" MESSAGE="$HEADER $MSG" MSGLENGTH=`echo $MESSAGE | wc -c` echo "$MSGLENGTH $MESSAGE" | /opt/syslog-ng/bin/loggen 10.21.10.10 1000 -P -d -R -
HEADER="1 `date -Iseconds` $HOSTNAME loggen - - -" MSG="test message" BOM=`printf '\xEF\xBB\xBF'` MESSAGE="$HEADER $BOM $MSG" MSGLENGTH=`echo $MESSAGE | wc -c` echo "$MSGLENGTH $MESSAGE" | /opt/syslog-ng/bin/loggen 10.21.10.10 1000 -P -d -R -
loggen --read-file /path/to/log --dont-parse 10.10.10.10 514
loggen --permanent 10.10.10.10 514
Check the administration guide of syslog-ng for available options and more detailed description of loggen.
Syslog formats: https://support.oneidentity.com/syslog-ng-premium-edition/kb/264126
© 2024 One Identity LLC. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center