Splunk Search

How to add a fixed value into the stats count?

sunilkumarpk
Engager

I am trying to have a single value panel. The search for the same is given below:

index=* host="prodserver-*" source="/var/log/some.log" "something happened" | stats count 

I need to add a fixed value of 1000 to the count value. I tried to use eval and add the value to count but its not working 😞
I can add two fixed values like the one given below, but using "count" is not working.

This works:

index=* host="prodserver-*" source="/var/log/some.log" "something happened" | eval totalCount = 1 + 1000 |stats max(totalCount)  

This does not work:

index=* host="prodserver-*" source="/var/log/some.log" "something happened" | eval totalCount = count + 1000 |stats max(totalCount) 

I am new to Splunk so please forgive me if this is a silly question :).

0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

index= host="prodserver-*" source="/var/log/some.log" "something happened" | stats count | eval count=count+1000

View solution in original post

somesoni2
Revered Legend

Try like this

index= host="prodserver-*" source="/var/log/some.log" "something happened" | stats count | eval count=count+1000

sunilkumarpk
Engager

that worked, thank you

0 Karma

ppablo
Retired

Hi @sunilkumarpk

Glad you found an answer through @somesoni2. Please don't forget to resolve the post by clicking "Accept" directly below his answer. Thanks!

Patrick

0 Karma
Get Updates on the Splunk Community!

New Case Study Shows the Value of Partnering with Splunk Academic Alliance

The University of Nevada, Las Vegas (UNLV) is another premier research institution helping to shape the next ...

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

October 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...