Splunk Search

How to apply this filter condition to my search result?

srohith87
New Member

Hi team,

I am new to Splunk. Please guide me how to apply a filter condition in which I need to extract only count =1.

Below is my search:

index="victindex" sourcetype="ContainerEvents" | rex field=_raw "^(?:[^\.\n]*\.){2}(?P\w+)" | search qceventtype=ContainerEvent | xmlkv |  stats count as "Count of Search Object" by _time | where count = 1

Above search is not giving me any result set, even though I have 27 events.

0 Karma

woodcock
Esteemed Legend

You are doing where by a field name ( count ) that does not exist. Try this:

index="victindex" sourcetype="ContainerEvents" | rex field=_raw "^(?:[^\.\n]*\.){2}(?P\w+)"
| search qceventtype=ContainerEvent | xmlkv
| stats count BY _time | where count = 1
| rename count AS "Count of Search Object"
0 Karma

jkat54
SplunkTrust
SplunkTrust

Here the count is the count of events. So if you have 27 events, count does not equal to 1 and your where clause is excluding the results.

Can you provide a sample of the data?

0 Karma

sundareshr
Legend

Try

....  | stats count by _time | where count = 1 | rename count as "Count of Search Object"

srohith87
New Member

Thank you sundar, It works...
can you tell me how difference it is filtering the aggregated group value such as "having max(salary) > 25000", how can I apply this in the search command

Hi JKAT54,

yes, the count I represented is total events. To the top of it I will be applying the count of specific column to eventually evaluate the total by its.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...