Commit 1a55dd9b authored by Mathias Ettinger's avatar Mathias Ettinger

Fix automatically adding logstash index pattern into Kibana

parent 568a0cbf
......@@ -197,8 +197,13 @@ fail_index_pattern(){
create_index_pattern(){
db_get opensand-collector/elasticsearch/port
ELASTICSEARCH_PORT="${RET}"
curl -XPUT http://localhost:${ELASTICSEARCH_PORT}/.kibana/index-pattern/logstash_default -d '{"title" : "logstash*", "timeFieldName": "@timestamp"}'
curl -XPUT http://localhost:${ELASTICSEARCH_PORT}/.kibana/config/6.2.4 -d '{"defaultIndex" : "logstash_default"}'
# Create index as if Kibana was used through a browser
curl -XPUT http://localhost:${ELASTICSEARCH_PORT}/.kibana/?pretty -H 'Content-Type: application/json' -d '{"mappings":{"doc":{"dynamic":"strict","properties":{"config":{"dynamic":"true","properties":{"buildNum":{"type":"keyword"},"defaultIndex":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}},"dashboard":{"properties":{"description":{"type":"text"},"hits":{"type":"integer"},"kibanaSavedObjectMeta":{"properties":{"searchSourceJSON":{"type":"text"}}},"optionsJSON":{"type":"text"},"panelsJSON":{"type":"text"},"refreshInterval":{"properties":{"display":{"type":"keyword"},"pause":{"type":"boolean"},"section":{"type":"integer"},"value":{"type":"integer"}}},"timeFrom":{"type":"keyword"},"timeRestore":{"type":"boolean"},"timeTo":{"type":"keyword"},"title":{"type":"text"},"uiStateJSON":{"type":"text"},"version":{"type":"integer"}}},"index-pattern":{"properties":{"fieldFormatMap":{"type":"text"},"fields":{"type":"text"},"intervalName":{"type":"keyword"},"notExpandable":{"type":"boolean"},"sourceFilters":{"type":"text"},"timeFieldName":{"type":"keyword"},"title":{"type":"text"}}},"search":{"properties":{"columns":{"type":"keyword"},"description":{"type":"text"},"hits":{"type":"integer"},"kibanaSavedObjectMeta":{"properties":{"searchSourceJSON":{"type":"text"}}},"sort":{"type":"keyword"},"title":{"type":"text"},"version":{"type":"integer"}}},"server":{"properties":{"uuid":{"type":"keyword"}}},"timelion-sheet":{"properties":{"description":{"type":"text"},"hits":{"type":"integer"},"kibanaSavedObjectMeta":{"properties":{"searchSourceJSON":{"type":"text"}}},"timelion_chart_height":{"type":"integer"},"timelion_columns":{"type":"integer"},"timelion_interval":{"type":"keyword"},"timelion_other_interval":{"type":"keyword"},"timelion_rows":{"type":"integer"},"timelion_sheet":{"type":"text"},"title":{"type":"text"},"version":{"type":"integer"}}},"type":{"type":"keyword"},"updated_at":{"type":"date"},"url":{"properties":{"accessCount":{"type":"long"},"accessDate":{"type":"date"},"createDate":{"type":"date"},"url":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":2048}}}}},"visualization":{"properties":{"description":{"type":"text"},"kibanaSavedObjectMeta":{"properties":{"searchSourceJSON":{"type":"text"}}},"savedSearchId":{"type":"keyword"},"title":{"type":"text"},"uiStateJSON":{"type":"text"},"version":{"type":"integer"},"visState":{"type":"text"}}}}}}}'
# Add index pattern
curl -XPUT http://localhost:${ELASTICSEARCH_PORT}/.kibana/doc/index-pattern:logstash_default -H 'Content-Type: application/json' -d '{"index-pattern": {"title" : "logstash*", "timeFieldName": "@timestamp"}, "type": "index-pattern"}'
# Configure added index pattern as the default one
curl -XPUT http://localhost:${ELASTICSEARCH_PORT}/.kibana/doc/config:6.2.4 -H 'Content-Type: application/json' -d '{"config": {"defaultIndex" : "logstash_default"}, "type": "config"}'
}
create_kibana_index_pattern(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment