Skip to content

Commit

Permalink
value-pairs: adding sdata to the syslog-proto (RFC5424) scope
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Gados <gdani@balabit.hu>
  • Loading branch information
gdani authored and algernon committed Jun 5, 2014
1 parent 2a29991 commit 226c88c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/value-pairs.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ vp_msg_nvpairs_foreach(NVHandle handle, gchar *name,
return FALSE;

inc = (name[0] == '.' && (vp->scopes & VPS_DOT_NV_PAIRS)) ||
(name[0] != '.' && (vp->scopes & VPS_NV_PAIRS)) ||
(log_msg_is_handle_sdata(handle) && (vp->scopes & VPS_SDATA));
(name[0] != '.' && (vp->scopes & VPS_NV_PAIRS)) ||
(log_msg_is_handle_sdata(handle) && (vp->scopes & (VPS_SDATA + VPS_RFC5424)));

for (j = 0; j < vp->patterns_size; j++)
{
Expand Down Expand Up @@ -308,7 +308,7 @@ value_pairs_foreach_sorted (ValuePairs *vp, VPForeachFunc func,
/*
* Build up the base set
*/
if (vp->scopes & (VPS_NV_PAIRS + VPS_DOT_NV_PAIRS + VPS_SDATA) ||
if (vp->scopes & (VPS_NV_PAIRS + VPS_DOT_NV_PAIRS + VPS_SDATA + VPS_RFC5424) ||
vp->patterns_size > 0)
nv_table_foreach(msg->payload, logmsg_registry,
(NVTableForeachFunc) vp_msg_nvpairs_foreach, args);
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/test_value_pairs.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ main(int argc, char *argv[])
parse_options.flags |= LP_SYSLOG_PROTOCOL;

testcase("rfc3164", NULL, "DATE,FACILITY,HOST,MESSAGE,PID,PRIORITY,PROGRAM", NULL);
testcase("rfc5424", NULL, "DATE,FACILITY,HOST,MESSAGE,MSGID,PID,PRIORITY,PROGRAM", NULL);
testcase("core", NULL, "DATE,FACILITY,HOST,MESSAGE,PID,PRIORITY,PROGRAM", NULL);
testcase("base", NULL, "DATE,FACILITY,HOST,MESSAGE,PID,PRIORITY,PROGRAM", NULL);

testcase("rfc5424", NULL, ".SDATA.EventData@18372.4.Data,.SDATA.Keywords@18372.4.Keyword,.SDATA.meta.sequenceId,.SDATA.meta.sysUpTime,.SDATA.origin.ip,DATE,FACILITY,HOST,MESSAGE,MSGID,PID,PRIORITY,PROGRAM", NULL);
testcase("syslog-proto", NULL, ".SDATA.EventData@18372.4.Data,.SDATA.Keywords@18372.4.Keyword,.SDATA.meta.sequenceId,.SDATA.meta.sysUpTime,.SDATA.origin.ip,DATE,FACILITY,HOST,MESSAGE,MSGID,PID,PRIORITY,PROGRAM", NULL);

testcase("selected-macros", NULL, "DATE,FACILITY,HOST,MESSAGE,PID,PRIORITY,PROGRAM,SEQNUM,SOURCEIP,TAGS", NULL);

testcase("nv-pairs", NULL, "HOST,MESSAGE,MSGID,PID,PROGRAM", NULL);
Expand Down

0 comments on commit 226c88c

Please sign in to comment.