Splunk Search

How to display the 1st 10 lines in events

jackueline14
New Member

Hi,

I have Error logs which is having more than 50 lines but requirement is to be displayed for 1st 10 lines instead more than 50 and there is no common statement in each events to write it in the regex. So, Kindly help.

Labels (1)
Tags (1)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

If your _raw string has multi line events, then this rex statement will create a new field with the first 10 lines into a new field called display

| rex "(?<didplay>((?m)^.*$\n){10})"
0 Karma
Get Updates on the Splunk Community!

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...