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

Support dashboard loading without Elasticsearch #5653

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di

*Affecting all Beats*

- Support dashboard loading without Elasticseach {pull}5653[5653]

*Auditbeat*

- Changed `audit.file.path` to be a multi-field so that path is searchable. {pull}5625[5625]
Expand Down
3 changes: 3 additions & 0 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,9 @@ output.elasticsearch:
# dashboards and index pattern. Example: testbeat-*
#setup.dashboards.index:

# Force loading of dashboards using the Kibana API without querying Elasticsearch for the version
#always_kibana: false
Copy link
Contributor

Choose a reason for hiding this comment

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

@kvch Should this be prefixed by setup.dashboards.?


#============================== Template =====================================

# A template is used to set the mapping in Elasticsearch
Expand Down
3 changes: 3 additions & 0 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,9 @@ output.elasticsearch:
# dashboards and index pattern. Example: testbeat-*
#setup.dashboards.index:

# Force loading of dashboards using the Kibana API without querying Elasticsearch for the version
#always_kibana: false

#============================== Template =====================================

# A template is used to set the mapping in Elasticsearch
Expand Down
3 changes: 3 additions & 0 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,9 @@ output.elasticsearch:
# dashboards and index pattern. Example: testbeat-*
#setup.dashboards.index:

# Force loading of dashboards using the Kibana API without querying Elasticsearch for the version
#always_kibana: false

#============================== Template =====================================

# A template is used to set the mapping in Elasticsearch
Expand Down
3 changes: 3 additions & 0 deletions libbeat/_meta/config.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ output.elasticsearch:
# dashboards and index pattern. Example: testbeat-*
#setup.dashboards.index:

# Force loading of dashboards using the Kibana API without querying Elasticsearch for the version
#always_kibana: false

#============================== Template =====================================

# A template is used to set the mapping in Elasticsearch
Expand Down
4 changes: 3 additions & 1 deletion libbeat/dashboards/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ type Config struct {
URL string `config:"url"`
OnlyDashboards bool `config:"only_dashboards"`
OnlyIndex bool `config:"only_index"`
AlwaysKibana bool `config:"always_kibana"`
}

var defaultConfig = Config{
KibanaIndex: ".kibana",
KibanaIndex: ".kibana",
AlwaysKibana: false,
}
var (
defaultDirectory = "kibana"
Expand Down
20 changes: 15 additions & 5 deletions libbeat/dashboards/dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ func ImportDashboards(beatName, hostname, homePath string,
return err
}

if kibanaConfig == nil {
kibanaConfig = common.NewConfig()
}

if esConfig == nil && dashConfig.AlwaysKibana {
return setupAndImportDashboardsViaKibana(hostname, kibanaConfig, &dashConfig, msgOutputter)
}

esLoader, err := NewElasticsearchLoader(esConfig, &dashConfig, msgOutputter)
if err != nil {
return fmt.Errorf("fail to create the Elasticsearch loader: %v", err)
Expand All @@ -48,10 +56,6 @@ func ImportDashboards(beatName, hostname, homePath string,

logp.Info("For Elasticsearch version >= 6.0.0, the Kibana dashboards need to be imported via the Kibana API.")

if kibanaConfig == nil {
kibanaConfig = common.NewConfig()
}

// In Cloud, the Kibana URL is different than the Elasticsearch URL,
// but the credentials are the same.
// So, by default, use same credentials for connecting to Kibana as to Elasticsearch
Expand All @@ -62,7 +66,13 @@ func ImportDashboards(beatName, hostname, homePath string,
kibanaConfig.SetString("password", -1, esLoader.client.Password)
}

kibanaLoader, err := NewKibanaLoader(kibanaConfig, &dashConfig, hostname, msgOutputter)
return setupAndImportDashboardsViaKibana(hostname, kibanaConfig, &dashConfig, msgOutputter)
}

func setupAndImportDashboardsViaKibana(hostname string, kibanaConfig *common.Config,
dashboardsConfig *Config, msgOutputter MessageOutputter) error {

kibanaLoader, err := NewKibanaLoader(kibanaConfig, dashboardsConfig, hostname, msgOutputter)
if err != nil {
return fmt.Errorf("fail to create the Kibana loader: %v", err)
}
Expand Down
6 changes: 6 additions & 0 deletions libbeat/docs/dashboardsconfig.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,9 @@ is `".kibana"`

The Elasticsearch index name. This setting overwrites the index name defined
in the dashboards and index pattern. Example: `"testbeat-*"`

[float]
==== `setup.dashboards.always_kibana`

Force loading of dashboards using the Kibana API without querying Elasticsearch for the version
The default is `false`.
3 changes: 3 additions & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,9 @@ output.elasticsearch:
# dashboards and index pattern. Example: testbeat-*
#setup.dashboards.index:

# Force loading of dashboards using the Kibana API without querying Elasticsearch for the version
#always_kibana: false

#============================== Template =====================================

# A template is used to set the mapping in Elasticsearch
Expand Down
3 changes: 3 additions & 0 deletions packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,9 @@ output.elasticsearch:
# dashboards and index pattern. Example: testbeat-*
#setup.dashboards.index:

# Force loading of dashboards using the Kibana API without querying Elasticsearch for the version
#always_kibana: false

#============================== Template =====================================

# A template is used to set the mapping in Elasticsearch
Expand Down
3 changes: 3 additions & 0 deletions winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ output.elasticsearch:
# dashboards and index pattern. Example: testbeat-*
#setup.dashboards.index:

# Force loading of dashboards using the Kibana API without querying Elasticsearch for the version
#always_kibana: false

#============================== Template =====================================

# A template is used to set the mapping in Elasticsearch
Expand Down