Splunk Search

Splunk Conditional Statement

sagartiwari
New Member

I am using below query where my A (0012ABC) Component is an alphanumeric and B is a string (ab) but its considering A as numeric only

base query |eval details = if(A>1 AND B >1,A,"Alone")|dedup details| table details

want the results as if in my result set there is a duplicate value occurrence with respect to the combination of A and B then show me that value for A(duplicate values only.

E.g.
ColumnA Coulmn B
0001AB ab
0002AB pq
0001AB ab

expected result set
details
0001AB

0 Karma

jkat54
SplunkTrust
SplunkTrust

To convert the integer to a string, use eval

| eval a=tostring(a)

https://docs.splunk.com/Documentation/Splunk/8.0.3/SearchReference/Eval

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It doesn't make sense to compare strings to integers.

To show ColumnA where there are duplicate combinations of ColumnA and ColumnB, use stats.

base query
| stats count by ColumnA ColumnB
| where count > 1
| table ColumnA
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...