From 51c778dee276eadb74895085752733326209880c Mon Sep 17 00:00:00 2001 From: Nicolas Ruflin Date: Thu, 18 Jan 2024 10:48:54 +0100 Subject: [PATCH 1/5] [Benchmark/Stream] Add getting started docs for elastic-package stream command 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. --- docs/howto/sample_data.md | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 docs/howto/sample_data.md diff --git a/docs/howto/sample_data.md b/docs/howto/sample_data.md new file mode 100644 index 000000000..193efdc90 --- /dev/null +++ b/docs/howto/sample_data.md @@ -0,0 +1,64 @@ +# Use elastic-package to generate sample data + +`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. + +## Getting started + +### Install elastic-package + +The first thing needed, is an installation of `elastic-package`. If you have go installed you can run `go install github.com/elastic/elastic-package@latest`. Otherwise you find [here](https://github.com/elastic/elastic-package/tree/main?tab=readme-ov-file#getting-started) different ways how to install `elastic-package. + +### Setup Elastic Stack + +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`. + +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: + +``` +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_CA_CERT +``` + +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. + +### Checkout integrations repository + +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: + +``` +git clone https://github.com/elastic/integrations.git +``` + +### Ingest data + +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: + +``` +cd packages/nginx +``` + +Inside the directory, run the following command with the `elastic-package` stack setup. + +``` +elastic-package benchmark stream -v +``` + +If I run I run Kibana from source, I run the following command: + +``` +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 +``` + + +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. + + + +## Links + +There is a lot more documentation around how to build your own templates for packages or adjust existing ones. These are linked below: + +* [Writing rally benchmarks for a package](https://github.com/elastic/elastic-package/blob/main/docs/howto/rally_benchmarking.md) \ No newline at end of file From 71a20e23636cb1ab48e8f8b2cf1b52fd42a11b59 Mon Sep 17 00:00:00 2001 From: Nicolas Ruflin Date: Thu, 18 Jan 2024 14:46:44 +0100 Subject: [PATCH 2/5] Update docs/howto/sample_data.md Co-authored-by: Jaime Soriano Pastor --- docs/howto/sample_data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/sample_data.md b/docs/howto/sample_data.md index 193efdc90..0285ea006 100644 --- a/docs/howto/sample_data.md +++ b/docs/howto/sample_data.md @@ -6,7 +6,7 @@ ### Install elastic-package -The first thing needed, is an installation of `elastic-package`. If you have go installed you can run `go install github.com/elastic/elastic-package@latest`. Otherwise you find [here](https://github.com/elastic/elastic-package/tree/main?tab=readme-ov-file#getting-started) different ways how to install `elastic-package. +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. ### Setup Elastic Stack From 9965e438e38ce2dde931f0a39e4eb330220b8d6d Mon Sep 17 00:00:00 2001 From: Nicolas Ruflin Date: Thu, 18 Jan 2024 14:47:47 +0100 Subject: [PATCH 3/5] Update docs/howto/sample_data.md Co-authored-by: Jaime Soriano Pastor --- docs/howto/sample_data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/sample_data.md b/docs/howto/sample_data.md index 0285ea006..ff75f3994 100644 --- a/docs/howto/sample_data.md +++ b/docs/howto/sample_data.md @@ -46,7 +46,7 @@ Inside the directory, run the following command with the `elastic-package` stack elastic-package benchmark stream -v ``` -If I run I run Kibana from source, I run the following command: +When running Kibana from source, you can run the following command: ``` 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 From 03ee319e96dc9d455041be6be0c57d95a475abee Mon Sep 17 00:00:00 2001 From: Nicolas Ruflin Date: Mon, 22 Jan 2024 09:29:26 +0100 Subject: [PATCH 4/5] add path example --- docs/howto/sample_data.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/howto/sample_data.md b/docs/howto/sample_data.md index 193efdc90..94a160606 100644 --- a/docs/howto/sample_data.md +++ b/docs/howto/sample_data.md @@ -22,7 +22,13 @@ ELASTIC_PACKAGE_KIBANA_HOST=http://localhost:5601 #ELASTIC_PACKAGE_CA_CERT ``` -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. +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. + +If you are running Kibana from source and have a base path like `ciy`, use the following HOST for Kibana: + +``` +ELASTIC_PACKAGE_KIBANA_HOST=http://localhost:5601/ciy +``` ### Checkout integrations repository From 7330728e5224603e5660e13b9bf66b201dd9cca3 Mon Sep 17 00:00:00 2001 From: Nicolas Ruflin Date: Mon, 22 Jan 2024 09:31:59 +0100 Subject: [PATCH 5/5] add --no-base-path example --- docs/howto/sample_data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/sample_data.md b/docs/howto/sample_data.md index 441afa5a3..348c08e02 100644 --- a/docs/howto/sample_data.md +++ b/docs/howto/sample_data.md @@ -52,7 +52,7 @@ Inside the directory, run the following command with the `elastic-package` stack elastic-package benchmark stream -v ``` -When running Kibana from source, you can run the following command: +When running Kibana from source with `--no-base-path`, you can run the following command: ``` 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