Splunk Search

Dealing with spaces in fields

kjonzeatgmaildo
New Member

I am sending events into Splunk using a tool that has a notification engine. The notification engine only allows me to set a value which then extracts the message attribute for forwarding.

For instance I set the value "$reason" and what gets sent for that value can be one or many words. When the value sent is more than one word, Splunk will only parse the first word. Hence if the field in the syslog message is "event_id=Added registered device for user: jdoe", splunk will show it as "event_id Added". How do I get Splunk to read in the entire message knowing that I can't do anything to adjust the way the source sends it?

0 Karma

Ayn
Legend

I usually define my own key/value extraction for this. As long as there's a good way of specifying what the key and what the value is this works fine. Something like this:

[my_kv_extract]
REGEX = ([^=]+)="([^"]+)
FORMAT = $1::$2
0 Karma

grijhwani
Motivator

Can you rewrite your message templates to include quotation marks enclosing the token substitutions? For example:

name="Registration Event" event_id="$message" vendor="Extreme Networks" product="NAC" RegistrationType="$type" RegistrationTime="$time" RegistrationMessage="$message" RegistrationSource="$source"
0 Karma

somesoni2
Revered Legend

Will it be possible for you to change the field delimiter from space to comma?

0 Karma

kjonzeatgmaildo
New Member

That was my first thought as well. I tried it and it had no effect what-so-ever. I doesn't seem as if I can do aything about how the events are sent; I need to do something on the Splunk side to make it understand that "$message" can be multiple words with spaces. Is this possible?

0 Karma

kjonzeatgmaildo
New Member

There are actually many fields all of which are separated by spaces. Actually here's what one looks like

name="Registration Event" event_id=$message vendor="Extreme Networks" product=NAC RegistrationType=$type RegistrationTime=$time RegistrationMessage=$message RegistrationSource=$source

If the answer from any of these attributes is more than one word, Splunk ignores it even though it's in the raw message that Splunk receives.

0 Karma

somesoni2
Revered Legend

do your generated log file have only one field or multiple? If multiple fields, how are multiple filed separated?

0 Karma
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!

Laser Bananas and Edge Hubs: Exploring Operational Technology (OT) Data Through a ...

  OT is a different environment to traditional IT and can have interesting challenges when interfacing the ...

Event Series: Mastering AI Tokenomics and Splunk Agent Observability

Beyond the Black Box: Correlating AI Performance and Tokenomics with Splunk Agent Observability   As ...

span_metrics: The OpenTelemetry-Idiomatic Way to See Inside Your Services

You open a trace in Splunk Observability Cloud and everything looks fine. One root span, order-pipeline, with ...