dot to underscore replacement in ES output #708
Copy link
Copy link
Closed
Labels
Description
This code in es.c is replacing dots to underscores in keys (fileds name):
/*
* Sanitize key name, Elastic Search 2.x don't allow dots
* in field names:
*
* https://goo.gl/R5NMTr
*/
char *p = ptr_key;
char *end = ptr_key + key_size;
while (p != end) {
if (*p == '.') *p = '_';
p++;
}
This behavior relies on this article, that is applicable for Elastic 2.x.
But for Elastic 5.0 and higher dots are permitted again :). Actually Elastic Beats™ are using dot in field names, example: filebeat fields for kubernetes:.
So maybe it makes sense to have an option in es output "Replace dots in fields name"?
Reactions are currently unavailable
Activity
out_es: new 'replace_dots' option (#708)
edsiper commentedon Aug 8, 2018
@konstantin-kornienko-epam thanks for raising this topic and suggestion.
I've implemented the improvement through 6764ac7 commit.
thanks!
konstantin-kornienko-epam commentedon Aug 8, 2018
Wow! So fast, almost at speed of light ;) Thank you, Eduardo!
pack: output: added java_sql_timestamp, a format string used by amazo…
mabrarov commentedon Jun 14, 2023
Hi @edsiper and @PettitWesley,
Is there a chance to get the same feature for Forward plugin? I see #1305 and #1538 are closed 3 years ago but the new filter is still not implemented. The lack of this feature for Forward plugin (and for other output plugins) along with #1560 being still pending complicates communication of Fluent Bit with Elasticsearch cluster (consisting of multiple hosts) - we cannot use:
My team would like to use Fluent Bit (running as DaemonSet) for shipping logs from K8s to Elasticsearch cluster instead of Fluentd (running as DaemonSet), but so far Fluent Bit brings issues, which delay this migration.
Thank you.
PettitWesley commentedon Jun 14, 2023
@mabrarov my recommendation to unblock yourself is some sort of custom filter with lua or wasm should be able to remove dots:
mabrarov commentedon Jun 15, 2023
Hi @PettitWesley,
Thank you for quick reply and suggestion. I found #4651 and used this Lua script (which part is a script taken and slightly modified from #1305) in my Fluent Bit configuration to replace dots with underscores in problematic fields and to flatten some fields (which I use later in Fluentd to decide what Elasticsearch index to route request, it's required because respective Fluentd plugin cannot work with nested fields):
Fluent Bit configuration looks like:
IMHO, Lua scripting doesn't seem to be performant solution. Maybe I need to try Wasm plugin instead. Anyway thank you for your help.