Skip to content

Instantly share code, notes, and snippets.

@taotetek
Created June 18, 2015 18:19
Show Gist options
  • Select an option

  • Save taotetek/7a26d5eec830dd942b75 to your computer and use it in GitHub Desktop.

Select an option

Save taotetek/7a26d5eec830dd942b75 to your computer and use it in GitHub Desktop.
proof of concept for dynamic template output on actions
module (
load="imtcp"
)
input(type="imtcp" port="514" ruleset="test_dynamic")
template(name="had_cee" type="list") {
constant(value="CEE WOOT WOOT: ")
property(name="msg")
}
template(name="no_cee" type="list") {
constant(value="NO CEE SADFACE: ")
property(name="msg")
}
template(name="manual" type="list") {
property(name="$.custom")
constant(value="\n")
}
ruleset(name="test_dynamic") {
if $msg contains 'cee:' then {
set $.custom = exec_template("had_cee");
} else {
set $.custom = exec_template("no_cee");
}
action(
name="dynamic_template_to_file"
type="omfile"
file="/var/log/testdynamic.log"
template="manual"
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment