Skip to content

Commit

Permalink
refactor: Convert inline null-queue to postfilter (#1410)
Browse files Browse the repository at this point in the history
Finish refactor so that all "null_queue" tasks are managed in post filter
  • Loading branch information
Ryan Faircloth authored Jan 30, 2022
1 parent b154557 commit c9a156f
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 99 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
block parser app-postfilter-checkpoint_splunk_01-partials() {
channel {
rewrite {
r_set_splunk_dest_update(
vendor_product('null_queue')
);
};
};
};

application app-postfilter-checkpoint_splunk_01-partials[sc4s-postfilter] {
filter {
"fields.sc4s_vendor_product" eq "checkpoint_splunk"
and "`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_INCOMPLETE_EVENTS`" eq "yes"
and "${.values.loguid}" ne ""
and "${.values.bytes}" eq ""
and ( "${.values.product}" eq "Application Control" or "${.values.product}" eq "Firewall" or "${.values.product}" eq "URL Filtering")
and ( "${.values.rule_action}" eq "Accept" or "${.values.rule_action}" eq "Inline")
;
};
parser { app-postfilter-checkpoint_splunk_01-partials(); };
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
block parser app-postfilter-checkpoint_splunk_02-group() {
channel {
parser {
grouping-by(
key("${.values.loguid}")
#This looks silly but we have no way of knowing if an event is complete so
#We must make an impossible condition and rely on time out
trigger("1" == "2")
aggregate(
value(".gb.complete" "1")
inherit-mode(last-message)
)
timeout(`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL_SECONDS`)
);
};
rewrite {
r_set_splunk_dest_update(
vendor_product('null_queue')
condition("${.gb.complete}" ne "1")
);
};
};
};

application app-postfilter-checkpoint_splunk_02-group[sc4s-postfilter] {
filter {
"fields.sc4s_vendor_product" eq "checkpoint_splunk"
and "`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL`" eq "yes"
and "${.values.loguid}" ne ""
};
parser { app-postfilter-checkpoint_splunk_02-group(); };
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
block parser app-postfilter-checkpoint_syslog_01-partials() {
channel {
rewrite {
r_set_splunk_dest_update(
vendor_product('null_queue')
);
};
};
};

application app-postfilter-checkpoint_syslog_01-partials[sc4s-postfilter] {
filter {
program('CheckPoint')
and "`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_INCOMPLETE_EVENTS`" eq "yes"
and ("${[email protected]}" ne ""
and "${[email protected]}" eq ""
and ( "${[email protected]}" eq "Application Control" or "${[email protected]}" eq "Firewall" or "${[email protected]}" eq "URL Filtering")
and ( "${[email protected]_action}" eq "Accept" or "${[email protected]_action}" eq "Inline")
);
};
parser { app-postfilter-checkpoint_syslog_01-partials(); };
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
block parser app-postfilter-checkpoint_syslog_02-group() {
channel {

parser {
grouping-by(
key("${[email protected]}")
#This looks silly but we have no way of knowing if an event is complete so
#We must make an impossible condition and rely on time out
trigger("1" == "2")
aggregate(
value(".gb.complete" "1")
inherit-mode(last-message)
)
timeout(`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL_SECONDS`)
);
};

rewrite {
r_set_splunk_dest_update(
vendor_product('null_queue')
condition("${.gb.complete}" ne "1")
);
};
};
};
application app-postfilter-checkpoint_syslog_02-group[sc4s-postfilter] {
filter {
program('CheckPoint')
and "`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL`" eq "yes"
and "${[email protected]}" ne "";
};
parser { app-postfilter-checkpoint_syslog_02-group(); };
};
46 changes: 1 addition & 45 deletions package/etc/conf.d/conflib/raw/app-raw-checkpoint_splunk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,7 @@ block parser app-raw-checkpoint_splunk() {
kv-parser(prefix(".values.") pair-separator("|") template(t_hdr_msg));

};
if (
"`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_INCOMPLETE_EVENTS`" eq "yes"
and "${.values.loguid}" ne ""
and "${.values.bytes}" eq ""
and ( "${.values.product}" eq "Application Control" or "${.values.product}" eq "Firewall" or "${.values.product}" eq "URL Filtering")
and ( "${.values.rule_action}" eq "Accept" or "${.values.rule_action}" eq "Inline")
){
rewrite {
r_set_splunk_dest_update(
vendor_product('null_queue')
);
};
} elif {
if {
filter {
"`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL`" eq "yes"
and "${.values.loguid}" ne ""
};
parser {
grouping-by(
key("${.values.loguid}")
#This looks silly but we have no way of knowing if an event is complete so
#We must make an impossible condition and rely on time out
trigger("1" == "2")
aggregate(
value(".gb.complete" "1")
inherit-mode(last-message)
)
timeout(`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL_SECONDS`)
);
};
} else {
rewrite {
set("1", value(".gb.complete"));
};
};
if {

parser {
date-parser-nofilter(format("%s") template("${.values.time}"));
Expand Down Expand Up @@ -342,16 +307,7 @@ block parser app-raw-checkpoint_splunk() {
);
};
};
rewrite {
r_set_splunk_dest_update(
vendor_product('null_queue')
condition("${.gb.complete}" ne "1")
);
};
};



};

};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,6 @@
block parser app-syslog-checkpoint_syslog() {
channel {

if (
"`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_INCOMPLETE_EVENTS`" eq "yes"
and "${[email protected]}" ne ""
and "${[email protected]}" eq ""
and ( "${[email protected]}" eq "Application Control" or "${[email protected]}" eq "Firewall" or "${[email protected]}" eq "URL Filtering")
and ( "${[email protected]_action}" eq "Accept" or "${[email protected]_action}" eq "Inline")
){
rewrite {
r_set_splunk_dest_update(
vendor_product('null_queue')
);
};
} elif {
filter {
"`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL`" eq "yes"
and "${[email protected]}" ne ""
};
parser {
grouping-by(
key("${[email protected]}")
#This looks silly but we have no way of knowing if an event is complete so
#We must make an impossible condition and rely on time out
trigger("1" == "2")
aggregate(
value(".gb.complete" "1")
inherit-mode(last-message)
)
timeout(`SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL_SECONDS`)
);
};
} else {
rewrite {
set("1", value(".gb.complete"));
};
};
channel {

parser {
date-parser-nofilter(format("%s") template("${[email protected]}"));
};
Expand Down Expand Up @@ -335,15 +300,6 @@ block parser app-syslog-checkpoint_syslog() {
);
};
};


rewrite {
r_set_splunk_dest_update(
vendor_product('null_queue')
condition("${.gb.complete}" ne "1")
);
};

};

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ filter f_test_test {
host("testvp-*" type(glob))
#or netmask(xxx.xxx.xxx.xxx/xx)
};
filter f_null_queue {
netmask(169.254.100.0/24)
#or host('nullme')
#or message('nullmealso')
};


filter f_aruba_clearpass {
host("aruba-cp-*" type(glob))
#or netmask(xxx.xxx.xxx.xxx/xx)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
f_aruba_clearpass,sc4s_vendor_product,"aruba_clearpass"
f_test_test,sc4s_vendor_product,"test_test"
f_brocade_syslog,sc4s_vendor_product,"brocade_syslog"
f_null_queue,sc4s_vendor_product,"null_queue"
f_cisco_meraki,sc4s_vendor_product,"cisco_meraki"
f_cisco_wsa,sc4s_vendor_product,"cisco_wsa"
f_cisco_wsa11_7,sc4s_vendor_product,"cisco_wsa11_7"
Expand Down

0 comments on commit c9a156f

Please sign in to comment.