Use import/export API for loading dashboards and index pattern#4413
Use import/export API for loading dashboards and index pattern#4413tsg merged 2 commits intoelastic:masterfrom
Conversation
|
@monicasarbu Should this also go under |
|
@ruflin This PR is at a very early stage. My plan is to move the import and export functionality to libbeat and then create a script to use it. For now it's just a script (that I will remove) only for testing the import/export API. |
e85f3e2 to
8e271db
Compare
9160e6f to
a294e57
Compare
0efa466 to
9446eff
Compare
|
I think we need to add |
|
@tsg Fixed, thanks! |
libbeat/dashboards/dashboards.go
Outdated
There was a problem hiding this comment.
Seems that etiher err == nil or kibanaLoader != nil, so I think the second check here is not needed and it doesn't follow our usual error checking pattern.
libbeat/dashboards/kibana_loader.go
Outdated
There was a problem hiding this comment.
Seems that there's nothing to do on Close. Then you can just delete the comment, not to confuse future readers.
libbeat/setup/kibana/client.go
Outdated
There was a problem hiding this comment.
Minor issue, but this extra empty line could be deleted.
libbeat/setup/kibana/client.go
Outdated
There was a problem hiding this comment.
Hmm, does this mean that HTTPS is always enabled? The comment looks like "insecure by default", we have to be careful with this.
There was a problem hiding this comment.
This is something that we need to address in the next PR.
libbeat/dashboards/kibana_loader.go
Outdated
There was a problem hiding this comment.
"enabled" is forced to true here, but I didn't see where it's actually checked. We should make sure that disabling with enabled: false works.
libbeat/setup/kibana/client.go
Outdated
There was a problem hiding this comment.
We generally avoid logp.Err immediately followed by returning an error.
libbeat/setup/kibana/client.go
Outdated
There was a problem hiding this comment.
Would be perhaps better to write the "fail to parse URL" error in the addPath method?
libbeat/setup/kibana/client.go
Outdated
There was a problem hiding this comment.
Return error instead of logging.
libbeat/setup/kibana/client.go
Outdated
libbeat/setup/kibana/client.go
Outdated
There was a problem hiding this comment.
Please add the result to the error message.
libbeat/setup/kibana/client.go
Outdated
libbeat/setup/kibana/client.go
Outdated
There was a problem hiding this comment.
200 might be too strict here. Maybe > 300?
libbeat/dashboards/kibana_loader.go
Outdated
There was a problem hiding this comment.
exportAPI doesn't seem to be used.
libbeat/scripts/Makefile
Outdated
There was a problem hiding this comment.
Could we get export-dashboards and import-dashboards targets based on the go code? I'm good with follow up PR for them.
There was a problem hiding this comment.
It's a bit tricky for export-dashboards as we need to pass the list of ids that we want to export in one json file. Usually you would run it to export the dashboards for a module, not for a Beat. Added to the TODO list in the meta issue: #4409
00523db to
6139a64
Compare
|
I think it would make sense to add |
e60dafc to
afaaeeb
Compare
ruflin
left a comment
There was a problem hiding this comment.
If we update / improve dashboards for 6.x in the future, will we also update 5.x dashboards? Probably best would be that we "freeze" them as they are and improvements / new features only are available for 6.x?
.gitignore
Outdated
There was a problem hiding this comment.
I would move this to a local ignore file in dashboards
There was a problem hiding this comment.
Good idea, done.
auditbeat/auditbeat.reference.yml
Outdated
There was a problem hiding this comment.
Remove spaces in front of config options for easier uncommenting. Also below.
libbeat/dashboards/dashboards.go
Outdated
There was a problem hiding this comment.
This will break with release 10.* :-)
a5b8147 to
1496049
Compare
|
@ruflin yes, that's the plan to freeze the 5.x dashboards and improve only the 6.x dashboards. |
218c11b to
57d4a31
Compare
If the Elasticsearch version is older than 6.x, then the dashboards are loaded directly into Elasticsearch. The old dashboards are moved to the 5.x directory.
c0f1f8b to
25f5c73
Compare
|
jenkins, test it |
This is trying to implement #4409.
The Beats 6.x dashboards are different than the Beats 5.x dashboards and are not compatible. Thanks to the Kibana API, we can have a json file for each module instead of multiple json files (for dashboards, visualizations, searches, etc). Thus, the way to import/export dashboards differs from the Kibana version that should be equal to the Elasticsearch version.
The json file containing the index-pattern contain as
versionthe Beat version, and the dashboards contain asversionthe Kibana version that exported the dashboards.If Kibana version is 5.x and older:
_meta/kibana/5.xdirectoryIf Kibana version is 6.x and greater:
setup.kibana*settings._meta/kibana/defaultdirectory for each Beat module.In order to make use of the import/export API the following changes are needed:
_meta/kibana/5.xdirectoryand create a new directory under
_meta/kibana/defaultfor the new dashboards and index-pattern that are importable via the Kibana APImake updateNote: The older dashboards are moved to the
_meta/kibana/5.xdirectory only for Metricbeat for now.