Splunk Search

makecontinuous and fillnull for selfmade date-hour column

egur
New Member

Hi,

I'm trying to fill empty hours (without events) using makecontinuous.
The time column created in the query/

| tstats count(s_id) as C
FROM datamodel=Hs
by s_date s_hour
| eval date_hour = s_date." ".s_hour
| eval y=strptime(date_hour, "%Y-%m-%d %H")
| eval z=strftime(y, "%Y-%m-%dT%H:%M:%S.%Q")
| fields z C

z C
1 2019-12-18T10:00:00.000 735017
2 2019-12-18T11:00:00.000 743298
3 2019-12-18T12:00:00.000 733748
4 2019-12-18T13:00:00.000 723318
5 2019-12-18T14:00:00.000 737788
6 2019-12-18T15:00:00.000 702345
7 2019-12-18T08:00:00.000 682183
8 2019-12-18T09:00:00.000 699685
9 2019-12-19T00:00:00.000 485244

There is a hole between lines 6-7 and I want to complete it in houtly rows (with value 0 for column C).

Tried few queries with makecontinuous but no results..

Thanks!

0 Karma
1 Solution

to4kawa
Ultra Champion
 | tstats count(s_id) as C
 FROM datamodel=Hs
 by s_date s_hour
 | eval date_hour = s_date." ".s_hour
 | eval y=strptime(date_hour, "%Y-%m-%d %H")
 | eval _time = y
 | timechart limit=0 span=1h values(C) as C
 | eval z=strftime(_time, "%Y-%m-%dT%H:%M:%S.%Q")
 | fields z C
 | fillnull

Hi, @martynoconnor
how about it? I don't use makecontinious

View solution in original post

0 Karma

to4kawa
Ultra Champion
 | tstats count(s_id) as C
 FROM datamodel=Hs
 by s_date s_hour
 | eval date_hour = s_date." ".s_hour
 | eval y=strptime(date_hour, "%Y-%m-%d %H")
 | eval _time = y
 | timechart limit=0 span=1h values(C) as C
 | eval z=strftime(_time, "%Y-%m-%dT%H:%M:%S.%Q")
 | fields z C
 | fillnull

Hi, @martynoconnor
how about it? I don't use makecontinious

0 Karma

martynoconnor
Communicator

It looks like you're trying to do makecontinuous over _time. If you haven't already, take a look at the documentation here:

https://docs.splunk.com/Documentation/SplunkCloud/8.0.0/SearchReference/Makecontinuous#Examples

You'll need to pass in a few extra settings to makecontinuous to tell it what size bin/span you want to use.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...