Knowledge Management

Event Types on a Summary Index

srussellnpr
Explorer

Team,

I have a summary index that looks like this:

<search string> | sistats count by UserAgent

I also have a collection of event types that group various UserAgents, such that:

[ua_iPhone]
UserAgent="iPhone"

[ua_iPad]
UserAgent="iPad"

I'd like to query the si and end up with a list of top user agents, sort of like:

index="summary" search_name="si_useragent" | stats count by UserAgent | eval eventtype=mvfilter(match(eventtype, "ua\_.*")) | top eventtype

Is this possible? Advisable?

Thanks, -S.

gkanapathy
Splunk Employee
Splunk Employee

Stephen has given you an answer. As an aside, I recommend use of a lookup table rather than eventtypes for this use case.

0 Karma

srussellnpr
Explorer

Ah, precisely! It looks more like:

[ua_iphone] UserAgent="iPhone"

However, I was considering writing a script in python to create a dynamic lookup table, but then I heard about this eventtype approach.

0 Karma

Stephen_Sorkin
Splunk Employee
Splunk Employee

I'd normally recommend a lookup as well, but my guess is that the actual eventtypes have wildcards, which CSV lookups don't play well with.

0 Karma

Stephen_Sorkin
Splunk Employee
Splunk Employee

Yes, you should be able to do this by manually running the typer command after the stats count. For example:

index="summary" search_name="si_useragent" | stats count by UserAgent | typer | eval eventtype=mvfilter(match(eventtype, "ua_.*")) | top eventtype
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 ...