Logstash unable to convert String to timestamp


(Marshall Wilson) #1

Team

Sorry if this is a simple question. This is my first question in blog and tried many option from the website but it didn't help. Kindly assist on the below. Thanks

I have a grok variable %{GREEDYDATA:LastBeginDateTime1} which matches 2018-03-01 02:30:33
In my config I am trying to change it to timestamp like

date
{
match => ["LastBeginDateTime1", "YYYY-MM-DD HH:mm:ss"]
timezone => "America/Chicago"
target => "@timestamp"
}

But however i still see the variable as string in my Kibana dashboard. Can you please help? Thanks a lot


#2

LastBeginDateTime1 should still be a string. The question is whether @timestamp (which you set as the target) is equal to the parsed value for LastBeginDateTime1.

If you want LastBeginDateTime1 to be a timestamp then set that as the target, but since you already have LastBeginDateTime1 as a string in your index you will get a type conflict.


(Marshall Wilson) #3

Thanks. I see the @timestamp value changed but it is not equal to LastBeginDateTime1

My LastBeginDateTime1 is 2018-03-01 14:00:14
However my @timestamp is showing as "January 1st 2018, 14:00:14.000"
Also instead of updating @timestamp how to update it to a new variable of which is of similar to @timestamp

Config

date
{
match => ["Batch_LastBeginDateTime1", "YYYY-MM-DD HH:mm:ss"]
timezone => "America/Chicago"
target => "@timestamp"
}


#4

:rofl: "YYYY-MM-dd HH:mm:ss", not "YYYY-MM-DD HH:mm:ss"

DD is day of the year, and day 1 is Jan 1st. That's overriding the month.


(Marshall Wilson) #5

:stuck_out_tongue: Thanks a lot. Can you please let me know how to save it in a new variable other than @timestamp?


(Marshall Wilson) #6

Got it into a different timestamp variable. Thanks a lot


(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.