$IncludeConfig diag-common.conf

dyn_stats(name="stats_one")
dyn_stats(name="stats_two")

ruleset(name="stats") {
  action(type="omfile" file="./rsyslog.out.stats.log")
}

module(load="../plugins/impstats/.libs/impstats" interval="2" severity="7" resetCounters="on" Ruleset="stats" bracketing="on" format="json")

template(name="outfmt" type="string" string="%msg%\n")

set $.p = field($msg, 32, 1);
if ($.p == "foo") then {
  set $.ign = dyn_inc("stats_one", $.p);
  set $.ign = dyn_inc("stats_two", $.p);
}

action(type="omfile" file="./rsyslog.out.log" template="outfmt")