Skip to content

Commit 3af4a09

Browse files
ruflinjsoriano
andauthored
[Benchmark/Stream] Add getting started docs for elastic-package stream command (#1627)
The goal of these docs is that any engineer can quickly ingest some sample data. It is specially targeted on engineers working on Kibana and need sample data. --------- Co-authored-by: Jaime Soriano Pastor <[email protected]>
1 parent 7ce42ee commit 3af4a09

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

docs/howto/sample_data.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Use elastic-package to generate sample data
2+
3+
`elastic-package` with integrations can be used to generate sample data for integration packages. The following is a quick guide on how to use it with certain packages with your own stack deployment.
4+
5+
## Getting started
6+
7+
### Install elastic-package
8+
9+
The first thing needed, is an installation of `elastic-package`, you can find [here](https://github.com/elastic/elastic-package/tree/main?tab=readme-ov-file#getting-started) different ways how to install it.
10+
11+
### Setup Elastic Stack
12+
13+
As soon as elastic-package is set up, you need a running Elastic. The simplest thing to set it up with Docker is running `elastic-package stack up --version=8.13.0-SNAPSHOT -v`. This will start a snapshot build of an Elastic Stack cluster on your machine and you can open Kibana under `https://localhost:5601`.
14+
15+
If you have your own Cloud setup or run Kibana from source, you can set the environment variables accordingly. The following is a sample assuming you are running Kibana and Elasticsearch from source:
16+
17+
```
18+
ELASTIC_PACKAGE_ELASTICSEARCH_HOST=http://localhost:9200
19+
ELASTIC_PACKAGE_ELASTICSEARCH_USERNAME=elastic
20+
ELASTIC_PACKAGE_ELASTICSEARCH_PASSWORD=changeme
21+
ELASTIC_PACKAGE_KIBANA_HOST=http://localhost:5601
22+
#ELASTIC_PACKAGE_CA_CERT
23+
```
24+
25+
The same can be use to connect to your Elastic Cloud cluster. Unfortunately elastic-package currently does not support an API key to be used.
26+
27+
If you are running Kibana from source and have a base path like `ciy`, use the following HOST for Kibana:
28+
29+
```
30+
ELASTIC_PACKAGE_KIBANA_HOST=http://localhost:5601/ciy
31+
```
32+
33+
### Checkout integrations repository
34+
35+
To ingest data for an integration, currently you have to checkout the integrations repo to your machine as the templates for the data are not part of the packages itself. Clone the integrations repo to your disk:
36+
37+
```
38+
git clone https://github.com/elastic/integrations.git
39+
```
40+
41+
### Ingest data
42+
43+
Now jump to one of the packages which have a template file. We will be using nginx for this example but k8s and aws package also have templates inside. You need to `cd` into the nginx package:
44+
45+
```
46+
cd packages/nginx
47+
```
48+
49+
Inside the directory, run the following command with the `elastic-package` stack setup.
50+
51+
```
52+
elastic-package benchmark stream -v
53+
```
54+
55+
When running Kibana from source with `--no-base-path`, you can run the following command:
56+
57+
```
58+
ELASTIC_PACKAGE_ELASTICSEARCH_HOST=http://localhost:9200 ELASTIC_PACKAGE_ELASTICSEARCH_USERNAME=elastic ELASTIC_PACKAGE_ELASTICSEARCH_PASSWORD=changeme ELASTIC_PACKAGE_KIBANA_HOST=http://localhost:5601 elastic-package benchmark stream -v
59+
```
60+
61+
62+
The above command will backfill the last 15 minutes in your Elastic Stack with nginx metrics and logs and install the nginx integration. You can go to [https://localhost:5601/app/observability-log-explorer/](https://localhost:5601/app/observability-log-explorer/) and filter down on `Nginx -> Error Logs` to see the error logs that are ingested.
63+
64+
65+
66+
## Links
67+
68+
There is a lot more documentation around how to build your own templates for packages or adjust existing ones. These are linked below:
69+
70+
* [Writing rally benchmarks for a package](https://github.com/elastic/elastic-package/blob/main/docs/howto/rally_benchmarking.md)

0 commit comments

Comments
 (0)