Skip to content

Commit 7edf312

Browse files
authored
Merge pull request #1040 from appsignal/ignore-logs
Add `ignoreLogs` configuration option
2 parents 5bb3108 + 9985d08 commit 7edf312

File tree

7 files changed

+41
-15
lines changed

7 files changed

+41
-15
lines changed

.changesets/implement-ignore-logs.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
bump: "patch"
3+
integrations: "all"
4+
type: "add"
5+
---
6+
7+
Implement the `ignoreLogs` configuration option, which can also be configured as the `APPSIGNAL_IGNORE_LOGS` environment variable.
8+
9+
The value of `ignoreLogs` is a list (comma-separated, when using the environment variable) of log line messages that should be ignored. For example, the value `"start"` will cause any message containing the word "start" to be ignored. Any log line message containing a value in `ignoreLogs` will not be reported to AppSignal.
10+
11+
The values can use a small subset of regular expression syntax (specifically, `^`, `$` and `.*`) to narrow or expand the scope of lines that should be matched.
12+
13+
For example, the value `"^start$"` can be used to ignore any message that is _exactly_ the word "start", but not messages that merely contain it, like "Process failed to start". The value `"Task .* succeeded"` can be used to ignore messages about task success regardless of the specific task name.
14+

scripts/extension/support/constants.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// appsignal-agent repository.
44
// Modifications to this file will be overwritten with the next agent release.
55

6-
const AGENT_VERSION = "0.35.1"
6+
const AGENT_VERSION = "0.35.2"
77
const MIRRORS = [
88
"https://appsignal-agent-releases.global.ssl.fastly.net",
99
"https://d135dj0rjqvssy.cloudfront.net"
@@ -12,67 +12,67 @@ const MIRRORS = [
1212
const TRIPLES = {
1313
"x86_64-darwin": {
1414
checksum:
15-
"f2e1cf5de6d75a06c1068177b09dc84f3d58dfcd48b4a0a729ce9d62ce8588af",
15+
"4a01803fae744971e2da08a325acb88a5f79bf44cbde03456652affb91fa0817",
1616
filename: "appsignal-x86_64-darwin-all-static.tar.gz"
1717
},
1818
"universal-darwin": {
1919
checksum:
20-
"f2e1cf5de6d75a06c1068177b09dc84f3d58dfcd48b4a0a729ce9d62ce8588af",
20+
"4a01803fae744971e2da08a325acb88a5f79bf44cbde03456652affb91fa0817",
2121
filename: "appsignal-x86_64-darwin-all-static.tar.gz"
2222
},
2323
"aarch64-darwin": {
2424
checksum:
25-
"2d3717377200fb605238625335c133448eaa76d9a9c4ae70308b0cbb8442f18b",
25+
"c80fa534a0f34d0056102ed5ec21cb558b714b17dc2a91f62fabdb992acc8a54",
2626
filename: "appsignal-aarch64-darwin-all-static.tar.gz"
2727
},
2828
"arm64-darwin": {
2929
checksum:
30-
"2d3717377200fb605238625335c133448eaa76d9a9c4ae70308b0cbb8442f18b",
30+
"c80fa534a0f34d0056102ed5ec21cb558b714b17dc2a91f62fabdb992acc8a54",
3131
filename: "appsignal-aarch64-darwin-all-static.tar.gz"
3232
},
3333
"arm-darwin": {
3434
checksum:
35-
"2d3717377200fb605238625335c133448eaa76d9a9c4ae70308b0cbb8442f18b",
35+
"c80fa534a0f34d0056102ed5ec21cb558b714b17dc2a91f62fabdb992acc8a54",
3636
filename: "appsignal-aarch64-darwin-all-static.tar.gz"
3737
},
3838
"aarch64-linux": {
3939
checksum:
40-
"50574d6a519997a34b54db741c8948e3b72c19fcf73e5fda1e4449e21bbcc434",
40+
"71236975f40316d67c2b0e797814d52a49df8c5941375c0aed81c6870d82f299",
4141
filename: "appsignal-aarch64-linux-all-static.tar.gz"
4242
},
4343
"i686-linux": {
4444
checksum:
45-
"2af64d99df4834cf5a12b8b2e1f5da7bd11d44f2a3a1ae55a1ac9b8243c685ff",
45+
"00ab0d029ede31225b2d134cdfab1e2c75e15e96229ef9e89ac14f51b8329988",
4646
filename: "appsignal-i686-linux-all-static.tar.gz"
4747
},
4848
"x86-linux": {
4949
checksum:
50-
"2af64d99df4834cf5a12b8b2e1f5da7bd11d44f2a3a1ae55a1ac9b8243c685ff",
50+
"00ab0d029ede31225b2d134cdfab1e2c75e15e96229ef9e89ac14f51b8329988",
5151
filename: "appsignal-i686-linux-all-static.tar.gz"
5252
},
5353
"x86_64-linux": {
5454
checksum:
55-
"db6f60201d5dcc982c69b1a4c7fe0c8300642aebebb503bbe9810e94e1221724",
55+
"2e96245f692f47ee8fd12cca92b620baf79845ec920fb19b38612dd1cb051961",
5656
filename: "appsignal-x86_64-linux-all-static.tar.gz"
5757
},
5858
"x86_64-linux-musl": {
5959
checksum:
60-
"f8381060a355dfaac7db9b38a922cde0baf3ef50808b13223914406c9c838cb8",
60+
"a99ebcdf993cd740dc556de9fba6e7ce1c802704c290c4d8b842cb4dc971473a",
6161
filename: "appsignal-x86_64-linux-musl-all-static.tar.gz"
6262
},
6363
"aarch64-linux-musl": {
6464
checksum:
65-
"ab2101aea771f0b714e167c101f6dfee89304973be9270bacb34b7dfe50c73ce",
65+
"874542de2899dc7ef6d286f1cb719614877651c6cafc9f5ae73d37d1aa0e61da",
6666
filename: "appsignal-aarch64-linux-musl-all-static.tar.gz"
6767
},
6868
"x86_64-freebsd": {
6969
checksum:
70-
"70291d0d5839d5b0019435e2b4dfa41e4b2d4ddf689a620d5ded88f7513f186a",
70+
"f30c529ed4fffe4f0668bcb59881061b22050813d9d10acf5a4bf03f4547a51b",
7171
filename: "appsignal-x86_64-freebsd-all-static.tar.gz"
7272
},
7373
"amd64-freebsd": {
7474
checksum:
75-
"70291d0d5839d5b0019435e2b4dfa41e4b2d4ddf689a620d5ded88f7513f186a",
75+
"f30c529ed4fffe4f0668bcb59881061b22050813d9d10acf5a4bf03f4547a51b",
7676
filename: "appsignal-x86_64-freebsd-all-static.tar.gz"
7777
}
7878
}

src/__tests__/config.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe("Configuration", () => {
3636
filterSessionData: [],
3737
ignoreActions: [],
3838
ignoreErrors: [],
39+
ignoreLogs: [],
3940
ignoreNamespaces: [],
4041
initializeOpentelemetrySdk: true,
4142
log: "file",
@@ -360,6 +361,7 @@ describe("Configuration", () => {
360361
expect(env("_APPSIGNAL_HTTP_PROXY")).toBeUndefined()
361362
expect(env("_APPSIGNAL_IGNORE_ACTIONS")).toBeUndefined()
362363
expect(env("_APPSIGNAL_IGNORE_ERRORS")).toBeUndefined()
364+
expect(env("_APPSIGNAL_IGNORE_LOGS")).toBeUndefined()
363365
expect(env("_APPSIGNAL_IGNORE_NAMESPACES")).toBeUndefined()
364366
expect(env("_APPSIGNAL_LOG")).toEqual("file")
365367
expect(env("_APPSIGNAL_LOG_LEVEL")).toBeUndefined()
@@ -412,6 +414,7 @@ describe("Configuration", () => {
412414
httpProxy: "http://localhost",
413415
ignoreActions: ["MyAction", "MyOtherAction"],
414416
ignoreErrors: ["MyError", "MyOtherError"],
417+
ignoreLogs: ["^start$", "^Completed 2.* in .*ms$"],
415418
ignoreNamespaces: ["MyNamespace", "MyOtherNamespace"],
416419
logLevel: "debug",
417420
logPath: "/tmp/other",
@@ -445,6 +448,9 @@ describe("Configuration", () => {
445448
"MyAction,MyOtherAction"
446449
)
447450
expect(env("_APPSIGNAL_IGNORE_ERRORS")).toEqual("MyError,MyOtherError")
451+
expect(env("_APPSIGNAL_IGNORE_LOGS")).toEqual(
452+
"^start$,^Completed 2.* in .*ms$"
453+
)
448454
expect(env("_APPSIGNAL_IGNORE_NAMESPACES")).toEqual(
449455
"MyNamespace,MyOtherNamespace"
450456
)

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export class Configuration {
135135
filterSessionData: [],
136136
ignoreActions: [],
137137
ignoreErrors: [],
138+
ignoreLogs: [],
138139
ignoreNamespaces: [],
139140
initializeOpentelemetrySdk: true,
140141
log: "file",

src/config/configmap.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const ENV_TO_KEY_MAPPING = {
2222
APPSIGNAL_HTTP_PROXY: "httpProxy",
2323
APPSIGNAL_IGNORE_ACTIONS: "ignoreActions",
2424
APPSIGNAL_IGNORE_ERRORS: "ignoreErrors",
25+
APPSIGNAL_IGNORE_LOGS: "ignoreLogs",
2526
APPSIGNAL_IGNORE_NAMESPACES: "ignoreNamespaces",
2627
APPSIGNAL_INITIALIZE_OPENTELEMETRY_SDK: "initializeOpentelemetrySdk",
2728
APPSIGNAL_LOG: "log",
@@ -61,6 +62,7 @@ export const PRIVATE_ENV_MAPPING: Record<string, keyof AppsignalOptions> = {
6162
_APPSIGNAL_HTTP_PROXY: "httpProxy",
6263
_APPSIGNAL_IGNORE_ACTIONS: "ignoreActions",
6364
_APPSIGNAL_IGNORE_ERRORS: "ignoreErrors",
65+
_APPSIGNAL_IGNORE_LOGS: "ignoreLogs",
6466
_APPSIGNAL_IGNORE_NAMESPACES: "ignoreNamespaces",
6567
_APPSIGNAL_LOG: "log",
6668
_APPSIGNAL_LOG_LEVEL: "logLevel",
@@ -100,6 +102,7 @@ export const JS_TO_RUBY_MAPPING: Record<keyof AppsignalOptions, string> = {
100102
httpProxy: "http_proxy",
101103
ignoreActions: "ignore_actions",
102104
ignoreErrors: "ignore_errors",
105+
ignoreLogs: "ignore_logs",
103106
ignoreNamespaces: "ignore_namespaces",
104107
initializeOpentelemetrySdk: "initialize_opentelemetry_sdk",
105108
log: "log",
@@ -159,6 +162,7 @@ export const LIST_KEYS: (keyof typeof ENV_TO_KEY_MAPPING)[] = [
159162
"APPSIGNAL_FILTER_SESSION_DATA",
160163
"APPSIGNAL_IGNORE_ACTIONS",
161164
"APPSIGNAL_IGNORE_ERRORS",
165+
"APPSIGNAL_IGNORE_LOGS",
162166
"APPSIGNAL_IGNORE_NAMESPACES",
163167
"APPSIGNAL_REQUEST_HEADERS"
164168
]

src/config/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type AppsignalOptions = {
2222
httpProxy: string
2323
ignoreActions: string[]
2424
ignoreErrors: string[]
25+
ignoreLogs: string[]
2526
ignoreNamespaces: string[]
2627
initializeOpentelemetrySdk: boolean
2728
log: string

0 commit comments

Comments
 (0)