Splunk Search

Why does my date format change when downloading CSV?

splunkcol
Builder

Hello,

When I run a query I get the results as I need them in a table from Splunk but when I download the .csv file, the timestamp field changes to an incorrect date and year.

Does anyone know how I can fix it?

 

splunkcol_1-1666146305374.png

 

splunkcol_2-1666146361854.png

 

 

Labels (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

Is your timestamp in that format or have you formatted it like that - where is your year?

If you have an epoch date/time, then probably the most portable date format is ISO8601, i.e.

YYYY-MM-DD HH:MM:SS

which is done with

| eval timestamp=strftime(_time, "%F %T")

but it will depend on what time field you have to play with and whether you also have/want milliseconds

See strftime documentation

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

Looks like you're loading it into Excel, so Excel is trying to figure out what

Oct 15 00:03:53 

is. It is interpreting it as MMM YY HH:MM:SS

You will need to open the CSV and tell Excel what format your time is rather than allowing it to determine it automatically

 

splunkcol
Builder

Hi, thanks for replying, is it possible with a |eval that you suggest me to modify the order of the date in which excel does not generate me that error?

I already tried to format it from excel but the problem still persists.

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Is your timestamp in that format or have you formatted it like that - where is your year?

If you have an epoch date/time, then probably the most portable date format is ISO8601, i.e.

YYYY-MM-DD HH:MM:SS

which is done with

| eval timestamp=strftime(_time, "%F %T")

but it will depend on what time field you have to play with and whether you also have/want milliseconds

See strftime documentation

 

Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

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

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...