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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...