[syslog-ng] Use receiving file name / path as a macro on the server
algernon at madhouse-project.org
Tue Mar 3 13:41:33 CET 2015
>>>>> "Thanuje" == Thanuje Ashwin Nallaperuma <thanuje88 at gmail.com> writes:
Thanuje> I have multiple files with the same content on the syslog-ng client
Thanuje> These files are stored on different locations with the same file name and
Thanuje> same content
Thanuje> After receiving I want to store these files with different names on
Thanuje> sysog-ng server
Thanuje> Is there any way I could use the filepath or filename of the receiving file
Thanuje> as a macro
Thanuje> or any way to achieve this..?
When sending the message, the $FILE_NAME macro contains the path of the
file. You can add it to the template on the sending end, and extract it
on the receiving end, and use that as you will.
The easiest way to accomplish this is either $(format-json) (and
json-parser() on the other end), or using RFC 5424 syslog(), and setting
SDATA.filename (or somesuch) to $FILE_NAME in a rewrite rule. That way,
it will be automatically available on the receiving end, and you can
transform them in whatever way you prefer.
More information about the syslog-ng