Splunk Search

Search returning too much

a212830
Champion

Hi,

I want to query on eventtype, and my query is returning items that I don't want. My search is:

source="/var/opt/trapx/log/traps-all.log" tag::eventtype="SNMP" | fields eventtype, host |chart count by eventtype, host

The search is returning eventypes that aren't tagged with SNMP. I also tried running it with a match on eventtype directly (eventtype="*_Trap"), and it did the same thing. Any suggestions?

Tags (3)
0 Karma

roumys
Explorer

Verify what you search you had when you created your eventtype=SNMP
Should look similar to this:
source="/var/opt/trapx/log/traps-all.log" SNMP

(you don't even need to add SNMP as based on your log name it seems like everything inside should just be snmptrap logs)

save event as SNMP

and then use the query
source="/var/opt/trapx/log/traps-all.log" eventtype=SNMP | chart count by eventtype, host

(you don't need to add fields as when you chart it you are choosing the fields already.)

0 Karma

roumys
Explorer

source="/var/opt/trapx/log/traps-all.log"| eval a=mvfilter(eventtype == SNMP) | search a=* | chart count by a, host

0 Karma

a212830
Champion

OK. Did that, and it returns other eventtypes as well, which I didn't create (possibly system eventtypes?). It also returns "nix-all-logs" eventtypes.

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