Splunk Search

How to use token with a field created with "eval"?

Goldenfit
Explorer

So i am trying to link this to a token from another panel but since "message_id" is a created field, it doesn't work. Is there anyway I can make this work?

 

<index> <host>
| eval message_id=AREA.SUBID
| stats count by USER, TEXT
| search message_id="$messid1$"
| sort - count

 

Labels (2)
Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Goldenfit ,

after a stats command, you have only the fields in the stats command, in your case: count, USER and TEXT.

So you cannot have message_id for searching after the stats command.

You have to put the search command before the stats or add the message_id field to the stats.

Ciao.

Giuseppe

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It's not that message_id is a "created field".

You may need to set a token to $results.message_id$ as part of the <done> element of your query, but you have a bigger problem:  the message_id field doesn't exist.

The stats command transforms the results so the only fields passed to the rest of the query are 'count', 'USER', and 'TEXT'.  There is no message_id field to search for or to use in another panel.

---
If this reply helps you, Karma would be appreciated.
0 Karma

Taruchit
Contributor

Hi @Goldenfit,

Can you please share the code used for defining your token?

Thank you 

0 Karma

Goldenfit
Explorer

So basically i have another panel 

Goldenfit_0-1684329030742.png

Goldenfit_1-1684329066278.png

my goal is that when I click on one of the message_id displayed in the chart above, my first query in the original post udates it to display TEXT and USER with this particular message_id

 

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!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...