Using linux environment variable in rsyslog template
i was able to use this guidance rsyslog: Specify `action` parameters from environment variables
to shell out from the config file to get the environment variables in the template:
template(name="logfile" type="list") {
constant(value="{")
constant(value="\"@timestamp\":\"")
property(name="timegenerated" dateFormat="rfc3339")
constant(value="\", ")
constant(value="\"pod_namespace\":\"")
constant(value=`echo $KUB_POD_NAMESPACE`)
constant(value="\", ")
constant(value="\"pod_name\":\"")
constant(value=`echo $KUB_POD_NAME`)
constant(value="\", ")
constant(value="\"pod_ip\":\"")
constant(value=`echo $KUB_INSTANCE_ADDR`)
constant(value="\", ")
property(name="$!all-json" position.from="2")
}