[syslog-ng] configuring a redis syslog-ng destination
Jacob Vorreuter
jacob.vorreuter at gmail.com
Fri Nov 26 22:22:17 CET 2010
I'd like to configure syslog-ng to send logs to redis via a unix socket. This would require implementing the redis protocol as a template or rewrite rule. The only trick is getting the size in bytes of the message being processed. Is there a macro for this or some other way of determining message size?
The protocol would look like this (pretending there existed a macro, MSG_SIZE):
*3 (number of arguments)
$5 (size in bytes of argument 1)
RPUSH (operation)
$4 (size in bytes of argument 2)
logs (key)
$${MSG_SIZE} (size in bytes of argument 3)
$MSG (value)
or as a string:
*3\r\n$5\r\nRPUSH\r\n$4\r\nlogs\r\n$${MSG_SIZE}\r\n$MSG\r\n
and finally as a destination with template:
destination d_redis { unix-stream("/tmp/redis.sock") template("*3\r\n$5\r\nRPUSH\r\n$4\r\nlogs\r\n$${MSG_SIZE}\r\n$MSG\r\n"); };
Does anyone have suggestions of how to accomplish this?
Thanks,
Jake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.balabit.hu/pipermail/syslog-ng/attachments/20101126/748dc674/attachment-0001.htm
More information about the syslog-ng
mailing list