Add journald log collection support for CloudWatch Agent#2121
Add journald log collection support for CloudWatch Agent#2121Paamicky wants to merge 25 commits into
Conversation
3fa27e5 to
fb1113c
Compare
fb1113c to
a21f5de
Compare
|
|
||
| const ( | ||
| var ( | ||
| KeyDelimiter = otelconfmap.KeyDelimiter |
There was a problem hiding this comment.
Do we need to change this from const to var?
…-cloudwatch-agent into mcommey/journald-logs-support
| var _ common.ComponentTranslator = (*translator)(nil) | ||
|
|
||
| // StorageID is the component.ID for the file_storage/journald extension, exported for use by the receiver. | ||
| var StorageID component.ID |
There was a problem hiding this comment.
The receiver reads filestorage.StorageID (a global var set as a side effect of NewTranslator()). If build() order ever changes or the receiver is tested in isolation, this silently becomes component.ID{}. No other extension/receiver pair communicates via a global var. Can we expose a pure function instead?
func StorageComponentID() component.ID {
return component.NewIDWithName(filestorage.NewFactory().Type(), "journald")
}| "description": "Array of systemd units to read from", | ||
| "items": { | ||
| "type": "string", | ||
| "maxLength": 256 |
There was a problem hiding this comment.
minItems and uniqueItems are array keywords, they're silently ignored on "type": "string". This means no validation on priority values. Can we use an "enum" like event_levels in logsWindowsEventsDefinition does?
"enum": ["emerg", "alert", "crit", "err", "warning", "notice", "info", "debug", "0", "1", "2", "3", "4", "5", "6", "7"]| } | ||
| } | ||
|
|
||
| // Set AWS session configuration |
There was a problem hiding this comment.
This sets cfg.Region, cfg.Profile, etc. directly, but the existing awscloudwatchlogs exporter (same config type) uses cfg.AWSSessionSettings.*. Could this cause different credential resolution behavior? Should match translator/translate/otel/exporter/awscloudwatchlogs/translator.go.
| "collect_list" | ||
| ] | ||
| }, | ||
| "logsJournaldDefinition": { |
There was a problem hiding this comment.
log_group_name isn't required here, but both logsWindowsEventsDefinition and logsFilesDefinition require their key field. A customer who omits it silently gets all logs routed to a shared "journald-logs" group. Should we add "required": ["log_group_name"]?
eb180a4 to
91c2b7f
Compare
91c2b7f to
da333e1
Compare
Description of the issue
Modern Linux distributions (AL2023) use systemd-journald as the sole logging system, dropping rsyslog by default. Customers on AL2023 have no /var/log/messages to tail. This feature adds native systemd-journald log collection to the CloudWatch Agent by integrating the upstream OpenTelemetry journald receiver. This fills that gap.
Description of changes
Config Example:
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
EKS and some other flakey test are failing on main, team is try to resolve it.
Requirements
Integration test and SElinux Policy update PR's needs to be merged before this PR
Integration test: aws/amazon-cloudwatch-agent-test#695
SElinux Policy Update: aws/amazon-cloudwatch-agent-selinux#9
Integration Tests
To run integration tests against this PR, add the
ready for testinglabel.