Getting Data In

Discard event after 10 lines

anantdeshpande
Path Finder

Hi,
I have many events of 500 lines. Only first 10 lines are important. How to truncate or discard or ignore the remaining lines before indexing?
When I use MAX_EVENTS in props.conf, Splunk breaks event after 10 lines and creats new event. Tried using BREAK_ONLY_BEFORE, LINEBREAK but nothing seems working.

Please suggest props.conf entry to index only 10 lines from event.

Tags (1)
0 Karma

inventsekar
SplunkTrust
SplunkTrust

Check this one -

In inputs.conf
[monitor:///app/tmp/testfile]
sourcetype = testSourceType
index = main
disabled = 0
whitelist = .log$

In props.conf
[testSourceType]
TRANSFORMS-shortenEvents = keepOnly10Lines

In transforms.conf
[keepOnly10Lines]
REGEX = (?m)^((.*\n){10})((.*\n)*)
FORMAT = $1
DEST_KEY = _raw

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !

anantdeshpande
Path Finder

Hi,
Thanks for the reply.
I am indexing file from Web UI. I created props.conf and transforms.conf in default directory as mentioned.
Restarted Splunk. Then, when I select sourcetype as" testSourceType", I see transforms name in Advance but the right hand side prieview still shows large events and not discarding lines after 10.

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!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...