Last active
August 29, 2015 14:27
-
-
Save ihrwein/0a3e7c82a486174f7845 to your computer and use it in GitHub Desktop.
Syslog-ng with Python tf functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm the function: host=localhost 1st arg=first_arg 2nd arg=second_arg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@version: 3.7 | |
@include "scl.conf" | |
python { | |
def fn_name(logmsg, arg1, arg2): | |
host = getattr(logmsg, "HOST") | |
return "I'm the function: host={} 1st arg={} 2nd arg={}\n".format(host, arg1, arg2) | |
}; | |
source s_local { | |
internal(); | |
network( | |
ip( | |
0.0.0.0 | |
), | |
port( | |
1514 | |
), | |
transport("tcp") | |
); | |
}; | |
destination d_local { | |
file("/tmp/messages" template("$(python fn_name first_arg second_arg)")); | |
}; | |
log { | |
source(s_local); | |
destination(d_local); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment