Dashboards & Visualizations

How to do TimeChart implementation with DB SQL query?

dkssingh2005
Explorer

I want to implement timechart with span in db sql query. But while implementation, I am getting zero result.

Basically, I want to show count with timechart.

date2.JPG

Even, I verified that data is coming with the same query with created_timestamp column.data1.JPG 

I don't know what step I am doing missing, while using timechart.

Labels (1)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Timechart relies on a field called _time to hold the epoch timestamp. You need to parse the create time and store it in the _time field. Try something like this

| eval _time=strptime(created_timestamp,"%Y-%m-%d %H:%M:%S.%3N")

 

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Timechart relies on a field called _time to hold the epoch timestamp. You need to parse the create time and store it in the _time field. Try something like this

| eval _time=strptime(created_timestamp,"%Y-%m-%d %H:%M:%S.%3N")

 

dkssingh2005
Explorer

Thanks @ITWhisperer , Its working now. But I am getting extra date in visualization like 1 Apr to 24 Apr . I only fetched  date 1 march  to 1Aprildata3.JPG Even I put the condition on _time, still its not workingdata4.JPG

 

Getting extra date in timechart. Any Solution?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Timechart uses the earliest and latest times from the search to determine the size of the x axis

ITWhisperer_0-1650894273366.png

Change the timeframe for the search or create your own chart

| bin span=1h _time
| chart count by _time scope
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...