Skip to content

Instantly share code, notes, and snippets.

@ihrwein
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ihrwein/0a3e7c82a486174f7845 to your computer and use it in GitHub Desktop.
Save ihrwein/0a3e7c82a486174f7845 to your computer and use it in GitHub Desktop.
Syslog-ng with Python tf functions
I'm the function: host=localhost 1st arg=first_arg 2nd arg=second_arg
@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