以编程方式设置Kibana的默认索引模式 [英] Programmatically set Kibana's default index pattern
问题描述
Elasticsearch将所有Kibana元数据信息存储在 .kibana
索引下。 Kibana配置如 defaultIndex
和提前设置存储在index / type / id .kibana / config / 4.5.0
之下 4.5.0
是您的Kibana的版本。
所以您可以通过以下步骤实现设置或更改defaultIndex:
- 将索引添加到您要设置为defaultIndex的Kibana。您可以执行以下命令:
curl -XPUT http://< es node>:9200 / .kibana / index-pattern / your_index_name -d'{title:your_index_name,timeFieldName:timestampFieldNameInYourInputData}'
-
更改您的Kibana配置以将之前添加的索引设置为defaultIndex:
curl -XPUT http: //< es node>:9200 / .kibana / config / 4.5.0 -d'{defaultIndex:your_index_name}'
/ li>
注意:请确保您提供正确的index_name,有效的时间戳字段名称和kibana版本,例如,如果正在使用kibana 4.1.1,那么你可以用4.1.1替换4.5.0。
希望这个帮助!
A Kibana newbie would like to know how to set default index pattern programmatically rather than setting it on the Kibana UI through web browser during the first time viewing Kibana UI as mentioned on page https://www.elastic.co/guide/en/kibana/current/setup.html
Elasticsearch stores all Kibana metadata information under .kibana
index. Kibana configurations like defaultIndex
and advance settings are stored under index/type/id .kibana/config/4.5.0
where 4.5.0
is the version of your Kibana.
So you can achieve setting up or changing defaultIndex with following steps:
Add index to Kibana which you want to set as defaultIndex. You can do that by executing following command:
curl -XPUT http://<es node>:9200/.kibana/index-pattern/your_index_name -d '{"title" : "your_index_name", "timeFieldName": "timestampFieldNameInYourInputData"}'
Change your Kibana config to set index added earlier as defaultIndex:
curl -XPUT http://<es node>:9200/.kibana/config/4.5.0 -d '{"defaultIndex" : "your_index_name"}'
Note: Make sure your giving correct index_name everywhere, valid timestamp field name and kibana version for example if you are using kibana 4.1.1 then you can replace 4.5.0 with 4.1.1 .
Hope this Helps!
这篇关于以编程方式设置Kibana的默认索引模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!