Skip to content

Commit 5593bbe

Browse files
dsessler7jmckulk
authored andcommitted
OTel: Add log context to body in transform processor config to satisfy collector 0.125.0.
1 parent 8d7651f commit 5593bbe

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

internal/collector/generated/postgres_logs_transforms.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/collector/postgres_logs_transforms.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# TODO(postgres-14): We can stop parsing CSV logs when 14 is EOL.
99
# https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/pkg/ottl/contexts/ottllog#readme
1010
- conditions:
11-
- body["format"] == "csv"
11+
- log.body["format"] == "csv"
1212
statements:
1313
# https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/pkg/ottl/ottlfuncs#parsecsv
1414
- set(log.cache, ParseCSV(log.body["original"], log.body["headers"], delimiter=",", mode="strict"))
@@ -196,7 +196,7 @@
196196
# https://github.com/pgaudit/pgaudit/blame/17.0/pgaudit.c#L876
197197
# TODO(postgres-18): Check this prefix and update the URL above.
198198
- >-
199-
Len(body["message"]) > 7 and Substring(body["message"], 0, 7) == "AUDIT: "
199+
Len(log.body["message"]) > 7 and Substring(log.body["message"], 0, 7) == "AUDIT: "
200200
statements:
201201
# https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/pkg/ottl/ottlfuncs#parsecsv
202202
- >-

internal/collector/postgres_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ processors:
123123
transform/postgres_logs:
124124
log_statements:
125125
- conditions:
126-
- body["format"] == "csv"
126+
- log.body["format"] == "csv"
127127
statements:
128128
- set(log.cache, ParseCSV(log.body["original"], log.body["headers"], delimiter=",",
129129
mode="strict"))
@@ -203,8 +203,8 @@ processors:
203203
- set(log.attributes["process.title"], log.body["ps"]) where IsString(log.body["ps"])
204204
- set(log.attributes["user.name"], log.body["user"]) where IsString(log.body["user"])
205205
- conditions:
206-
- 'Len(body["message"]) > 7 and Substring(body["message"], 0, 7) == "AUDIT:
207-
"'
206+
- 'Len(log.body["message"]) > 7 and Substring(log.body["message"], 0, 7) ==
207+
"AUDIT: "'
208208
statements:
209209
- set(log.body["pgaudit"], ParseCSV(Substring(log.body["message"], 7, Len(log.body["message"])
210210
- 7), "audit_type,statement_id,substatement_id,class,command,object_type,object_name,statement,parameter",
@@ -383,7 +383,7 @@ processors:
383383
transform/postgres_logs:
384384
log_statements:
385385
- conditions:
386-
- body["format"] == "csv"
386+
- log.body["format"] == "csv"
387387
statements:
388388
- set(log.cache, ParseCSV(log.body["original"], log.body["headers"], delimiter=",",
389389
mode="strict"))
@@ -463,8 +463,8 @@ processors:
463463
- set(log.attributes["process.title"], log.body["ps"]) where IsString(log.body["ps"])
464464
- set(log.attributes["user.name"], log.body["user"]) where IsString(log.body["user"])
465465
- conditions:
466-
- 'Len(body["message"]) > 7 and Substring(body["message"], 0, 7) == "AUDIT:
467-
"'
466+
- 'Len(log.body["message"]) > 7 and Substring(log.body["message"], 0, 7) ==
467+
"AUDIT: "'
468468
statements:
469469
- set(log.body["pgaudit"], ParseCSV(Substring(log.body["message"], 7, Len(log.body["message"])
470470
- 7), "audit_type,statement_id,substatement_id,class,command,object_type,object_name,statement,parameter",

0 commit comments

Comments
 (0)