Python – code to emit syslog message.

Reading Time: < 1 minute

Last Updated: 5/14/2024

This article will discuss a quick and dirty method used for creating syslog events. This is handy for testing syslog logging. It should be noted that this is just one method. There are a number of tools for this including Windows tools for testing.

I got cheap and put the code on github. I have credited the original author. The code is configured to use the “LAB” Syslog server configured in a separate post.

git clone https://github.com/tlh45342/syslogger.git
root@ubuntu2:~/syslogger# python syslogger.py
host: 192.168.160.18
root@syslog:/var/log# tail --lines 1 syslog
Apr  4 18:38:01 Hi

Reminder: that a log message can be easily created with “logger”

logger -T -P 514 -n 192.168.160.18 "B@TTERup"
This entry was posted in Logging, Programming, Python. Bookmark the permalink.