Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/collector/generated/postgres_logs_transforms.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/collector/postgres_logs_transforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# TODO(postgres-14): We can stop parsing CSV logs when 14 is EOL.
# https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/pkg/ottl/contexts/ottllog#readme
- conditions:
- body["format"] == "csv"
- log.body["format"] == "csv"
statements:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/pkg/ottl/ottlfuncs#parsecsv
- set(log.cache, ParseCSV(log.body["original"], log.body["headers"], delimiter=",", mode="strict"))
Expand Down Expand Up @@ -196,7 +196,7 @@
# https://github.com/pgaudit/pgaudit/blame/17.0/pgaudit.c#L876
# TODO(postgres-18): Check this prefix and update the URL above.
- >-
Len(body["message"]) > 7 and Substring(body["message"], 0, 7) == "AUDIT: "
Len(log.body["message"]) > 7 and Substring(log.body["message"], 0, 7) == "AUDIT: "
statements:
# https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/pkg/ottl/ottlfuncs#parsecsv
- >-
Expand Down
12 changes: 6 additions & 6 deletions internal/collector/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ processors:
transform/postgres_logs:
log_statements:
- conditions:
- body["format"] == "csv"
- log.body["format"] == "csv"
statements:
- set(log.cache, ParseCSV(log.body["original"], log.body["headers"], delimiter=",",
mode="strict"))
Expand Down Expand Up @@ -203,8 +203,8 @@ processors:
- set(log.attributes["process.title"], log.body["ps"]) where IsString(log.body["ps"])
- set(log.attributes["user.name"], log.body["user"]) where IsString(log.body["user"])
- conditions:
- 'Len(body["message"]) > 7 and Substring(body["message"], 0, 7) == "AUDIT:
"'
- 'Len(log.body["message"]) > 7 and Substring(log.body["message"], 0, 7) ==
"AUDIT: "'
statements:
- set(log.body["pgaudit"], ParseCSV(Substring(log.body["message"], 7, Len(log.body["message"])
- 7), "audit_type,statement_id,substatement_id,class,command,object_type,object_name,statement,parameter",
Expand Down Expand Up @@ -383,7 +383,7 @@ processors:
transform/postgres_logs:
log_statements:
- conditions:
- body["format"] == "csv"
- log.body["format"] == "csv"
statements:
- set(log.cache, ParseCSV(log.body["original"], log.body["headers"], delimiter=",",
mode="strict"))
Expand Down Expand Up @@ -463,8 +463,8 @@ processors:
- set(log.attributes["process.title"], log.body["ps"]) where IsString(log.body["ps"])
- set(log.attributes["user.name"], log.body["user"]) where IsString(log.body["user"])
- conditions:
- 'Len(body["message"]) > 7 and Substring(body["message"], 0, 7) == "AUDIT:
"'
- 'Len(log.body["message"]) > 7 and Substring(log.body["message"], 0, 7) ==
"AUDIT: "'
statements:
- set(log.body["pgaudit"], ParseCSV(Substring(log.body["message"], 7, Len(log.body["message"])
- 7), "audit_type,statement_id,substatement_id,class,command,object_type,object_name,statement,parameter",
Expand Down
Loading