diff --git a/content/doc/addons/elastic/_index.md b/content/doc/addons/elastic/_index.md index dc235dd27..c257b17ce 100644 --- a/content/doc/addons/elastic/_index.md +++ b/content/doc/addons/elastic/_index.md @@ -76,7 +76,38 @@ The APM server is deployed as an application. As such it's configured as an appl You can change the URL to point to your own custom configuration. -A configuration example for RUM activation can be found here: [es-apm-serverconfig.sh](https://gist.githubusercontent.com/ldoguin/d7aa23fd44cfaed04165275aaf229a3c/raw/93aa1d39d8c1e444969ae114dbcfe0a5868f8d84/es-apm-serverconfig.sh). +Here is a configuration example for RUM activation: + +```bash +#!/bin/bash -l + +cat <apm-server.yml +apm-server: + host: "0.0.0.0:8080" + secret_token: "${ES_ADDON_APM_AUTH_TOKEN}" + +output.elasticsearch: + hosts: ["${ES_ADDON_HOST}:443"] + protocol: "https" + username: "${ES_ADDON_APM_USER}" + password: "${ES_ADDON_APM_PASSWORD}" + +path.home: "${APP_HOME}" + +logging: + to_syslog: true + to_files: false + +apm-server.rum.enabled: true +apm-server.rum.event_rate.limit: 300 +apm-server.rum.event_rate.lru_size: 1000 +apm-server.rum.allow_origins: ['*'] +apm-server.rum.library_pattern: "node_modules|bower_components|~" +apm-server.rum.exclude_from_grouping: "^/webpack" +apm-server.rum.source_mapping.enabled: true +apm-server.rum.source_mapping.cache.expiration: 5m +apm-server.rum.source_mapping.index_pattern: "apm-*-sourcemap*" +``` ### Kibana custom configuration diff --git a/content/doc/metrics/_index.md b/content/doc/metrics/_index.md index 9eee75339..13128dfd7 100644 --- a/content/doc/metrics/_index.md +++ b/content/doc/metrics/_index.md @@ -159,13 +159,52 @@ The main ways to use `accessLogs` data is to `FETCH` over it and get interesting Look at *fetch_accessLogs_key_v0* macro to have a convenient way to explore access log data, see [Warp 10 documentation]({{< ref "doc/metrics/warp10" >}}). {{< /callout >}} - +``` +// Fetch on the 'accessLogs' class for your application id as labels +[ '' 'accessLogs' { 'app_id' '' } NOW 30 s ] FETCH + +// get the path field +<% + DROP + VALUES + <% DROP + JSON-> + 'path' GET + %> LMAP +%> LMAP +FLATTEN + +// distinct|unique results +UNIQUE +``` A convenient way to integrate the intercepted data in a workflow is to use [WarpScript](https://www.warp10.io/content/03_Documentation/04_WarpScript/). It is a good idea to use the GTS format to be able to apply all GTS transformation on the output. In the following example, we get the `accessLogs` status codes and create a GTS as an output to be able to use FILTER or any other transformation on it a second time. - +``` +// Get all application status code for the last hour +[ '' 'accessLogs' { 'app_id' '' } NOW 10 m ] FETCH +<% + DROP + 'gts' STORE + // output new GTS + NEWGTS + $gts + <% + DUP + // store the timestamp + 0 GET 'ts' STORE + // store the status code + -1 GET JSON-> 'sC' GET 'sC' STORE + // Keep the same labels in the output GTS than in the input ones + $gts LABELS RELABEL + // Add timestamp and status code value to the output GTS + [ $ts NaN NaN NaN $sC ] ADDVALUE + %> + FOREACH +%> LMAP +``` An example using the provided Clever Cloud macro to straightforward access to the access logs input byte :