-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Refactor index management #10347
Refactor index management #10347
Conversation
a95cabd
to
508e80a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@urso really good PR, I really like how you actually encapsulated all the logic inside the idxmgmt package, I found two things.
- There was a problem with the integration suite with your code in the
libbeat
command [go test -tags integration -cover -coverprofile /tmp/gotestcover-226034385 github.com/elastic/beats/libbeat/idxmgmt/ilm]: exit status 1
# github.com/elastic/beats/libbeat/idxmgmt/ilm
idxmgmt/ilm/eshandler_integration_test.go:28:2: cannot find package "github.com/satori/go.uuid" in any of:
/go/src/github.com/elastic/beats/vendor/github.com/satori/go.uuid (vendor tree)
/usr/local/go/src/github.com/satori/go.uuid (from $GOROOT)
/go/src/github.com/satori/go.uuid (from $GOPATH)
FAIL github.com/elastic/beats/libbeat/idxmgmt/ilm [setup failed]
- I will fix the issue when the
docker-compose logs
is shallowing the previous error.
goimports did select the wrong package :(. I fixed the import (and removed old dependency from my machine). Beats-CI and travis being green is somewhat worrysome. |
1862a0f
to
92a138b
Compare
@@ -0,0 +1,94 @@ | |||
// Licensed to Elasticsearch B.V. under one or more contributor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen similar functionality in go-txfile
. It is definitely a better approach for error handling compared to what Golang provides by default. Do you have any plans to consolidate error handling? E.g moving the functions to libbeat and leaving the error variables here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have some similar functionality in go-ucfg.
Do you have any plans to consolidate error handling?
92a138b
to
004832d
Compare
return status == 200, nil | ||
} | ||
|
||
func (h *esClientHandler) HasAlias(name string) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am looking forward to having an Elasticseach Golang client. I had to implement the same functions in the migration tool.
@@ -21,6 +21,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d | |||
- Rename `process.exe` to `process.executable` in add_process_metadata to align with ECS. {pull}9949[9949] | |||
- Import ECS change https://github.com/elastic/ecs/pull/308[ecs#308]: | |||
leaf field `user.group` is now the `group` field set. {pull}10275[10275] | |||
- Move output.elasticsearch.ilm settings to setup.ilm. {pull}10347[10347] | |||
- ILM will be available by default if Elasticsearch > 7.0 is used. {pull}10347[10347] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens for the OSS users? Should this be >= 7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, auto
is default and not true
... I assume this does the trick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, auto
does the trick.
12cb23e
to
a15d913
Compare
I have fixed that in #10380 |
type Alias struct { | ||
Name string | ||
Pattern string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3 ^
7e51210
to
8c29608
Compare
Jenkins, please test this. |
Jenkins, test this. |
The failures are not related to this change. |
Thanks for putting this PR up @urso! First experiences trying this out showed that the integration with the new supporters is pretty smooth! |
Changes: - introduce Index + ILM manager interfaces responsible for: - create ILM policy - create write alias - create and load template - separate interfaces for re-use: manager, apihandler - provide default API handler for elasticsearch.Client - Index + ILM support interfaces, that can be swapped out with custom implementation (still WIP) - Beat implementing custom managers have to decide on config file format - ILM settings have been moved to `ilm.setup` - Introduce `setup.ilm.enabled: auto` (new default) - Index manager will detect on connect to Elasticsearch if ILM can be enabled or not - Lazily chooses write alias or old-style index for publishing - Index Manager does not check ILM availabilty on startup, but on first connect (so to not block beats startup) - If Elasticsearch < 7.0, then `auto` defaults to false - If Elasticsearch > 7.0, then `auto` checks if ILM is available and enbaled - If `setup.ilm.enabled: true`, then fail check if version does not support ILM or ILM is disabled - Publisher pipeline does not use output package anymore to create an output, but a callback -> Beat instance itself creates output instances, passing IndexManager and other info to the output loader. - Outputs can use IndexManager in order to create the per event index selector - remove fragile manipulation of `common.Config` objects, that have been already partially parsed. - Ensure ILM can be setup if `setup.ilm.enabled: true`, but elasticsearch output is configured via Central Management Followup: update docs
Changes:
ilm.setup
setup.ilm.enabled: auto
(new default)auto
defaults to falseauto
checks if ILM is available and enbaledsetup.ilm.enabled: true
, then fail check if version does not support ILM or ILM is disabledcommon.Config
objects, that have been already partially parsed.setup.ilm.enabled: true
, but elasticsearch output is configured via Central ManagementFollowup: update docs