Splunk Search

Adding field to results of count querry

TomCollick
Explorer

How would I add field x to the results of count(y) as z so that the results are
x z count(y)? I know it is simple but it eludes me.
thank you

Tags (1)
0 Karma

RicoSuave
Builder

try this

mysearch | stats count(y) AS COUNTy | eval z=(COUNTy+x) | table x z COUNTy

RicoSuave
Builder

Awesome, please accept my answer 😄

0 Karma

TomCollick
Explorer

This worked thank you

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