Elastic not creating index daily based on date

I use Logstash for ingestion in elastic but my index not creating index daily based on date

my config logstsh

input {
beats  {
port => "5044"
}
}  

filter {

csv {

separator => ","
skip_header => "true"
columns => ["chaine", "job", "date_plan", "statut", "date_debut", "date_fin", "serveur", "numero_passage", "application", "sous_application"]

}

date {
match => [ "date_plan" , "YYYY-MM-dd" ]
timezone => "Europe/Paris"
}

date {
match => [ "date_debut" , "YYYY-MM-dd HH:mm:ss" ]
timezone => "Europe/Paris"
}

date {
match => [ "date_fin" , "YYYY-MM-dd HH:mm:ss" ]
timezone => "Europe/Paris"
}

mutate {
convert => { "numero_passage" => "integer" }
}

}

output {
elasticsearch {
hosts => ["http://elasticsearch:9200"]
index => "test-%{+YYYY.MM.dd}"  
stdout {
codec => rubydebug
}

}

Hi @Youssef_SBAI,

do you see any errors on stdout?

The only thing I can think of is that you are missing the @timestamp field...

From the docs

LS uses Joda to format the index pattern from event timestamp.

No i have any errror in stdout

Do you have a field named @timestamp in the stdout output?

What are your indices named? If there is no error there should have been some indices created...

yes i have a field named @timestamp in the stdout output

I have auther index created test- 2020.05.29 test- 2020.05.28 test- 2020.05.27 ..........

These index names

Match exactly your Logstash output config with

Those are the daily indices. The date for the index name is taken from the @timestamp field, not current time on the Logstash machine.

Could you share the content of one of those @timestamp fields

The content of @timestamp fields is

image

Thanks :slight_smile:

Those logs would end up in an index with the name test-2020.05.29, no matter when they pass through Logstash.

I have an other content with the index

test-2020.05.29

image

it is a problem of @timestamp fields?

If you want to call it a problem, I guess yes.

As I posted before

event timestamp = @timestamp field.

If you would rather have now (current time) instead of the event timestamp, you can replace @timestamp with a filter. Simply removing @timestamp might have the same result, not 100% sure about that.

I use Joda to format the index: index => "<logstash-{now/d}>" Thank You

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