mdivk
mdivk

Reputation: 3727

Tableau cannot recognize timestamp field in my log file

I am using Tableau 9.3 to do a preliminary data analysis on one of my log file, the log file is like below:

"199.72.81.55",01/Jul/1995:00:00:01,/history/apollo/,200,6245,Sat

As you can see, there is a datetime for timestamp

In Tableau, initially it is recognized as a string like below:

enter image description here

That's fine, I want to make the field into datetime, and Tableau seems failed on it:

enter image description here

Why? How do I fix it?

Thank you very much.

UPDATED: after applying the formula suggested below, Tableau still cannot recognize the timestamp, here is the screenshot:

enter image description here

UPDATED AGAIN: after tested by nick, it is confirmed his first script is correct and working on his Tableau, why it fails on mine, I don't know, you are welcome to share any clue please, thank you.

Upvotes: 1

Views: 1731

Answers (3)

mdivk
mdivk

Reputation: 3727

It turned out to be the region setting issue, it works after I switch it to USA

Upvotes: 0

matt_black
matt_black

Reputation: 1330

Sometimes the "date parse" function in Tableau doesn't quite do the job.

When this happens it is worth testing manual string manipulation with your timestamp field to put it into ISO-standard format and only then trying to convert it into a date. ISO format is yyyy-mm-dd hh:mm:ss (eg 2012-02-28 13:04:30). It is common to find that the original string has spurious characters or spaces that throw dateparse. But these are usually easy to manipulate away with suitable text manipulations. This can sometimes be longwinded, but it always works.

Upvotes: 0

Nick
Nick

Reputation: 7431

Tableau implicit conversions are limited to more standard formats. You can still create a DATETIME field from your timestamp string using a calculated field with the following formula:

DATEPARSE('dd/MMM/yyyy:HH:mm:ss',[timestamp])

Using the above will transform a string like 01/Jul/1995:00:00:01 to a date and time of 7/1/1995 12:00:01 AM

Output using example data:

enter image description here

Upvotes: 1

Related Questions