Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 3bfdb3f

Browse files
Add files via upload
1 parent 1c27e9f commit 3bfdb3f

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Creating and Importing own Kibana Elements in the SecureCodeBox
2+
3+
This article shows how you can save your own kibana searches, visualizations and dashboards and load them at startup of the SecureCodeBox.
4+
5+
In order to save your own visualizations, after creating them in Kibana, you need the `elasticdump` tool, available [here](https://github.com/taskrabbit/elasticsearch-dump/blob/master/bin/elasticdump). This is a very simple and easy to use tool to export your elasticsearch data into a json file.
6+
7+
For our own visualizations and dashboards we exported the whole `.kibana` index with `elasticdump`. The command looks as follows:
8+
9+
```
10+
elasticdump --input=http://<eshost:port>/.kibana --output=kibana-imports.json
11+
```
12+
where `<eshost:port>` needs to be replaced with the elasticsearch address.
13+
14+
This command produces the `kibana-imports.json` file in the current directory which includes all information about the `.kibana` index.
15+
16+
Unfortunately this file needs a little bit of refactoring due to the fact that elasticdump produces more than one top-level JSON elements. For the import mechanism in the SecureCodeBox to work properly, the file has to be converted into a JSON array including all the elements.
17+
18+
The conversion is really simple and works as following:
19+
20+
Originally the file looks like this:
21+
22+
```
23+
{"_index":".kibana", "_type":"doc", "_source":{"type":"visualization", "more":"stuff"}}
24+
{"_index":".kibana", "_type":"doc", "_source":{"type":"index-pattern", "more":"stuff"}}
25+
```
26+
27+
We wrap everything inside an array and put a comma at the end of each line.
28+
The final result looks like this:
29+
30+
```
31+
[
32+
{"_index":".kibana", "_type":"doc", "_source":{"type":"visualization", "more":"stuff"}},
33+
{"_index":".kibana", "_type":"doc", "_source":{"type":"index-pattern", "more":"stuff"}}
34+
]
35+
```
36+
37+
The resulting file needs to be put into the resources folder of the `elasticsearch-persistenceprovider` directory (*scb-persistenceproviders/elasticsearch-persistenceprovider/src/main/resources*) and must have the name `kibana-imports.json`, otherwise it will be ignored.
38+
39+
After a new start of the SecureCodeBox the visualizations and dashboards will be loaded with the first initialization of the `ElasticSearchPersistenceProvider` (that means at least one scan must be run and there must be data inside elasticsearch).

0 commit comments

Comments
 (0)