Splunk Search

How to forward separate keys and values from a Splunk forwarder?

Markus
Engager
I use a PowerShell script in a Splunk forwarder that sends data with
Write-Output $line
Splunk receives this data in the _raw field.
 
How shall a PowerShell script write key-value pairs, so that for Splunk there are separate keys and values instead of _raw?
Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Anything written by a script to stdout is indexed as a raw event by Splunk.  You can use props.conf settings to extract fields from the event.  By default, Splunk will extract key and values that are in key=value format, so perhaps your PS script could do that.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

Markus
Engager

I go with the default indexing of raw.

However, I had to change my output from key1=value1,key2=value2,key3=value3 (no space after comma) into key1=value1, key2=value2, key3=value3 (space after comma)

richgalloway
SplunkTrust
SplunkTrust

Anything written by a script to stdout is indexed as a raw event by Splunk.  You can use props.conf settings to extract fields from the event.  By default, Splunk will extract key and values that are in key=value format, so perhaps your PS script could do that.

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...