Skip to content

Commit bf5ea05

Browse files
immavallsppcano
andauthored
Document/elasticsearch output (#1104)
* fix typo and missing metrics link * Add Elasticsearch output * Fix lint:prose error --------- Co-authored-by: Pepe Cano <[email protected]>
1 parent 0b6192d commit bf5ea05

File tree

9 files changed

+102
-1
lines changed

9 files changed

+102
-1
lines changed

.vale/Vocab/docs/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ jmx
8787
j[qQ]uery
8888
jq
8989
loki
90+
Kibana
9091
Lua
9192
maxfiles
9293
Netdata
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: 'Elasticsearch'
3+
redirect: 'https://k6.io/docs/results-output/real-time/elasticsearch'
4+
---

src/data/markdown/translated-guides/en/01 Get started/04 Results Output.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ The available built-in outputs include:
8585
- [Cloud](/results-output/real-time/cloud)
8686
- [CSV](/results-output/real-time/csv)
8787
- [Datadog](/results-output/real-time/datadog)
88+
- [Elasticsearch](/results-output/real-time/elasticsearch)
8889
- [Grafana Cloud / Prometheus](/results-output/real-time/grafana-cloud)
8990
- [InfluxDB](/results-output/real-time/influxdb-grafana)
9091
- [JSON](/results-output/real-time/json)

src/data/markdown/translated-guides/en/03 Results output/200 Real-time.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ You can also stream real-time metrics to the following services:
3131
- [Apache Kafka](/results-output/real-time/apache-kafka)
3232
- [Cloud](/results-output/real-time/cloud)
3333
- [Datadog](/results-output/real-time/datadog)
34+
- [Elasticsearch](/results-output/real-time/elasticsearch)
3435
- [Grafana Cloud](/results-output/real-time/grafana-cloud)
3536
- [InfluxDB](/results-output/real-time/influxdb-grafana)
3637
- [Netdata](/results-output/real-time/netdata)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: 'Elasticsearch'
3+
excerpt: k6 has an output extension to store k6 metrics in Elasticsearch. This document shows you how to configure the k6 Elasticsearch integration.
4+
---
5+
6+
Using the [Elasticsearch k6 extension](https://github.com/elastic/xk6-output-elasticsearch), you can store k6 metrics in [Elasticsearch](https://github.com/elastic/elasticsearch) and analyze your performance results with Kibana or Grafana.
7+
8+
9+
## Build the k6 version
10+
11+
<InstallationInstructions extensionUrl="github.com/elastic/xk6-output-elasticsearch"/>
12+
13+
## Run the test
14+
15+
Check that the Elasticsearch instance which will store the k6 metrics is running.
16+
17+
If you are running on Elasticsearch cloud, use the previous k6 binary and run the test passing the cloud credentials as follows:
18+
19+
```bash
20+
# export cloud configuration
21+
export K6_ELASTICSEARCH_CLOUD_ID=your-cloud-id-here
22+
export K6_ELASTICSEARCH_USER=your-user-here
23+
export K6_ELASTICSEARCH_PASSWORD=your-password-here
24+
25+
# run the test
26+
./k6 run script.js -o output-elasticsearch
27+
```
28+
29+
k6 runs the test script and sends the metrics in real-time to Elasticsearch.
30+
31+
You can also send the metrics to a local Elasticsearch cluster:
32+
33+
```bash
34+
# export local url
35+
export K6_ELASTICSEARCH_URL=http://localhost:9200
36+
37+
# run the test
38+
./k6 run script.js -o output-elasticsearch
39+
```
40+
41+
<Blockquote mod="attention">
42+
Security and self-signed certificates for non-cloud clusters are not yet supported
43+
</Blockquote>
44+
45+
You can now connect to Elasticsearch and query the [k6 metrics](/using-k6/metrics/) stored in the `k6-metrics` index. The example below uses an unsecured local Elasticsearch version `7.17.9`:
46+
47+
```bash
48+
curl -XGET 'http://localhost:9200/k6-metrics/_search?pretty' -H 'Content-Type: application/json' -d'
49+
{
50+
"sort": [
51+
{
52+
"Time": {
53+
"order": "desc"
54+
}
55+
}
56+
],
57+
"size": 10
58+
}'
59+
```
60+
61+
Or use [Kibana Discover](https://www.elastic.co/guide/en/kibana/7.17/discover.html):
62+
63+
![Kibana Discover k6 results](./images/Elasticsearch/kibana-discover-test-result.png)
64+
65+
### Options
66+
67+
Here is the full list of options that can be configured and passed to the extension:
68+
69+
| Name | Value |
70+
| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
71+
| `K6_ELASTICSEARCH_CLOUD_ID` | Elasticsearch `cloud.id`, which can be found in the Elastic Cloud web console. |
72+
| `K6_ELASTICSEARCH_FLUSH_PERIOD` | Define how often metrics are sent to Elasticsearch. The default value is 1 second. |
73+
| `K6_ELASTICSEARCH_URL` | Elasticsearch URL. |
74+
| `K6_ELASTICSEARCH_USER` | Elasticsearch username. |
75+
| `K6_ELASTICSEARCH_PASSWORD` | Elasticsearch password. |
76+

src/data/markdown/translated-guides/en/03 Results output/200 Real-time/00 TimescaleDB.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Use the previous k6 binary and run the test passing the Postgres connection stri
2121
k6 run script.js -o timescaledb=postgresql://<postgresql_user_name>:<password>@<ip>:<port>/<database>
2222
```
2323

24-
k6 runs the test script and send the metrics in real-time to the TimescaleDB instance. You can now connect to TimescaleDB and query the [k6 metrics]().
24+
k6 runs the test script and sends the metrics in real-time to the TimescaleDB instance. You can now connect to TimescaleDB and query the [k6 metrics](/using-k6/metrics/).
2525

2626
```bash
2727
k6=# SELECT metric,AVG (value) FROM samples GROUP BY metric;
392 KB
Loading

src/svg/elastic.inline.svg

Lines changed: 12 additions & 0 deletions
Loading

src/templates/docs/integrations.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import Buddy from 'svg/buddy.inline.svg';
2424
import CircleCI from 'svg/circleci.inline.svg';
2525
import CSV from 'svg/csv.inline.svg';
2626
import Datadog from 'svg/datadog.inline.svg';
27+
import Elasticsearch from 'svg/elastic.inline.svg';
2728
import Flagger from 'svg/flagger.inline.svg';
2829
import GitHub from 'svg/github.inline.svg';
2930
import Gitlab from 'svg/gitlab.inline.svg';
@@ -69,6 +70,11 @@ const iconsDataSet1 = [
6970
name: 'Datadog',
7071
to: '/results-output/real-time/datadog',
7172
},
73+
{
74+
Icon: Elasticsearch,
75+
name: 'Elasticsearch',
76+
to: '/results-output/real-time/elasticsearch',
77+
},
7278
{
7379
Icon: Grafana,
7480
name: 'Grafana Cloud',

0 commit comments

Comments
 (0)