Open snemetz opened 3 years ago
Ah, this is because API is changed.
ref. https://github.com/elastic/elasticsearch-ruby/blob/master/CHANGELOG.md#7110
elasticsearch-api should be loaded instead.
As a workaround, use elasticsearch-api elasticseach-xpack 7.10.x
I uninstalled all elasticsearch gems and then installed 7.10.1 versions. It is working now.
1 other question We use type elasticsearch_dynamic. Is there a dynamic version of elasticsearch_data_stream? If not, will be happen to create a feature request for it
Is there a dynamic version of elasticsearch_data_stream?
No. but @elasticsearch_data_stream
supports the placeholder feature, does not work for you?
Currently my upstream fluent-bit agents create an index field and set it to what ES index the log should go to. The only way I figured out to have fluentd send it to the index specified was to use elasticsearch-dynamic
If there is another way, I'd be happy to hear
I'd released #870 as v5.0.1.
Is there a dynamic version of elasticsearch_data_stream?
No. but
@elasticsearch_data_stream
supports the placeholder feature, does not work for you?
Hello, which version supports placeholders in data_stream? I am not able to use this feature in 5.1.0 version. Or could you please provide example configuration of using placeholders in such a way?
My configuration is here:
<label @OUTPUT>
<match **>
@type elasticsearch_data_stream
host elasticsearch-master
port 9200
suppress_type_name true
data_stream_name fluentd.${$.kubernetes.container_name}
data_stream_ilm_name delete-after-14-days
<buffer _index, $.kubernetes.container_name>
flush_thread_count 5
@type file
path /var/log/fluentd/buffer/
timekey 10m
chunk_limit_size 10m
total_limit_size 10g
flush_mode interval
flush_interval 1m
overflow_action drop_oldest_chunk
retry_type exponential_backoff
retry_wait 5s
retry_max_interval 60s
retry_randomize true
retry_forever true
</buffer>
</match>
</label>
Using this configuration, fluentd creates datastream with name fluentd.${$.kubernetes.container_name}
, which is not what I want.
Hi @lololozhkin,
were you perhaps able to resolve your issue? I am struggling with the same thing
were you perhaps able to resolve your issue? I am struggling with the same thing
Hi @martonorova, the problem was in the version. Update to version upper than 5.1.0 should resolve your problem!
Hi @lololozhkin , I'm also trying to make it work. using the sample that you have provided. I'm still observing the same behaviour (despite running version (5.1.4
) of the plugin) - meaning fluentd creates datastream with name fluentd.${$.kubernetes.container_name}
.
I'm using kibana / elasticsearch version 7.14.0
.
I wonder if you could post some more information about how you made it work (full fluentd config, fluentd version, plugin version etc.)? Thank you!
Environment:
I'm running fluentd from this docker image: fluent/fluentd-kubernetes-daemonset:v1.14.3-debian-elasticsearch7-1.0
inside Kubernetes cluster. When I open shell to my container and verify plugin version, it says:
root@fluentd-2bnnh:/fluentd# gem list |grep -i fluent-plugin-elasticsearch
fluent-plugin-elasticsearch (5.1.4)
And this is part of the congi map that I'm using in my deployment.
fileConfigs:
01_sources.conf: |-
<source>
@type tail
@id in_tail_container_logs
@label @KUBERNETES
path /var/log/containers/*.log
pos_file /var/log/fluentd-containers.log.pos
tag kubernetes.*
read_from_head true
<parse>
@type cri
</parse>
emit_unmatched_lines true
</source>
02_filters.conf: |-
<label @KUBERNETES>
<match kubernetes.var.log.containers.fluentd**>
@type relabel
@label @FLUENT_LOG
</match>
# <match kubernetes.var.log.containers.**_kube-system_**>
# @type null
# @id ignore_kube_system_logs
# </match>
<filter kubernetes.**>
@type kubernetes_metadata
@id filter_kube_metadata
skip_labels false
skip_container_metadata false
skip_namespace_metadata false
skip_master_url false
</filter>
<match **>
@type relabel
@label @DISPATCH
</match>
</label>
03_dispatch.conf: |-
<label @DISPATCH>
<filter **>
@type prometheus
<metric>
name fluentd_input_status_num_records_total
type counter
desc The total number of incoming records
<labels>
tag ${tag}
hostname ${hostname}
</labels>
</metric>
</filter>
<match **>
@type relabel
@label @OUTPUT
</match>
</label>
04_outputs.conf: |-
<label @OUTPUT>
<match **>
@type elasticsearch_data_stream
host elasticsearch-master
port 9200
suppress_type_name true
data_stream_name fluentd.${$.kubernetes.container_name}
data_stream_ilm_name foo
</match>
</label>
I've also pulled out one of the log messages to the stdout, to make sure that the kubernetes labels are there, and so they are:
{
"stream": "stdout",
"logtag": "F",
"message": "I removed this msg...",
"time": "2022-01-18T12:59:48.0980824Z",
"docker": {
"container_id": "60d7f5efa369b90aa5d816f20db2099fa1aa11b65ee448ad649fd56992b80fc1"
},
"kubernetes": {
"container_name": "kibana",
"namespace_name": "default",
"pod_name": "kibana-kibana-79855ccc65-qxx57",
"container_image": "docker.elastic.co/kibana/kibana:7.14.0",
"container_image_id": "docker.elastic.co/kibana/kibana@sha256:a1c80a2b22f6c9a93a089c8b983078d482e6dad5e693c64e84b491afd0e90f53",
"pod_id": "6c2c78ed-3bf0-49be-9760-d135b65038ac",
"pod_ip": "10.42.0.10",
"host": "k3d-hello-server-0",
"labels": {
"app": "kibana",
"pod-template-hash": "79855ccc65",
"release": "kibana"
},
"master_url": "https://10.43.0.1:443/api",
"namespace_id": "ecb2a711-800c-4a72-bfbe-a97bb0ebf936",
"namespace_labels": {
"kubernetes_io/metadata_name": "default"
}
}
}
Problem
Trying to use ES data streams and failing
Steps to replicate
Fluentd.confg
Expected Behavior or What you need to ask
Expected to send data to ES data stream Template exists on ES
1) got error that xpack is needed Doc needs to be updated to specify elasticsearch-xpack needs to be installed
2) after elasticsearch-xpack installed Received error:\nDid you mean? put_template"
`
I have no settings in fluentd for managing template.
Expected to just use template already created on ES server
[error]: config error file="fluent.conf" error_class=Fluent::ConfigError error="Failed to create data stream: <testing-data-stream> undefined method
put_index_template' for #...
Using Fluentd and ES plugin versions
2021-02-23 18:04:56 -0800 [info]: parsing config file is succeeded path="fluent.conf" 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-datadog' version '0.12.0' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-datadog' version '0.11.1' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-elasticsearch' version '5.0.0' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-elasticsearch' version '4.0.7' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-elasticsearch' version '4.0.5' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-elasticsearch' version '2.12.5' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-flowcounter-simple' version '0.0.4' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-grafana-loki' version '1.2.16' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-mongo' version '1.3.0' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-prometheus' version '1.7.3' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-record-modifier' version '2.1.0' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-record-reformer' version '0.9.1' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '2.3.0' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '2.2.0' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-s3' version '1.3.0' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-secure-forward' version '0.4.5' 2021-02-23 18:04:56 -0800 [info]: gem 'fluent-plugin-td' version '1.1.0' 2021-02-23 18:04:56 -0800 [info]: gem 'fluentd' version '1.12.1' 2021-02-23 18:04:56 -0800 [info]: gem 'fluentd' version '1.9.3'
actioncable (5.2.4.1) actionmailer (5.2.4.1) actionpack (5.2.4.1) actionview (5.2.4.1) activejob (5.2.4.1) activemodel (5.2.4.1) activemodel-serializers-xml (1.0.2) activerecord (5.2.4.1) activestorage (5.2.4.1) activesupport (5.2.4.1) addressable (2.7.0) arel (9.0.0) aws-eventstream (1.0.3) aws-partitions (1.281.0) aws-sdk-core (3.91.0) aws-sdk-kms (1.30.0) aws-sdk-s3 (1.61.0) aws-sdk-sqs (1.23.1) aws-sigv4 (1.1.1) bigdecimal (default: 1.4.1) bootsnap (1.4.6) bson (4.8.2) builder (3.2.4) bundler (2.1.4, default: 1.17.2) CFPropertyList (2.3.6) cmath (default: 1.0.0) concurrent-ruby (1.1.6, 1.0.5) cool.io (1.6.0) crass (1.0.6) csv (default: 3.0.9) date (default: 2.0.0) dbm (default: 1.0.0) did_you_mean (1.3.0) diff-lcs (1.3) dig_rb (1.0.1) draper (3.1.0) e2mmap (default: 0.1.0) elasticsearch (7.6.0, 7.5.0) elasticsearch-api (7.6.0, 7.5.0) elasticsearch-transport (7.6.0, 7.5.0) elasticsearch-xpack (7.11.1) erubi (1.9.0) erubis (2.7.0) etc (default: 1.0.1) excon (0.73.0, 0.72.0) faraday (1.0.1, 0.17.3) fcntl (default: 1.0.0) ffi (1.12.2) fiddle (default: 1.0.0) fileutils (default: 1.1.0) fluent-config-regexp-type (1.0.0) fluent-plugin-datadog (0.12.0, 0.11.1) fluent-plugin-elasticsearch (5.0.0, 4.0.7, 4.0.5, 2.12.5) fluent-plugin-flowcounter-simple (0.0.4) fluent-plugin-grafana-loki (1.2.16) fluent-plugin-mongo (1.3.0) fluent-plugin-prometheus (1.7.3) fluent-plugin-record-modifier (2.1.0) fluent-plugin-record-reformer (0.9.1) fluent-plugin-rewrite-tag-filter (2.3.0, 2.2.0) fluent-plugin-s3 (1.3.0) fluent-plugin-secure-forward (0.4.5) fluent-plugin-td (1.1.0) fluentd (1.12.1, 1.9.3) fluentd-ui (1.2.1) font-awesome-rails (4.7.0.5) forwardable (default: 1.2.0) globalid (0.4.2) haml (5.1.2) haml-rails (1.0.0) html2haml (2.2.0) http_parser.rb (0.6.0) httpclient (2.8.3) i18n (1.8.2) io-console (default: 0.4.7) ipaddr (default: 1.2.2) irb (default: 1.0.0) jbuilder (2.10.0) jmespath (1.4.0) json (default: 2.1.0) kramdown (2.1.0) kramdown-haml (0.0.3) libxml-ruby (3.1.0) logger (default: 1.3.0) loofah (2.4.0) mail (2.7.1) marcel (0.3.3) matrix (default: 0.1.0) method_source (0.9.2) mimemagic (0.3.4) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.0, 5.11.3) mongo (2.6.4) msgpack (1.3.3) multi_json (1.14.1) multipart-post (2.1.1) mutex_m (default: 0.1.0) net-http-persistent (2.9.4) net-telnet (0.2.0) nio4r (2.5.2) nokogiri (1.10.9, 1.10.1) openssl (default: 2.1.2) ostruct (default: 0.1.0) power_assert (1.1.3) prime (default: 0.1.0) prometheus-client (0.9.0) proxifier (1.0.3) psych (default: 3.1.0) public_suffix (4.0.3) puma (4.3.3) quantile (0.2.1) rack (2.2.2) rack-proxy (0.6.5) rack-test (1.1.0) rails (5.2.4.1) rails-dom-testing (2.0.3) rails-html-sanitizer (1.3.0) railties (5.2.4.1) rake (13.0.1, 12.3.2) rb-fsevent (0.10.3) rb-inotify (0.10.1) rdoc (default: 6.1.0) request_store (1.5.0) resolve-hostname (0.1.0) rexml (default: 3.1.9) rss (default: 0.2.7) ruby_parser (3.14.2) rubyzip (1.3.0) sass (3.7.4) sass-listen (4.0.0) sass-rails (5.0.8) scanf (default: 1.0.0) sdbm (default: 1.0.0) serverengine (2.2.3, 2.2.1) settingslogic (2.0.9) sexp_processor (4.14.1) shell (default: 0.7) sigdump (0.2.4) sprockets (3.7.2) sprockets-rails (3.2.1) sqlite3 (1.3.13) stringio (default: 0.0.2) strptime (0.2.3) strscan (default: 1.0.0) sucker_punch (2.0.4) sync (default: 0.5.0) td-client (1.0.7) temple (0.8.2) test-unit (3.2.9) thor (1.0.1) thread_safe (0.3.6) thwait (default: 0.1.0) tilt (2.0.10) tracer (default: 0.1.0) tzinfo (2.0.1, 1.2.6) tzinfo-data (1.2019.3) webpacker (4.2.2) webrick (default: 1.4.2) websocket-driver (0.7.1) websocket-extensions (0.1.4) xmlrpc (0.3.0) yajl-ruby (1.4.1) zlib (default: 1.0.0)