Splunk Search

How to show multiple field values, that match another field

jravida
Communicator

Hi folks,
I'll do my best to explain this. I'll use cars as an analogy because it is easier to explain:

In my data source I have a field, let's call it Model. Results would include: Ford, Dodge, Lincoln, Honda, etc.

In another field I have Make. It would contain: Mustang, Focus, Charger, Civic, Accord, TownCar, etc.

Right now I have a simple table that would look like this:
Model Make
Civic Honda
Towncar Lincoln
Accord Honda
Mustang Ford
Focus Ford
Charger Dodge

The query is | stats count by Make Model | table Model Make | sort -Model

Rather than having a one-to-one list that has duplicate Makes, I would like to have a line show the Make in one field and list ALL the models, separated by comma, in on field value. So it would look like this:

Make Models
Honda Accord, Civic
Ford Focus, Mustang
Lincoln Towncar
Dodge Charger

Can anyone help me get started with this query?

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

Or this

your base search  | stats count by Make Model | table Model Make | stats delim="," values(Model) as Model by Make | nomv Model

View solution in original post

somesoni2
Revered Legend

Or this

your base search  | stats count by Make Model | table Model Make | stats delim="," values(Model) as Model by Make | nomv Model

martin_mueller
SplunkTrust
SplunkTrust

Take a look at this run-anywhere example:

index=_internal | stats values(source) as source by sourcetype | eval source = mvjoin(source, ", ")

That will give you a comma-separated list of source (Model) values by sourcetype (Make).

Get Updates on the Splunk Community!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

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