Splunk Search

How to list all sourcetypes

ialahdal
Path Finder

I am trying to list all sourcetypes in an index using dc
Using index="test" | stats dc(sourcetype) as sourcetypesonly shows the total number of sourcetypes but does not list them individually.

Tags (2)
1 Solution

richgalloway
SplunkTrust
SplunkTrust

To list them individually you must tell Splunk to do so.

index="test" | stats count by sourcetype

Alternative commands are

| metadata type=sourcetypes index=test

or

| tstats count where index=test by sourcetype
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

To list them individually you must tell Splunk to do so.

index="test" | stats count by sourcetype

Alternative commands are

| metadata type=sourcetypes index=test

or

| tstats count where index=test by sourcetype
---
If this reply helps you, Karma would be appreciated.

ialahdal
Path Finder

What I was looking for is closer to index="test" | stats dc(sourcetype) by sourcetype

but thanks I was able to find this because of your answer.

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...