-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #273 make indexed fields optional
The fields sc4s_syslog_product and sc4s_syslog_format are not made optional in this change as the current use is intergral to the logic tree a future change could change the internal field name and conditional include the field in the json payload. This change also adds new optional indexed fields for dest port when and container host.
- Loading branch information
rfaircloth-splunk
committed
May 8, 2020
1 parent
f3c37f4
commit 7585981
Showing
5 changed files
with
45 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #Used to set indexed fields we will always use to global defaults | ||
| rewrite r_set_splunk_default { | ||
| set("SC4S:$SOURCE", value(".splunk.source")); | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEX_FIELDS" "container,log_host,dport,fromhostip,proto") ",") has "facility" }} | ||
| set($FACILITY, value("fields.sc4s_syslog_facility")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEX_FIELDS" "container,log_host,dport,fromhostip,proto") ",") has "severity" }} | ||
| set($LEVEL, value("fields.sc4s_syslog_severity")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEX_FIELDS" "container,log_host,dport,fromhostip,proto") ",") has "log_host" }} | ||
| {{- if (getenv "SC4S_CONTAINER_HOST") }} | ||
| set("{{ getenv "SC4S_CONTAINER_HOST" }}", value("fields.sc4s_log_host")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEX_FIELDS" "container,log_host,dport,fromhostip,proto") ",") has "container" }} | ||
| set($LOGHOST, value("fields.sc4s_container")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEX_FIELDS" "container,log_host,dport,fromhostip,proto") ",") has "fromhostip" }} | ||
| set($SOURCEIP, value("fields.sc4s_fromhostip")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEX_FIELDS" "container,log_host,destport,fromhostip,proto") ",") has "destport" }} | ||
| set($DESTPORT, value("fields.sc4s_destport")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEX_FIELDS" "container,log_host,destport,fromhostip,proto") ",") has "proto" }} | ||
| set($PROTO, value("fields.sc4s_proto")); | ||
| {{- end}} | ||
| }; | ||
| #used by each log-path to set index and sourcetype which may be | ||
| #overridden by user defined values | ||
| block rewrite r_set_splunk_dest_default( | ||
| index() | ||
| source("${.splunk.source}") | ||
| sourcetype() | ||
| template(`splunk-template`) | ||
| ) { | ||
| set("`index`", value(".splunk.index")); | ||
| set("`source`", value(".splunk.source")); | ||
| set("`sourcetype`", value(".splunk.sourcetype")); | ||
| }; | ||
|
|
||
|
|
||
|
|