fluent-plugin-loki - broken or very bad documentation? #535
Closed
Description
Describe the bug
fluent-plugin-loki does not work as documentated.
First of all the loki endpoint url uses the key url
in the README https://github.com/grafana/loki/blob/master/fluentd/fluent-plugin-loki/README.md#usage
But fluentd requires the key endpoint_url
2019-05-01 13:36:02 +0000 [error]: config error file="/fluent/fluent.conf" error_class=Fluent::ConfigError error="'endpoint_url' parameter is required"
When I change it like this
<match nureintest>
@type loki
endpoint_url "http://loki:3100"
extra_labels {"env":"dev"}
flush_interval 10s
flush_at_shutdown true
buffer_chunk_limit 1m
</match>
Fluentd is starting correctly.
Now I put a sample log via fluent-bit to my fluentd which should be outputted to my loki server.
echo -n "{\"key\": \"some value\"}" | ./fluent-bit -i stdin -t nureintest -o forward://127.0.0.1:24224
but fluentd throws an error
2019-05-01 13:38:10 +0000 [warn]: #0 got unrecoverable error in primary and no secondary error_class=NoMethodError error="undefined method `each' for nil:NilClass"
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluent-plugin-loki-0.2.0/lib/fluent/plugin/out_loki.rb:174:in `format_labels'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluent-plugin-loki-0.2.0/lib/fluent/plugin/out_loki.rb:181:in `handle_record'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluent-plugin-loki-0.2.0/lib/fluent/plugin/out_loki.rb:213:in `block in write'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/event.rb:323:in `each'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/event.rb:323:in `block in each'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/plugin/buffer/memory_chunk.rb:80:in `open'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/plugin/buffer/memory_chunk.rb:80:in `open'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/event.rb:322:in `each'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluent-plugin-loki-0.2.0/lib/fluent/plugin/out_loki.rb:212:in `write'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/plugin/output.rb:1125:in `try_flush'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/plugin/output.rb:1425:in `flush_thread_run'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/plugin/output.rb:454:in `block (2 levels) in start'
2019-05-01 13:38:10 +0000 [warn]: #0 /var/lib/gems/2.5.0/gems/fluentd-1.4.2/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
2019-05-01 13:38:10 +0000 [warn]: #0 bad chunk is moved to /tmp/fluent/backup/worker0/object_2ad744efbfb4/587d3a04ca0167fa7b0ed5056a6d13ca.log