Elasticsearch: Could not index event to Elasticsearch

Thank you for reading this post, don't forget to subscribe!

При настрой­ке сбо­ра логов обна­ру­жи­лось, что Elasticsearch пере­стал созда­вать индек­сы под логи. Сама схе­ма сбо­ра Filebeat -> Logstash -> Elasticsearch

Ошиб­ка была сле­ду­ю­ще­го вида:

[2021-03-23T18:03:43,081][WARN ][logstash.outputs.elasticsearch][main][e10c66dfb2e74fd1db2e243865b224f6ca135c8f45f5c9e8d744daaad909a48f] Could not index event to Elasticsearch. {:status=>404, :action=>["index", {:_id=>nil, :_index=>"logstash-%{[fields][logapp]}-2021.03.23", :routing=>nil, :_type=>"_doc"}, #], :response=>{"index"=>{"_index"=>"logstash-%{[fields][logapp]}-2021.03.23", "_type"=>"_doc", "_id"=>nil, "status"=>404, "error"=>{"type"=>"index_not_found_exception", "reason"=>"no such index [logstash-%{[fields][logapp]}-2021.03.23]", "resource.type"=>"index_expression", "resource.id"=>"logstash-%{[fields][logapp]}-2021.03.23", "index_uuid"=>"_na_", "index"=>"logstash-%{[fields][logapp]}-2021.03.23"}}}}

 

Пер­вое, что нагуг­лил было вклю­чить пара­метр «action.auto_create_index»: «true» в кон­фи­ге Elasticsearch, но увы не помог­ло. Ока­за­лось, тре­бу­ет­ся быть чуть хит­рее и уста­но­вить пара­метр через curl-запрос