Splunk Search

Count occurrences of multiple fields

joxley
Path Finder

I have the following data

start_station   | end_station
_____________________________
Wimbledon       | Waterloo
Wimbledon       | Vauxhall
Vauxhall        | Wimbledon
Waterloo        | Vauxhall

I want to count how many times I visited each station and get the following output

Vauxhall   | 2
Waterloo   | 1
Wimbledon  | 3
1 Solution

joxley
Path Finder

One possible solution is to make a multi-value field out of the two fields then count by that

| eval stations=start_station + ";" + end_station | makemv delim=";" stations | stats count by stations

View solution in original post

tachifelix
Path Finder

try this search string: "change source name"
note:the following search don't work in splunk 6.2

  source="test32.csv" | stats count by start_station |appendcols [search source="test32.csv"|stats count as end by end_station]  | table start_station end|fillnull value=0

joxley
Path Finder

One possible solution is to make a multi-value field out of the two fields then count by that

| eval stations=start_station + ";" + end_station | makemv delim=";" stations | stats count by stations
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 ...