Skip to content

Commit

Permalink
chore: fix keeping time attribute
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Rosiek <[email protected]>
  • Loading branch information
Dominik Rosiek committed Jul 5, 2024
1 parent a7b211d commit dca6989
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ filelog/containers:
- type: move
from: resource["log.iostream"]
to: resource["stream"]
- type: move
from: resource["time"]
to: attributes["time"]
## Keep only the following attributes:
## - stream
## - k8s.pod.name
Expand All @@ -63,9 +66,9 @@ filelog/containers:
- resource["k8s.pod.name"]
- resource["k8s.container.name"]
- resource["k8s.namespace.name"]
- resource["log.file.path"]
- attributes["log.file.path"]
{{ if .Values.sumologic.logs.container.keep_time_attribute }}
- resource["time"]
- attributes["time"]
{{ end }}

## Strip trailing "\n" from the log body
Expand Down
5 changes: 4 additions & 1 deletion tests/helm/testdata/goldenfile/logs_otc/basic.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ data:
- from: resource["log.iostream"]
to: resource["stream"]
type: move
- from: resource["time"]
to: attributes["time"]
type: move
- fields:
- resource["stream"]
- resource["k8s.pod.name"]
- resource["k8s.container.name"]
- resource["k8s.namespace.name"]
- resource["log.file.path"]
- attributes["log.file.path"]
id: keep-fields
type: retain
- default: multiline
Expand Down
5 changes: 4 additions & 1 deletion tests/helm/testdata/goldenfile/logs_otc/debug.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ data:
- from: resource["log.iostream"]
to: resource["stream"]
type: move
- from: resource["time"]
to: attributes["time"]
type: move
- fields:
- resource["stream"]
- resource["k8s.pod.name"]
- resource["k8s.container.name"]
- resource["k8s.namespace.name"]
- resource["log.file.path"]
- attributes["log.file.path"]
id: keep-fields
type: retain
- default: multiline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ data:
- from: resource["log.iostream"]
to: resource["stream"]
type: move
- from: resource["time"]
to: attributes["time"]
type: move
- fields:
- resource["stream"]
- resource["k8s.pod.name"]
- resource["k8s.container.name"]
- resource["k8s.namespace.name"]
- resource["log.file.path"]
- attributes["log.file.path"]
id: keep-fields
type: retain
- default: multiline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ data:
- from: resource["log.iostream"]
to: resource["stream"]
type: move
- from: resource["time"]
to: attributes["time"]
type: move
- fields:
- resource["stream"]
- resource["k8s.pod.name"]
- resource["k8s.container.name"]
- resource["k8s.namespace.name"]
- resource["log.file.path"]
- attributes["log.file.path"]
id: keep-fields
type: retain
- default: multiline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ data:
- from: resource["log.iostream"]
to: resource["stream"]
type: move
- from: resource["time"]
to: attributes["time"]
type: move
- fields:
- resource["stream"]
- resource["k8s.pod.name"]
- resource["k8s.container.name"]
- resource["k8s.namespace.name"]
- resource["log.file.path"]
- attributes["log.file.path"]
id: keep-fields
type: retain
- default: multiline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ data:
- from: resource["log.iostream"]
to: resource["stream"]
type: move
- from: resource["time"]
to: attributes["time"]
type: move
- fields:
- resource["stream"]
- resource["k8s.pod.name"]
- resource["k8s.container.name"]
- resource["k8s.namespace.name"]
- resource["log.file.path"]
- attributes["log.file.path"]
id: keep-fields
type: retain
- default: multiline
Expand Down

0 comments on commit dca6989

Please sign in to comment.