Splunk Search

How to change the result of my stats count?

juliop3p
Explorer

Hi guys,

I'm a Splunk beginner and I'm having some trouble making a specific query.

I have a health check log, I want to know how many times the user restarts my app. The first health check log is when the user logs in for the first time and the next is the times that the user restarts my app.

 

This is my current query:

 

index=myIndex Title=Healthcheck | stats count by Data.Ip

 

With the result of this query I have the total times the user opened my app, but I want to remove just 1 from the count of each user

current result:

Data.IP count
4.21.28.39 5
21.224.60.37 3


expected result:

Data.IP count
4.21.28.39 4
21.224.60.37 2
Labels (1)
Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use the eval command to do that arithmetic.

index=myIndex Title=Healthcheck 
| stats count by Data.Ip
| eval count = count - 1
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Use the eval command to do that arithmetic.

index=myIndex Title=Healthcheck 
| stats count by Data.Ip
| eval count = count - 1
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

What's New in Splunk Enterprise 9.4: Features to Power Your Digital Resilience

Hey Splunky People! We are excited to share the latest updates in Splunk Enterprise 9.4. In this release we ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...

SignalFlow: What? Why? How?

What is SignalFlow? Splunk Observability Cloud’s analytics engine, SignalFlow, opens up a world of in-depth ...