The first aim was to develop the basis of the plugin, write makefiles and compile it. For this purpose the afsmtp plugin was a good take-off. I wrote the initialization functions, that called by syslog-ng on startup to load the destination. This way I managed to write a test message in redis.
My mentor, Viktor wrote me a tiny test program in python to check the exist of a predetermined key.
It starts the syslog-ng, that writes a given key in redis. The program checks the exist of this key, shutting down syslog-ng and return with a message, if the writing was successful.
tichy@nb:~/syslog-ng-3.4-install-redis$ sudo ./test.py
Pid of syslog-ng process: 29410
PING: PONG
syslog-ng starting up; version='3.4.2'
syslog-ng shutting down; version='3.4.2'
The test was successful.
Pid of syslog-ng process: 29410
PING: PONG
syslog-ng starting up; version='3.4.2'
syslog-ng shutting down; version='3.4.2'
The test was successful.
Update: I managed to write messages in redis via syslog-ng the following way: I sent a log message with logger command and I got it in redis.
Of course, I have a lot of things to do yet, choose naming method of keys properly, optimizing, etc.
Update #2: Pub/sub implemented, we can send now the log messages to channels separated by program names.
Error handling fixed, so if redis isn't up on program starting or disconnect while running, syslog-ng collects log messages, try to reconnect and resend all messages after connection restored.
Update #3: Set custom redis command added.
No comments:
Post a Comment