Convert string format to date using filter in logstash

filter {
mutate {
add_field => {
"docid" => "%{projectname}%{systemtypeid}%{username}-%{+dd-MM-YYYY}"
"daymonthyear" => "%{+dd-MM-YYYY}"
}
}

I get two variable docid (which I am using as my document_id =>
second is daymonthyear. it gets inserted in to index but type of that filed is string. How do I make it to date.

I just want that variable to be date format in my index.

I try many different option none works as I don't even know how to do it.

Try this under filter but it won't even start logstash.
date {
match => '["daymonthyear", "dd-MM-YYYY"]
}

I just found typo and it works now.

here is config

filter {
mutate {
add_field => {
"docid" => "%{projectname}%{systemtypeid}%{username}-%{+dd-MM-YYYY}"
"daymonthyear" => "%{+dd-MM-YYYY}"
}
} # Mutate
date {
match => ["daymonthyear", "dd-MM-YYYY"]
target => "daymonthyear"
}
}

this creates two new variable (filed) and one of them is type date.

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