fix: Map slog field names to Datadog-friendly format#110
Merged
Conversation
alecthomas
approved these changes
Feb 12, 2026
Collaborator
alecthomas
left a comment
There was a problem hiding this comment.
Let's put it behind a flag --log-datadog or something, so that systems expecting the standard slog structure will be fine. Is this actually a Datadog thing, or something specific to Block? If the latter...
52bcfb1 to
a5e8dd1
Compare
Add a remap config option to allow field name remapping in JSON mode,
enabling proper log formatting for different log aggregation systems.
Example configuration for Datadog compatibility:
```hcl
log {
json = true
remap = {
msg = "message"
time = "timestamp"
}
}
```
This allows Datadog to correctly extract the log message as content
instead of displaying the entire JSON object.
a5e8dd1 to
a2ff3e0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
msg→message(primary log content field)time→timestampProblem
Datadog was displaying the entire JSON object as log content instead of extracting just the message. This happened because Go's

sloglibrary uses"msg"as the default field name, but Datadog expects"message"as the primary log content field.