Create index pattern via Kibana API

Closes #216
parent 36f983b4
......@@ -32,4 +32,4 @@ script:
- docker-compose exec -T elasticsearch bin/init_sg.sh
- docker-compose logs
- curl --retry 10 --retry-delay 5 -D- http://localhost:9200/ -u kibanaserver:kibanaserver
- curl --retry 10 --retry-delay 5 -I http://localhost:5601/
- curl --retry 10 --retry-delay 5 -D- http://localhost:5601/api/status
......@@ -133,16 +133,27 @@ about the index pattern configuration.
#### On the command line
Run this command to create a Kibana index pattern:
Authenticate against Kibana:
```console
$ curl -XPUT -D- 'http://localhost:9200/.kibana/doc/index-pattern:docker-elk' \
$ curl -XPOST -D- 'http://localhost:5601/api/v1/auth/login' \
-c /tmp/sg_cookies \
-H 'Content-Type: application/json' \
-u kibanaserver:kibanaserver \
-d '{"type": "index-pattern", "index-pattern": {"title": "logstash-*", "timeFieldName": "@timestamp"}}'
-H 'kbn-version: 6.1.0' \
-d '{"username":"kibanaserver","password":"kibanaserver"}'
```
This will automatically be marked as the default index pattern as soon as the Kibana UI is opened for the first time.
Create an index pattern via the Kibana API:
```console
$ curl -XPOST -D- 'http://localhost:5601/api/saved_objects/index-pattern' \
-b /tmp/sg_cookies \
-H 'Content-Type: application/json' \
-H 'kbn-version: 6.1.0' \
-d '{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'
```
The created pattern will automatically be marked as the default index pattern as soon as the Kibana UI is opened for the first time.
## Configuration
......
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