Skip to content

Instantly share code, notes, and snippets.

@TheStaticTurtle
Created August 26, 2021 17:01
Show Gist options
  • Save TheStaticTurtle/8835343124baa717888a5f11d052899a to your computer and use it in GitHub Desktop.
Save TheStaticTurtle/8835343124baa717888a5f11d052899a to your computer and use it in GitHub Desktop.
Rrsyslog remote logging conf
# Load Modules
module(load="imudp")
module(load="imuxsock")
# rsyslog Templates
template(name="FilePathHostnameFormat" type="string" string="/var/log/net/%hostname%/syslog.log")
template(name="FilePathIpFormat" type="string" string="/var/log/net/%fromhost-ip%/syslog.log")
template(name="RemoteFormat" type="list") {
property(name="timegenerated" dateformat="day")
constant(value="/")
property(name="timegenerated" dateformat="month")
constant(value="/")
property(name="timegenerated" dateformat="year")
constant(value=" ")
property(name="timegenerated" dateformat="hour")
constant(value=":")
property(name="timegenerated" dateformat="minute")
constant(value=":")
property(name="timegenerated" dateformat="second")
constant(value=" ")
property(name="fromhost-ip")
constant(value=" ")
property(name="hostname")
constant(value=" ")
property(name="programname")
constant(value=" ")
property(name="syslogseverity-text")
constant(value=" ")
property(name="msg" compressspace="on")
constant(value="\n")
}
# rsyslog Input Modules
input(type="imudp" port="" ruleset="Remote")
# rsyslog RuleSets
ruleset(name="Remote") {
action(type="omfile" dynaFile="FilePathHostnameFormat" template="RemoteFormat")
#action(type="omfile" dynaFile="FilePathIpFormat" template="RemoteFormat")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment