All Apps and Add-ons

Why is my search showing 0's?

Bbyers3
New Member

So I am running a Query using DBConnect. "date_provisioned" is the column that has the time stamp. It is in the format below. I am having issues that when I remove the "timechart span=7d count by platform" section it shows 183 events. I want to count those events based on the time. I feel like I am doing something wrong with the eval _time section.

Please help!

Format:
2018-01-02 00:00:00.0

QUERY:

| dbxquery query="SELECT * FROM \"ESS\".\"dbo\".\"CST_itportal_provisioning\" where Year = Year(GETDATE())" connection="ESS_DB" |eval _time = date_provisioned | timechart span=7d count By platform

alt text

0 Karma
1 Solution

cmerriman
Super Champion

you need to format your date_provisioned to be in epoch for _time to work in timechart. try this

| dbxquery query="SELECT * FROM \"ESS\".\"dbo\".\"CST_itportal_provisioning\" where Year = Year(GETDATE())" connection="ESS_DB" |eval _time = strptime(date_provisioned,"%Y-%m-%d %H:%M:%S.%1N") | timechart span=7d count By platform

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables
https://docs.splunk.com/Documentation/Splunk/7.0.1/Knowledge/Usedefaultfields#Internal_fields

View solution in original post

Bbyers3
New Member

Thank you!

I tried that before as well, but I see where I messed up. I had (date_provisioned,"%Y-%m-%d %H:%M:%S.%1N") but I missed the colons 😞 thanks so much for the help. It is working exactly as I want it too.

0 Karma

cmerriman
Super Champion

you need to format your date_provisioned to be in epoch for _time to work in timechart. try this

| dbxquery query="SELECT * FROM \"ESS\".\"dbo\".\"CST_itportal_provisioning\" where Year = Year(GETDATE())" connection="ESS_DB" |eval _time = strptime(date_provisioned,"%Y-%m-%d %H:%M:%S.%1N") | timechart span=7d count By platform

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables
https://docs.splunk.com/Documentation/Splunk/7.0.1/Knowledge/Usedefaultfields#Internal_fields

Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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