Splunk Search

How to convert tabular data to distinct count

VijaySrrie
Builder

How to convert tabular data to distinct count

Hi,

I have a splunk query

| stats count by operation (under field operation we have activate and deactivate count)

vijaysri_0-1614849271363.png

How to convert it to distinct count (instead of tabular format I want only the count to be displayed)

 

Labels (2)
0 Karma

VijaySrrie
Builder

vijaysri_0-1614850598529.png

 

It is not working, I should get the result as 2

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| stats dc(operation) as count

Is that what you mean?

0 Karma

VijaySrrie
Builder

yes, this query gave me count as 1, I want the count of activate to be displayed. Better I will create the field extraction for activate and use the below query

| stats dc(activate) as count

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| where operation="activate"
| stats count by operation
0 Karma

VijaySrrie
Builder

vijaysri_0-1614851467811.png

User wanted only the numerical value to be displayed, so I used above query

| search operation="activate"
| stats count by operation
| table count

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...