-
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.
Merge pull request #446 from splunk/feature/optional-indexed-fields
Fixes #273 make indexed fields optional
- Loading branch information
Showing
6 changed files
with
47 additions
and
24 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 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,42 @@ | ||
| #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_INDEXED_FIELDS" "facility,severity,container,loghost,dport,fromhostip,proto") ",") has "facility" }} | ||
| set($FACILITY, value("fields.sc4s_syslog_facility")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEXED_FIELDS" "facility,severity,container,loghost,dport,fromhostip,proto") ",") has "severity" }} | ||
| set($LEVEL, value("fields.sc4s_syslog_severity")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEXED_FIELDS" "facility,severity,container,loghost,dport,fromhostip,proto") ",") has "loghost" }} | ||
| {{- if (getenv "SC4S_CONTAINER_HOST") }} | ||
| set("{{ getenv "SC4S_CONTAINER_HOST" }}", value("fields.sc4s_loghost")); | ||
| {{- end}} | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEXED_FIELDS" "facility,severity,container,loghost,dport,fromhostip,proto") ",") has "container" }} | ||
| set($LOGHOST, value("fields.sc4s_container")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEXED_FIELDS" "facility,severity,container,loghost,dport,fromhostip,proto") ",") has "fromhostip" }} | ||
| set($SOURCEIP, value("fields.sc4s_fromhostip")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEXED_FIELDS" "facility,severity,container,loghost,destport,fromhostip,proto") ",") has "destport" }} | ||
| set($DESTPORT, value("fields.sc4s_destport")); | ||
| {{- end}} | ||
| {{- if (split (getenv "SC4S_DEST_SPLUNK_INDEXED_FIELDS" "facility,severity,container,loghost,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")); | ||
| }; | ||
|
|
||
|
|
||
|
|