Splunk Dev

Newline in events

arpit_arora
Explorer

Hello, I have Splunk events (stacktrace) which have '\n' in them. I want these '\n' to appear as new lines (but not new event).

So for example, currently my event might look like

aaaaa \n bbbbb \n ccccc \n ddddd

I want this event to appear as follows.

aaaaa
bbbbb
ccccc
ddddd

I know we can use rex command for this at search time, but I want the events to be indexed with \n character stored as newline.

How can I do this at index time?

Tags (1)
0 Karma

woodcock
Esteemed Legend

This is generally done in props.conf on your indexers by setting SHOULD_LINEMERGE = false (yes, I know that might seem wrong) and LINE_BREAKER to a very carefully constructed RegEx that determines where to break them apart, for your sourcetype.

0 Karma

somesoni2
Revered Legend

Assuming when you say your can do the same at search time using rex mode=sed option, you can do the same at index-time using SEDCMD option in the props.conf. See this for more details:
https://docs.splunk.com/Documentation/Splunk/7.0.3/Data/Anonymizedata

0 Karma

niketn
Legend

@arpit_arora, try to take your rex to fields.conf for configuring multi-value fields using TOKENIZER: http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ConfigureSplunktoparsemulti-valuefields

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...