I have coded a single program in spark to receive data from a local socket and capture lines that has the "Error" in them. I write manually in terminal:
$ nc -lk 9999
Error: some error message
Warning: some warning message
and so on. I need the socket get the system log information automatically. What ever log file in the system that contains Error messages or Warning ones and then my program can extract Error ones from the socket.
You said you use
rsyslogd
. Then put a file (e.g.my-forward.conf
) with the following content into/etc/rsyslog.d/
:and restart the syslog daemon:
This will forward the syslog messages for all facilities with severity warning and worse via TCP to 127.0.0.1:9999.