How can I overwrite default index pattern name while importing dashboards for beats

I've installed Filebeat and Metricbeat via YUM repo. And everything runs ok.

now, I have a problem to overwrite default index pattern name. no matter I use ./script/import_dashboards -i
or dashboards.index: customize-metric-* in XXXbeat.yml. it's always import the default pattern name like metricbeat-*

anybody else can help me out? than you very much

Hi @zaqweb,

Could you share info about your setup (beats & elasticsearch version) + some logs of what you get when you run those commands?

Best regards

hey exekias, I'm using latest version 5.4.0

I removed all index patterns in kibana, then I try to run below command

$ ./scripts/import_dashboards -es http://10.0.96.162:9200 -i portal-metric-* -file /app/elastic/beats-dashboards-5.4.0.zip
Create temporary directory /tmp/tmp082238117
Unzip archive /tmp/tmp082238117
Importing Kibana from /tmp/tmp082238117/beats-dashboards-5.4.0/filebeat
Importing Kibana from /tmp/tmp082238117/beats-dashboards-5.4.0/heartbeat
Importing Kibana from /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat
Import directory /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/index-pattern
Change index in index-pattern metricbeat-*
Import index to /.kibana/index-pattern/metricbeat-* from /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/index-pattern/metricbeat.json

Import directory /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/dashboard
Import dashboard /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/dashboard/66881e90-0006-11e7-bf7f-c9acc3d3e306.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/e784dc50-0005-11e7-bf7f-c9acc3d3e306.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/67e88e60-0005-11e7-aaf1-b342e4b94bb0.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/0f506420-0006-11e7-bf7f-c9acc3d3e306.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/67e88e60-0005-11e7-aaf1-b342e4b94bb0.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/1a99f2b0-0006-11e7-bf7f-c9acc3d3e306.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/67e88e60-0005-11e7-aaf1-b342e4b94bb0.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/45a00c10-0006-11e7-bf7f-c9acc3d3e306.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/67e88e60-0005-11e7-aaf1-b342e4b94bb0.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/1eda2280-0008-11e7-82f3-2f380154876c.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/1ede99e0-0009-11e7-8cd4-73b67e9e3f3c.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/4c36c420-000a-11e7-8cd4-73b67e9e3f3c.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/a2175300-000a-11e7-b001-85aac4878445.json
Import dashboard /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/dashboard/CPU-slash-Memory-per-container.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Container-CPU-usage.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/System-Navigation.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Container-Memory-stats.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Container-Block-IO.json
Import dashboard /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/dashboard/Metricbeat-Apache-HTTPD-server-status.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Apache-HTTPD-CPU.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Apache-HTTPD.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Apache-HTTPD-Hostname-list.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Apache-HTTPD.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Apache-HTTPD-Load1-slash-5-slash-15.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Apache-HTTPD.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Apache-HTTPD-Scoreboard.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Apache-HTTPD.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Apache-HTTPD-Total-accesses-and-kbytes.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Apache-HTTPD.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Apache-HTTPD-Uptime.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Apache-HTTPD.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Apache-HTTPD-Workers.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Apache-HTTPD.json
Import dashboard /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/dashboard/Metricbeat-Docker.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Docker-containers.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Metricbeat-Docker.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Docker-Number-of-Containers.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Metricbeat-Docker.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Docker-containers-per-host.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Metricbeat-Docker.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Docker-images-and-names.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Metricbeat-Docker.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Docker-CPU-usage.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Docker-memory-usage.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/Docker-Network-IO.json

.....
.....
.....
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/System-stats.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/System-load.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Load-stats.json
Import visualization /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/visualization/CPU-Usage.json
Import search /tmp/tmp082238117/beats-dashboards-5.4.0/metricbeat/search/Cpu-stats.json
Importing Kibana from /tmp/tmp082238117/beats-dashboards-5.4.0/packetbeat
Importing Kibana from /tmp/tmp082238117/beats-dashboards-5.4.0/winlogbeat

I removed some importing msg in the middle

I'm using -i portal-metric-* wanna try to overwrite default index pattern name metricbeat-*

but it's not take effect, the default pattern was still imported

I think my problem is same as Import Dashboards on non standard indexes

Having the exact same issue. Using the -i is actually not doing anything and the index pattern is still created as metricbeat-*

You can not change the index pattern in the dashboards by the importer, as these are pure json documents to be index in the .kibana index. You have to adapt the dashboards: download, unpack and update the dashboards documents (e.g. use sed to update all ocurences of metricbeat-*to portal-metric-*). Install updated dashboards using ./scripts/import_dashboards.

Already installed dashboards/searches can be update from within Kibana in Managed Objects.

So why does the importar have the -i flag which is supposed to do exactly that?

Oh, wasn't aware of -i. The import is implemented here. Searching for cfg.Index, I see search objects and index mapping being update by the script, but then the updated index pattern is still stored in metricbeat-*. See this line: https://github.com/elastic/beats/blob/5.4/libbeat/dashboards/dashboards/importer.go#L306

Same happens in master.

Looks like a bug to me, but I'm not too familiar with the workarounds import_dashboards does apply. Can you open a bug report?

I'm going to close this question and have submitted a bug here https://github.com/elastic/beats/issues/4345

@zaqweb Thanks

This topic was automatically closed after 21 days. New replies are no longer allowed.