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

Disable migration aliases in index pattern #10478

Merged
merged 2 commits into from
Feb 4, 2019

Conversation

ruflin
Copy link
Contributor

@ruflin ruflin commented Feb 1, 2019

The migration aliases should not show up in the index pattern if migration.enabled: false. For this to happen, the Kibana index pattern must be generated on the fly instead of packaging it with each Beat. This PR introduces the generation of the index pattern when Kibana data is loaded.

APM still needs the index pattern as file. For this the export command index-pattern was added. It will print the index pattern to the standard out:

./metricbeat export index-pattern > pattern.json

The commands to generate the index pattern in the dev environment were removed.

For checking if aliases are supported, the Kibana version is checked. Fully accurate would be to check the Elasticsearch version as it depends on the ES version in the end and not Kibana. But it's assume that in general the same minor version is used. The reason not Elasticsearch is checked as it would potentially require additional config options and adds unnecessary complexity.

For the index pattern the internal fields.go are used. Even if fields.yml is configured still fields.go is used. This is the same behavior as we had so far when the index pattern was generated. It could be improved in the future to also support a fields.yml for the generation if needed.

In general this PR tried to change as little code as possible. The code and tests around the Kibana dashboard generation and index pattern generation is not very nice. One reason is that it also contains old logic which was used for previous versions but also has the ability to read dashboards from a zip file. Because of this all the old capabilities have to stay in the code for now. The code should be cleaned up at a later stage.

Further changes:

  • Added system tests to Filebeat to check for correct content in index pattern when migration is enabled.
  • Fix double generation of common.yml in Metricbeat. It seems some changes in the past caused that the common.yml file was contained in two fields.go files in Metricbeat

@ruflin ruflin added in progress Pull request is currently in progress. libbeat labels Feb 1, 2019
@ruflin ruflin requested a review from a team as a code owner February 1, 2019 09:45
libbeat/dashboards/kibana_loader.go Show resolved Hide resolved
libbeat/dashboards/kibana_loader.go Show resolved Hide resolved
libbeat/dashboards/importer.go Show resolved Hide resolved
libbeat/dashboards/dashboards.go Show resolved Hide resolved
libbeat/cmd/export/index_pattern.go Show resolved Hide resolved
@ruflin ruflin force-pushed the index-pattern-generation-cleanup branch from 5e1f90a to 6bebce2 Compare February 4, 2019 07:56
@ruflin ruflin changed the title [WIP] Index pattern generation cleanup Index pattern generation cleanup Feb 4, 2019
@ruflin ruflin added review and removed in progress Pull request is currently in progress. labels Feb 4, 2019
@ruflin ruflin force-pushed the index-pattern-generation-cleanup branch from 6bebce2 to 5b4c346 Compare February 4, 2019 08:16
@ruflin ruflin changed the title Index pattern generation cleanup Disable migration aliases in index pattern Feb 4, 2019
@ruflin ruflin force-pushed the index-pattern-generation-cleanup branch from 5b4c346 to 856674c Compare February 4, 2019 08:20
@@ -21,6 +21,7 @@ The list below covers the major changes between 7.0.0-alpha2 and master only.
==== Breaking changes
- Outputs receive Index Manager as additional parameter. The index manager can
be used to create an index selector. {pull}10347[10347]
- Remove support for loading dashboards to Elasticsearch 5. {pull}10451[10451]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was missing in a previous PR.

@ruflin ruflin added Team:Integrations Label for the Integrations team v7.0.0-beta1 labels Feb 4, 2019
Copy link
Contributor

@simitt simitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work for the APM usecase, thanks for adding the export cmd.

The migration aliases should not show up in the index pattern if `migration.enabled: false`. For this to happen, the Kibana index pattern must be generated on the fly instead of packaging it with each Beat. This PR introduces the generation of the index pattern when Kibana data is loaded.

APM still needs the index pattern as file. For this the export command `index-pattern` was added. It will print the index pattern to the standard out:

```
./metricbeat export index-pattern > pattern.json
```

The commands to generate the index pattern in the dev environment were removed.

For checking if aliases are supported, the Kibana version is checked. Fully accurate would be to check the Elasticsearch version as it depends on the ES version in the end and not Kibana. But it's assume that in general the same minor version is used. The reason not Elasticsearch is checked as it would potentially require additional config options and adds unnecessary complexity.

For the index pattern the internal fields.go are used. Even if fields.yml is configured still fields.go is used. This is the same behavior as we had so far when the index pattern was generated. It could be improved in the future to also support a fields.yml for the generation if needed.

In general this PR tried to change as little code as possible. The code and tests around the Kibana dashboard generation and index pattern generation is not very nice. One reason is that it also contains old logic which was used for previous versions but also has the ability to read dashboards from a zip file. Because of this all the old capabilities have to stay in the code for now. The code should be cleaned up at a later stage.

Further changes:

* Added system tests to Filebeat to check for correct content in index pattern when migration is enabled.
* Fix double generation of common.yml in Metricbeat. It seems some changes in the past caused that the common.yml file was contained in two fields.go files in Metricbeat
@ruflin ruflin force-pushed the index-pattern-generation-cleanup branch from 253c0a1 to c3341db Compare February 4, 2019 12:39
@ruflin ruflin self-assigned this Feb 4, 2019
@ruflin ruflin merged commit 7277ac4 into elastic:master Feb 4, 2019
@ruflin ruflin deleted the index-pattern-generation-cleanup branch February 4, 2019 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants