Description
Environment
- Ruby Version - 2.3.1
- Rails Version Rails - 5.2.4.5
- Semantic Logger Version - 4.7.4
- Rails Semantic Logger Version - 4.5.1
- Elasticsearch - 8.14.3
- application.rb:
-
end
if ENV["LOG_TO_ELASTIC"] config.semantic_logger.add_appender( appender: :elasticsearch, url: ENV.fetch('LOG_TO_ELASTIC_URL', "http://localhost:9200"), index: "myapp-#{Rails.env}-index", data_stream: true )
- Full Stack Trace, an exception is being raised:
2024-07-29 18:30:49.469896 F [112569:SemanticLogger::Appender::Elas loggable.rb:45] SemanticLogger::Appender::Elasticsearch -- [400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"}],"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"},"status":400}
2024-07-29 18:30:49.470070 E [112569:SemanticLogger::Appender::Elas] SemanticLogger::Appender::Elasticsearch -- Async: Restarting due to exception -- Exception: Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"}],"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"},"status":400}
/home/dim/.rvm/gems/ruby-2.3.1/gems/elasticsearch-transport-7.5.0/lib/elasticsearch/transport/transport/base.rb:205:in __raise_transport_error' /home/dim/.rvm/gems/ruby-2.3.1/gems/elasticsearch-transport-7.5.0/lib/elasticsearch/transport/transport/base.rb:333:in
perform_request'
/home/dim/.rvm/gems/ruby-2.3.1/gems/elasticsearch-transport-7.5.0/lib/elasticsearch/transport/transport/http/faraday.rb:24:in perform_request' /home/dim/.rvm/gems/ruby-2.3.1/gems/elasticsearch-transport-7.5.0/lib/elasticsearch/transport/client.rb:152:in
perform_request'
/home/dim/.rvm/gems/ruby-2.3.1/gems/elasticsearch-api-7.5.0/lib/elasticsearch/api/actions/bulk.rb:54:in bulk' /home/dim/.rvm/gems/ruby-2.3.1/gems/semantic_logger-4.7.4/lib/semantic_logger/appender/elasticsearch.rb:176:in
write_to_elasticsearch'
/home/dim/.rvm/gems/ruby-2.3.1/gems/semantic_logger-4.7.4/lib/semantic_logger/appender/elasticsearch.rb:169:in batch' /home/dim/.rvm/gems/ruby-2.3.1/gems/semantic_logger-4.7.4/lib/semantic_logger/appender/async_batch.rb:82:in
block in process_messages'
/home/dim/.rvm/gems/ruby-2.3.1/gems/semantic_logger-4.7.4/lib/semantic_logger/appender/async_batch.rb:62:in loop' /home/dim/.rvm/gems/ruby-2.3.1/gems/semantic_logger-4.7.4/lib/semantic_logger/appender/async_batch.rb:62:in
process_messages'
/home/dim/.rvm/gems/ruby-2.3.1/gems/semantic_logger-4.7.4/lib/semantic_logger/appender/async.rb:121:in process' /home/dim/.rvm/gems/ruby-2.3.1/gems/semantic_logger-4.7.4/lib/semantic_logger/appender/async.rb:77:in
block in thread'
Expected Behavior
Rails app send logs to Elasticsearch
Actual Behavior
Rails app raise exception when try to start