Skip to content

Commit fa8f775

Browse files
committed
[APM] Add APM agent config options (#84678)
1 parent d3b0cfd commit fa8f775

4 files changed

Lines changed: 113 additions & 4 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import * as t from 'io-ts';
8+
9+
export const logLevelRt = t.union([
10+
t.literal('trace'),
11+
t.literal('debug'),
12+
t.literal('info'),
13+
t.literal('warning'),
14+
t.literal('error'),
15+
t.literal('critical'),
16+
t.literal('off'),
17+
]);

x-pack/plugins/apm/common/agent_configuration/setting_definitions/__snapshots__/index.test.ts.snap

Lines changed: 42 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/apm/common/agent_configuration/setting_definitions/general_settings.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import { i18n } from '@kbn/i18n';
88
import { captureBodyRt } from '../runtime_types/capture_body_rt';
9+
import { logLevelRt } from '../runtime_types/log_level_rt';
910
import { RawSettingDefinition } from './types';
1011

1112
export const generalSettings: RawSettingDefinition[] = [
@@ -91,15 +92,25 @@ export const generalSettings: RawSettingDefinition[] = [
9192
// LOG_LEVEL
9293
{
9394
key: 'log_level',
94-
type: 'text',
95+
validation: logLevelRt,
96+
type: 'select',
9597
defaultValue: 'info',
9698
label: i18n.translate('xpack.apm.agentConfig.logLevel.label', {
9799
defaultMessage: 'Log level',
98100
}),
99101
description: i18n.translate('xpack.apm.agentConfig.logLevel.description', {
100102
defaultMessage: 'Sets the logging level for the agent',
101103
}),
102-
includeAgents: ['dotnet', 'ruby'],
104+
options: [
105+
{ text: 'trace', value: 'trace' },
106+
{ text: 'debug', value: 'debug' },
107+
{ text: 'info', value: 'info' },
108+
{ text: 'warning', value: 'warning' },
109+
{ text: 'error', value: 'error' },
110+
{ text: 'critical', value: 'critical' },
111+
{ text: 'off', value: 'off' },
112+
],
113+
includeAgents: ['dotnet', 'ruby', 'java'],
103114
},
104115

105116
// Recording
@@ -207,4 +218,42 @@ export const generalSettings: RawSettingDefinition[] = [
207218
}
208219
),
209220
},
221+
222+
// Sanitize field names
223+
{
224+
key: 'sanitize_field_names',
225+
type: 'text',
226+
defaultValue:
227+
'password, passwd, pwd, secret, *key, *token*, *session*, *credit*, *card*, authorization, set-cookie',
228+
label: i18n.translate('xpack.apm.agentConfig.sanitizeFiledNames.label', {
229+
defaultMessage: 'Sanitize field names',
230+
}),
231+
description: i18n.translate(
232+
'xpack.apm.agentConfig.sanitizeFiledNames.description',
233+
{
234+
defaultMessage:
235+
'Sometimes it is necessary to sanitize, i.e., remove, sensitive data sent to Elastic APM. This config accepts a list of wildcard patterns of field names which should be sanitized. These apply to HTTP headers (including cookies) and `application/x-www-form-urlencoded` data (POST form fields). The query string and the captured request body (such as `application/json` data) will not get sanitized.',
236+
}
237+
),
238+
includeAgents: ['java'],
239+
},
240+
241+
// Ignore transactions based on URLs
242+
{
243+
key: 'transaction_ignore_urls',
244+
type: 'text',
245+
defaultValue:
246+
'Agent specific - check out the documentation of this config option in the corresponding agent documentation.',
247+
label: i18n.translate('xpack.apm.agentConfig.transactionIgnoreUrl.label', {
248+
defaultMessage: 'Ignore transactions based on URLs',
249+
}),
250+
description: i18n.translate(
251+
'xpack.apm.agentConfig.transactionIgnoreUrl.description',
252+
{
253+
defaultMessage:
254+
'Used to restrict requests to certain URLs from being instrumented. This config accepts a comma-separated list of wildcard patterns of URL paths that should be ignored. When an incoming HTTP request is detected, its request path will be tested against each element in this list. For example, adding `/home/index` to this list would match and remove instrumentation from `http://localhost/home/index` as well as `http://whatever.com/home/index?value1=123`',
255+
}
256+
),
257+
includeAgents: ['java'],
258+
},
210259
];

x-pack/plugins/apm/common/agent_configuration/setting_definitions/index.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ describe('filterByAgent', () => {
6161
'capture_headers',
6262
'circuit_breaker_enabled',
6363
'enable_log_correlation',
64+
'log_level',
6465
'profiling_inferred_spans_enabled',
6566
'profiling_inferred_spans_excluded_classes',
6667
'profiling_inferred_spans_included_classes',
6768
'profiling_inferred_spans_min_duration',
6869
'profiling_inferred_spans_sampling_interval',
6970
'recording',
71+
'sanitize_field_names',
7072
'server_timeout',
7173
'span_frames_min_duration',
7274
'stack_trace_limit',
@@ -75,6 +77,7 @@ describe('filterByAgent', () => {
7577
'stress_monitor_gc_stress_threshold',
7678
'stress_monitor_system_cpu_relief_threshold',
7779
'stress_monitor_system_cpu_stress_threshold',
80+
'transaction_ignore_urls',
7881
'transaction_max_spans',
7982
'transaction_sample_rate',
8083
]);

0 commit comments

Comments
 (0)