Splunk Search

eval field is not working in where condition

shraddha09
Observer
 
Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @shraddha09 ,

as also @livehybrid and @richgalloway said, it's really difficoult to help you without any information.

The only additional information that I can add is that you cannot use an eval condition in a where command: you must use the eval command and then in a different row the where condition.

Ciao.

Giuseppe

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @shraddha09 

I'm not really sure I understand what you're looking for, however generally eval should be done BEFORE you run your where statement.

Please could you share the SPL which is not working as expected so we can help further?

🌟 Did this answer help you? If so, please consider:

  • Adding kudos to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

0 Karma

shraddha09
Observer

Here is my SPL query,

 

index=wf_eit_ecio) | eval lstUlid=max('Properties.Gems.DataSyncsExecutionContext.dataSyncProvidersExecutionGroupULID') |  where 'Properties.Gems.DataSyncsExecutionContext.dataSyncProvidersExecutionGroupULID' = lstUlid | chart count(Properties.Gems.DataSyncExecutionContext.DataSyncProviderName) as TotalApiCallsCount Over Properties.Gems.DataSyncExecutionContext.DataSyncProviderName

lstUlid field is generated but its not working in where condition and not filtering the records

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| streamstats max('Properties.Gems.DataSyncsExecutionContext.dataSyncProvidersExecutionGroupULID') as lstUlid
|  where 'Properties.Gems.DataSyncsExecutionContext.dataSyncProvidersExecutionGroupULID' = lstUlid
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @shraddha09 ,

you cannot use max in the eval command, max can be used only in stats or similar streaming commands.

try something like this:

index=wf_eit_ecio) 
| rename
     'Properties.Gems.DataSyncsExecutionContext.dataSyncProvidersExecutionGroupULID' AS GroupULID
     'Properties.Gems.DataSyncExecutionContext.DataSyncProviderName' AS ProviderName
|  where GroupULID = lstUlid 
| stats max(GroupULID) AS max BY ProviderName
| chart count(max) as TotalApiCallsCount BY ProviderName

I supposed that lstUlid is a threshold.

another thing, don't bring these so long field names, rename them after the main search.

Ciao.

Giuseppe

0 Karma

shraddha09
Observer

rename fields are not showing with | table command

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

We need more information.

---
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.
Get Updates on the Splunk Community!

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, ...

Data Persistence in the OpenTelemetry Collector

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

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 ...