-
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
Unify dashboard exporter tools #9097
Unify dashboard exporter tools #9097
Conversation
@@ -213,6 +213,8 @@ https://github.com/elastic/beats/tree/master/dev-tools/cmd/dashboards[dev-tools] | |||
for exporting Kibana 5.x dashboards. See the dev-tools | |||
https://github.com/elastic/beats/tree/master/dev-tools/README.md[readme] for more info. | |||
|
|||
Alternatively, if the scripts above are not available, you can use your Beat binary to export Kibana 6.0 dashboards or later. |
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.
Will this PR be backported? If not, we could remove everything related to 5.x
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.
Yes, it is planned to as the label suggests.
b2f0a30
to
52b1fac
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.
good work @kvch and thanks for adding integration tests. I have added a few minors things.
I see we test for happy path in the integration tests could we add tests for non-happy-path like when dashboard don't exist?
I added more E2E tests which cover requesting unknown dashboards and invalid files. |
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.
Added a note about my mistake in parsing URL :(
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // ignore expired SSL certificates | ||
u, err := url.Parse(*kibanaURL) | ||
if err != nil { | ||
log.Fatalf("Error parsing Kibana URL: %v", err) |
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 a mistake, url.Parse
or url.ParseRequestURL
is well really bad see for yourself:
https://play.golang.org/p/9NAU0-sasfT
I think we have to come up with something better, maybe we already have in other outputs.
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.
In elasticsearch output url.Parse
is used. Looking at the codebase, everytime we connect to something url.Parse
is used. I think it is good enough.
If I remember correctly the |
@ruflin That's exactly how it worked. I added the option |
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.
👍 LGTM, I've looked at the CI this is a metricbeat/kafka docker issue.. nothing that this PR introduce.
6b096de
to
ee19147
Compare
Added forgotten changelog entry. |
The existing `export_dashboards.go` and the command `export dashboards` are unified, using the same code and slightly different logic. Configuration of `export_dashboards` is done using the following command line options: `-kibana`, `-space`, `-output`, `-quiet` and `-index-pattern`. The last flag is an odd one out, because it is part of the script, but its value is never used. So far no one complained, so I did not port it. The default value of that flag is the same in case of both methods. Configuration the Kibana client of `export dashboard` is read from the config of the Beat. Thus, Kibana-related flags are not part of its CLI. By default `export dashboard` does not decode the exported dashboard. If flag `-decode` passed to the command, the dashboard is decoded. export dashboards from a dashboards.yml ``` $ ./filebeat export dashboard -yml path/to/dashboards.yml -decode $ go run dev-tools/cmd/dashboards/export_dashboards.go -yml path/to/dashboards.yml ``` export a dashboard with an id and print to stdout ``` $ ./filebeat export dashboard -id {uuid} -decode $ go run dev-tools/cmd/dashboards/export_dashboards.go -dashboard {uuid} ``` (cherry picked from commit 1411852)
The existing `export_dashboards.go` and the command `export dashboards` are unified, using the same code and slightly different logic. Configuration of `export_dashboards` is done using the following command line options: `-kibana`, `-space`, `-output`, `-quiet` and `-index-pattern`. The last flag is an odd one out, because it is part of the script, but its value is never used. So far no one complained, so I did not port it. The default value of that flag is the same in case of both methods. Configuration the Kibana client of `export dashboard` is read from the config of the Beat. Thus, Kibana-related flags are not part of its CLI. By default `export dashboard` does not decode the exported dashboard. If flag `-decode` passed to the command, the dashboard is decoded. export dashboards from a dashboards.yml ``` $ ./filebeat export dashboard -yml path/to/dashboards.yml -decode $ go run dev-tools/cmd/dashboards/export_dashboards.go -yml path/to/dashboards.yml ``` export a dashboard with an id and print to stdout ``` $ ./filebeat export dashboard -id {uuid} -decode $ go run dev-tools/cmd/dashboards/export_dashboards.go -dashboard {uuid} ``` (cherry picked from commit 1411852)
The existing
export_dashboards.go
and the commandexport dashboards
are unified, using the same code and slightly different logic. Configuration ofexport_dashboards
is done using the following command line options:-kibana
,-space
,-output
,-quiet
and-index-pattern
. The last flag is an odd one out, because it is part of the script, but its value is never used. So far no one complained, so I did not port it. The default value of that flag is the same in case of both methods.Configuration the Kibana client of
export dashboard
is read from the config of the Beat. Thus, Kibana-related flags are not part of its CLI.By default
export dashboard
does not decode the exported dashboard. If flag-decode
passed to the command, the dashboard is decoded.Equivalent commands
export dashboards from a dashboards.yml
export a dashboard with an id and print to stdout
The interface of
export dashboard
is different than in the previous PR, because I wanted to follow existing methods and documentation.TODO
export dashboard
option to dev docs