ElasticSearch output, Logstash_Prefix_Key doesn't work with container_name
Bug Report
Describe the bug ElasticSearch output module doesn't work when "Logstash_Prefix_Key container_name" this is happening because container name start with "/" but ElasticSearch doesn't allow index name to start with "/" in order to get this fixed, fluentbit need to remove leading "/" in index name
To Reproduce
-
setup a fluentbit with output as ElasticSearch. in the conf file add following conf Logstash_Format on Logstash_Prefix undefined Logstash_Prefix_Key container_name
-
build a simple program and dockerize it, run the container with fluentd log driver
getting the following error message fluentbit_1 | [2020/07/30 16:16:09] [ warn] [engine] failed to flush chunk '1-1596125766.154949412.flb', retry in 11 seconds: task_id=0, input=forward.0 > output=es.0
Expected behavior Fluentbit should remove leading "/" from index name because index name start with "/" is not allowed from ElasticSearch
Screenshots
Your Environment
- Version used: 1.5
- Configuration: centos7 running everything on docker
- Environment name and version (e.g. Kubernetes? What version?): Docker version 19.03.12, build 48a66213fe
- Server type and version: Dell R630 bare metal with CentOS 7 install
- Operating System and version: CentOS Linux release 7.8.2003 (Core)
- Filters and plugins: N/A
Additional context i am trying to build a unified logging system using ElasticSearch and Fluent-bit. all the logging from docker containers. trying to have index based on the container name and the data (Example. my_flask_app-2020.07.30, my_spring_app-2020.07.30)
Fluent-bit should remove the leading "/" from the index name.
ElasticSearch index nameing rule
Lowercase only
Cannot include \, /, *, ?, ", <, >, |, space (the character, not the word), ,, #
Indices prior to 7.0 could contain a colon (:), but that's been deprecated and won't be supported in 7.0+
Cannot start with -, _, +
Cannot be . or ..
Cannot be longer than 255 characters
if someone can add code to remove above characters from es_index would be great https://github.com/fluent/fluent-bit/blob/master/plugins/out_es/es.c#L412 here is the code that need to be fixed. I wish i can make PR, but i am not familiar with C
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.