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!

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