Splunk Search

why i am finding count difference in timechart function

umsundar2015
Path Finder

Hi,

When i run a search for 7 days , i am getting correct count for all 7 days .But when i run for 30 days then i am finding difference in count .I am left joining 2 indexes and finally i am using timechart command.
Please can anyone help me out

thanks,

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi umsundar2015,
you used a join using IP as key, but in your subsearch you haven't IP field as output, so your join never matches.
Try to insert in your subsearch IP AS value or key stats.

Bye.
Giuseppe

0 Karma

cmerriman
Super Champion

i believe it is the way that timechart buckets the days. I believe buckets start from the earliest date in your time frame.

If you search |timechart span=7d count for Last 30 days (2017-09-12 through 2017-10-12), the _time comes back with 2017-09-12, 2017-09-19, 2017-09-26, 2017-10-03 and 2017-10-10
however if you run the same search for Last 7 days (2017-10-05 through 2017-10-12), you'll get _time of 2017-10-05 and 2017-10-12

0 Karma

umsundar2015
Path Finder

i am giving span=1d , Can you please help me out

0 Karma

cmerriman
Super Champion

@Anonymous points out that IP is not in your subsearch, yet you have it set as the field to join to. Try

| join type=left IP 
    [ search index=rranges 
    | stats count by IP sas _time] 

also, your whole query isn't by _time, so the total sum wouldn't match because you're summing by sas, not by day (_time span=1d). essentially, the bin command is not doing anything in the grand scheme.

if you wanted it by day and sas, bin _time first, then apply the stats command.

|bin span=1d _time
|stats count by sas _time
0 Karma

DalJeanis
Legend

Please post the search, with any confidential information removed, so we can help you more accurately.

0 Karma

umsundar2015
Path Finder

Hi daljeanis,

This is my search,

index=qranges|fillnull value=Null|search Name="*"|join type=left IP [search index=rranges |stats count by sas _time]|stats count by sas _time|bin span=1d _time|stats sum(count) by sas

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...