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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...