Getting Data In

Appendcols - Issue in the output of the query

vn_g
Path Finder

Query1 : index="*" earliest=-1mon@mon latest=@mon
| stats count

O/P : 25,419,925,723

Query2 : index="*" earliest=-2mon@mon latest=-1mon@mon
| stats count as Twomonthsbeforecount
| appendcols
[ search index="*" earliest=-1mon@mon latest=@mon
| stats count as Onemonthbeforecount ]
| eval Difference=Onemonthbeforecount-Twomonthsbeforecount
| table Difference Onemonthbeforecount Twomonthsbeforecount

O/P :

DifferenceOnemonthbeforecountTwomonthsbeforecount
-2654151775516952487526711042630

 

Query 1 output should match the Query 2 "Onemonthbeforecount " column value, but why is it differing? Am i missing out something to check?

Tags (1)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @vn_g,

Can you try with tstats?

| tstats count as Twomonthsbeforecount where index="*" earliest=-2mon@mon latest=-1mon@mon
| appendcols
[ tstats count as Onemonthbeforecount where index="*" earliest=-1mon@mon latest=@mon ]
| eval Difference=Onemonthbeforecount-Twomonthsbeforecount
| table Difference Onemonthbeforecount Twomonthsbeforecount
If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @vn_g,

Can you try with tstats?

| tstats count as Twomonthsbeforecount where index="*" earliest=-2mon@mon latest=-1mon@mon
| appendcols
[ tstats count as Onemonthbeforecount where index="*" earliest=-1mon@mon latest=@mon ]
| eval Difference=Onemonthbeforecount-Twomonthsbeforecount
| table Difference Onemonthbeforecount Twomonthsbeforecount
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

vn_g
Path Finder

Yes, this helped. Thankyou so much

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Is your subsearch getting truncated due to limits on subsearches?

0 Karma

vn_g
Path Finder

No I don’t see any DAG execution error 

0 Karma
Get Updates on the Splunk Community!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...