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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...