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!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...