Skip to content

Commit

Permalink
Merge pull request #429 from splunk/feature/rfc5687
Browse files Browse the repository at this point in the history
Alpha Support for this RFC5687
  • Loading branch information
Ryan Faircloth authored and GitHub committed May 4, 2020
2 parents 60815c1 + 50ee939 commit 1a06a81
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions package/etc/conf.d/conflib/_common/templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ template t_JSON_5424 {
--exclude DATE
--exclude FACILITY
--exclude PRIORITY
--exclude HOST
)');
};

Expand Down
38 changes: 38 additions & 0 deletions package/etc/conf.d/log_paths/lp-bbb-ietf_syslog.conf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# IETF Syslog

log {
junction {
channel {
# Listen on the default port (typically 601) for IETF_SYSLOG traffic
source (s_ietf);
flags(final);
};
};

rewrite {
set("IETF_SYSLOG", value("fields.sc4s_vendor_product"));
};

rewrite { r_set_splunk_dest_default(sourcetype("ietf:syslog"), index("main"), source("${APP}:${PROGRAM}")) };
parser { p_add_context_splunk(key("IETF_SYSLOG")); };
parser (compliance_meta_by_source);
rewrite { set("$(template ${.splunk.sc4s_template} $(template t_JSON_5424))" value("MSG")); };

{{- if or (conv.ToBool (getenv "SC4S_DEST_SPLUNK_HEC_GLOBAL" "yes")) (conv.ToBool (getenv "SC4S_DEST_IETF_SYSLOG_HEC" "no")) }}
destination(d_hec);
{{- end}}

{{- if or (conv.ToBool (getenv "SC4S_ARCHIVE_GLOBAL" "no")) (conv.ToBool (getenv "SC4S_ARCHIVE_IETF_SYSLOG" "no")) }}
destination(d_archive);
{{- end}}

{{- if (print (getenv "SC4S_DEST_GLOBAL_ALTERNATES")) }}
{{ getenv "SC4S_DEST_GLOBAL_ALTERNATES" | regexp.ReplaceLiteral "^" "destination(" | regexp.ReplaceLiteral "[, ]+" ");\n destination(" }});
{{- end }}

{{- if (print (getenv "SC4S_DEST_IETF_SYSLOG_ALTERNATES")) }}
{{ getenv "SC4S_DEST_IETF_SYSLOG_ALTERNATES" | regexp.ReplaceLiteral "^" "destination(" | regexp.ReplaceLiteral "[, ]+" ");\n destination(" }});
{{- end }}

flags(flow-control,final);
};
1 change: 1 addition & 0 deletions package/etc/conf.d/log_paths/lp-zzz-fallback.conf.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Fallback for un-parsed sources

log {
source(s_ietf);
source(s_DEFAULT);

rewrite { set("SC4S_fallback", value("fields.sc4s_vendor_product")); };
Expand Down
25 changes: 25 additions & 0 deletions package/etc/conf.d/sources/rfc5687.conf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
source s_ietf {
channel {
source {
syslog (
transport("tcp")
port(601)
ip-protocol(4)
keep-hostname(yes)
keep-timestamp(yes)
use-dns(no)
use-fqdn(no)
chain-hostnames(off)
flags(validate-utf8, syslog-protocol)
);
};

if {
parser { app-parser(topic(syslog)); };
};
rewrite(set_rfc5424_strict);
parser {
vendor_product_by_source();
};
};
};

0 comments on commit 1a06a81

Please sign in to comment.