Splunk Search

I want to create a subsearch that will abbreviate all but the first 30 characters of the result.

NanSplk01
Communicator
index=replicate category=* action=* Message=*
  [search index=replicate
   | eval Msg=substr(Message,1,30)]
| stats count by action category Msg

| dedup action

 

This is what I'm trying to do.  The Message field is very large and I only need the first sentence of the Message.  How can I do this?  We want it in a sub-search to show the sub-search function for our users.

This is Splunk Cloud implementation.

Labels (2)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @NanSplk01 ,

why do you want to use the subsearch?

if I correctly understand you need only to truncate the Message field to the first 3 chars, is it correct?

index=replicate category=* action=* Message=*
| eval Msg=substr(Message,1,30)
| stats 
     values(category) AS category 
     values(Msg) AS Msg 
     BY action 

Ciao.

Giuseppe

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Recall that subsearches run first and replace themselves with their results.  That means the search is looking only for Msg field (which may not exist in the index) values of 30 characters or fewer (longer values are missed without a wildcard).

Perhaps you only need to truncate the Message for display purposes.  If so, drop the subsearch and run the eval as a separate command.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...