Dashboards & Visualizations

How to fix Incorrect timestamp in DB Connect ?

pmcfadden91
Path Finder

Hi, I am trying to figure out how to convert the timestamp in DB Connect back to a MM/DD/YYYY value. I was able to do this with the fieldformat command. However when I added the chart command, it changed back into numerical values (1442358000.000, 1442444400.000, etc..) How do I correct this problem?

| dbquery "PB CSL" limit=1000 "select a.SOURCE_SYSTEM_NAME, trunc(creation_time), count(*) Count from PB_CSL.activity a, PB_CSL.Activitymap b where creation_time < trunc(sysdate) - 0 and creation_time  >= trunc(sysdate) -5 and a.service_id = b.activity_id group by SOURCE_SYSTEM_NAME, trunc(creation_time) order by SOURCE_SYSTEM_NAME, trunc(creation_time)" | rename TRUNC(CREATION_TIME) as Date| fieldformat "Date"=strftime('Date', "%m-%d-%Y") | chart values(COUNT) over SOURCE_SYSTEM_NAME by Date
0 Karma
1 Solution

gcato
Contributor

HI pmcfadden91,

The fieldformat command does not change the underlying value of Date field. As per the docs...

With the fieldformat command you can use eval expressions to change the format of a field value when the results render. You can change the format without changing the underlying value of the field. Commands later in the search pipeline cannot modify the formatted value.

Trying using an eval instead on fieldformat , e.g. |eval Date = strftime('Date', "%m-%d-%Y")

Hope this helps.

View solution in original post

gcato
Contributor

HI pmcfadden91,

The fieldformat command does not change the underlying value of Date field. As per the docs...

With the fieldformat command you can use eval expressions to change the format of a field value when the results render. You can change the format without changing the underlying value of the field. Commands later in the search pipeline cannot modify the formatted value.

Trying using an eval instead on fieldformat , e.g. |eval Date = strftime('Date', "%m-%d-%Y")

Hope this helps.

Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...