Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update quickstart sample to output correct severity strings #329

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 12 additions & 0 deletions examples/instrumentation-quickstart/otel-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ receivers:
layout: '%Y-%m-%dT%H:%M:%S.%fZ'
severity:
parse_from: body.severity
preset: none
# parse minimal set of severity strings that Cloud Logging explicitly supports
# https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity
mapping:
debug: debug
info: info
info3: notice
warn: warning
error: error
fatal: critical
fatal3: alert
fatal4: emergency

# set trace_flags to SAMPLED if GCP attribute is set to true
- type: add
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
{
"logging.googleapis.com/trace": "%mdc{trace_id}",
"logging.googleapis.com/spanId": "%mdc{span_id}",
"logging.googleapis.com/trace_sampled": "#asBoolean{%replace(%mdc{trace_flags}){'01', 'true'}}"
"logging.googleapis.com/trace_sampled": "#asBoolean{%replace(%mdc{trace_flags}){'01', 'true'}}",
"severity": "%replace(%replace(%level){'WARN', 'WARNING'}){'TRACE', 'DEBUG'}"
aabmass marked this conversation as resolved.
Show resolved Hide resolved
}
</pattern>
</provider>

<!-- Rename fields for the Logging agent -->
<fieldNames>
<level>severity</level>
<timestamp>timestamp</timestamp>
<level>[ignore]</level>
<levelValue>[ignore]</levelValue>
</fieldNames>

Expand Down
Loading