Skip to content

Commit

Permalink
fix: remove gists integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
davlgd committed Jan 5, 2024
1 parent 90eb393 commit c2359bf
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 3 deletions.
33 changes: 32 additions & 1 deletion content/doc/addons/elastic/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF >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
Expand Down
43 changes: 41 additions & 2 deletions content/doc/metrics/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 >}}

<script src="https://gist.github.com/cnivolle/4a9b20254131c0256cd7e4246d3070a7.js"></script>
```
// Fetch on the 'accessLogs' class for your application id as labels
[ '<READTOKEN>' 'accessLogs' { 'app_id' '<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.

<script src="https://gist.github.com/cnivolle/2ee8607d995daa1316e17ffc3874d047.js"></script>
```
// Get all application status code for the last hour
[ '<READTOKEN>' 'accessLogs' { 'app_id' '<APPLICATION 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 :

Expand Down

0 comments on commit c2359bf

Please sign in to comment.