Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch output - dots in key names #1188

Closed
cert-lv opened this issue Feb 13, 2018 · 11 comments
Closed

Elasticsearch output - dots in key names #1188

cert-lv opened this issue Feb 13, 2018 · 11 comments
Labels
component: bots feature request Indicates new feature requests
Milestone

Comments

@cert-lv
Copy link
Contributor

cert-lv commented Feb 13, 2018

Hi,

Modern Elasticsearch supports dots in key names. Currently an output bot does a replacement ("." to "_" by default) without any options.

One solution could be to add a bool config switch to enable/disable the replacement. (Somewhen in the future, probably, this func could be removed at all).

Fast solution is to replace dots with dots.

Also this ticked is opened as you wanted to change the default/name of the parameter.

@cert-lv
Copy link
Contributor Author

cert-lv commented Feb 14, 2018

extra keys are also concatenated with "_" without choice.
Result extra.somekey is allowed now, and is kind of more JSON-ish.

@ghost ghost added this to the 1.1.0 milestone Feb 28, 2018
@ghost ghost added feature request Indicates new feature requests component: bots labels Feb 28, 2018
@navtej
Copy link
Contributor

navtej commented Mar 2, 2018

@cert-lv last i checked ES stopped allowing "." in key name. You can use the replacement_char option, set its value to '.' and you should be good to go, if your ES instance supports '.''s. IIRC after 1.X they dropped support for dots. Even before that the usage of dots was discouraged. However I haven't been following ES for a while now. May be that changed. Could you please let us know your ES version?

@cert-lv
Copy link
Contributor Author

cert-lv commented Mar 2, 2018

Hello, @navtej ,

Yes, I remember the period when dots were not allowed. Now we use ES 6.x (with 5.x it was
Ok too), but it seems dots were fixed a long time ago: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/dots-in-names.html

In short - Elasticsearch 2.x does not support dots-to-object transformation and so dots in field names are not allowed in versions 2.0 - 2.3. In modern ES such fields are converted into multilevel objects.

@navtej
Copy link
Contributor

navtej commented Mar 2, 2018

@cert-lv does adding dot as replacement_char works for you?

@cert-lv
Copy link
Contributor Author

cert-lv commented Mar 5, 2018

@navtej, yes, as I've mentioned fast solution is to replace dots with dots, it works.

I've also noticed, that putting nothing in flatten_fields disables concatenation of extra fields with "_", so the second question is solved too.

But one more question - currently you put everything into one single ES indice, intelmq by default. May I send a Pull Request with a small fix to split indices into names like intelmq-MM-YYYY ? So users can manage/delete/backup indices by month.

@navtej
Copy link
Contributor

navtej commented Mar 5, 2018

@cert-lv please see this, https://github.com/navtej/intelmq/blob/latest/intelmq/bots/outputs/elasticsearch/output.py . it uses dynamic index based on date and time from time observation. I havent been able to make it generic because people may have vastly varied requirements.

@ghost ghost mentioned this issue Jun 5, 2018
@ghost ghost modified the milestones: 1.1.0, 1.2.0 Jun 28, 2018
@navtej
Copy link
Contributor

navtej commented Sep 5, 2018

I guess we can close this issue or we still have something open on it?

@ghost
Copy link

ghost commented Sep 5, 2018

IMHO what has been discussed/explained here should go to the bot's documentation.

And I suggest that the replacement char parameter could be made optional (handle nonexistence and empy) if it is not necessary anymore.

@ghost ghost modified the milestones: 1.2.0, 2.0.0, 2.1.0 Apr 9, 2019
@ghost ghost modified the milestones: 2.1.0, 2.2.0 Oct 25, 2019
@ghost
Copy link

ghost commented Dec 10, 2019

Anyone willing to update the documentation with the findings mentioned here?

@navtej
Copy link
Contributor

navtej commented Dec 10, 2019

@cert-lv do you want to take it up.

@cert-lv
Copy link
Contributor Author

cert-lv commented Dec 19, 2019

https://github.com/certtools/intelmq/blob/master/docs/Bots.md#elasticsearch-output-bot - seems to already contain the info regarding this issue, so I'll close it.

@cert-lv cert-lv closed this as completed Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: bots feature request Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

1 participant