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?
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.
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...