Knowledge Management

Single row results in multiple events

sanjaykattimani
Engager

I have useragent string logged by our application. I am extracting OS and Browser names from these by creating event types (sample data shown below).
Now when i try to chart all OS types with the following search

eventtype="UserAgent" AND tag::eventtype="OperatingSystem" | chart count by eventtype| sort eventtype |rename eventtype as "OperatingSystem"

I get both Browser names and Operating system names as every user agent has both browser and OS event types.

Is there anyway to get only browser names or only OS?

UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.3; .NET4.0C; .NET4.0E; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8)
    host=etc   Options|  sourcetype=log85   Options|  source=/app/opt/tomcat/logs/user.log   Options|  index=main   Options|  date_hour=11   Options|  date_mday=11   Options|  eventtype=Internet Explorer Browser   Options|  eventtype= Trident/IE Old Browser   Options|  eventtype=Windows OperatingSystem   Options|  eventtype=UserAgent  
Tags (2)
0 Karma

somesoni2
Revered Legend

Based on your example (single) event, eventtype field should be extracted as multivalue field. You can try something like this.

eventtype="UserAgent" AND tag::eventtype="OperatingSystem" | rex max_match=0 "eventtype=(?P<Value>(\w+\s+)*)(?<Name>[^\s]+)\s+Options" | eval temp=mvzip(Name,Value,"#") | mvexpand temp | rex field=temp "(?<Name>.*)#(?<Value>.*)" | fields - temp | where Name="Browser"| chart count by Value

Change the filter 'where Name="Browser"' to "OperatingSystem' to get similar chart for Operating Systems.

Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...