Skip to content

Conversation

sky333999
Copy link

@sky333999 sky333999 commented Oct 6, 2025

Description

  • Allow setting the AWS SDK Logging Level via aws.AWSSessionSettings.
  • Updated all usages in awsutil/conn.go. Any other usages should ideally just use this package, so left others untouched.
  • Example configuration:
exporters:
    awsemf/prometheus:
        ...
        log_group_name: test
        log_level: 4096
        ...

Warning

Based on the log level you set, this change will print all headers in plain-text, including any tokens. Please ensure you validate your logging requirements prior to enabling this feature.

Testing

  • Deployed changes to a dev host and validated new debug logs.
2025-10-06T21:32:42Z I! {"caller":"[email protected]/conn.go:39","msg":"DEBUG: Request logs/PutLogEvents Details:\n---[ REQUEST POST-SIGN ]-----------------------------\nPOST / HTTP/1.1\r\nHost: logs.us-east-1.amazonaws.com\r\nUser-Agent: CWAgent/1.300057.2 (go1.25.0; linux; amd64) ID/<redacted> inputs:(cpu prometheus) processors:(awsentity batch) outputs:(awscloudwatch awsemf cloudwatch cloudwatchlogs selinux) / (awsemf) aws-sdk-go/1.48.6 (go1.25.0; linux; amd64)\r\nContent-Length: 415\r\nAuthorization: AWS4-HMAC-SHA256 Credential=<redacted>, SignedHeaders=content-encoding;content-length;content-type;host;x-amz-agent-stats;x-amz-date;x-amz-security-token;x-amz-target;x-amzn-logs-format, Signature=<redacted>\r\nContent-Encoding: gzip\r\nContent-Type: application/x-amz-json-1.1\r\nX-Amz-Agent-Stats: \"cpu\":0.5,\"mem\":103002112,\"fd\":9,\"th\":8,\"ric\":0,\"rt\":\"EC2M\",\"m\":\"EC2\"\r\nX-Amz-Date: 20251006T213242Z\r\nX-Amz-Security-Token: <redacted>\r\nX-Amz-Target: Logs_20140328.PutLogEvents\r\nX-Amzn-Logs-Format: json/emf\r\nAccept-Encoding: gzip\r\n\r\n\n-----------------------------------------------------\n"}
2025-10-06T21:32:42Z I! {"caller":"[email protected]/conn.go:39","msg":"DEBUG: Response logs/PutLogEvents Details:\n---[ RESPONSE ]--------------------------------------\nHTTP/1.1 200 OK\r\nContent-Length: 80\r\nContent-Type: application/x-amz-json-1.1\r\nDate: Mon, 06 Oct 2025 21:32:42 GMT\r\nX-Amzn-Requestid: <redacted>\r\n\r\n\n-----------------------------------------------------\n"}

I manually tokens for the purpose of this PR, but as mentioned above, any tokens will be printed as plain-text when enabled.

@sky333999 sky333999 requested a review from mxiamxia as a code owner October 6, 2025 21:44
Copy link

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant