Merged
Conversation
Enable CloudWatch logging for OpenSearch to diagnose slow query performance issues identified in production traces. Infrastructure changes: - Add CloudWatch Log Groups for index, search, and application logs - Configure log publishing options on OpenSearch domain - Set retention: 30 days (prod), 7 days (dev) for slow logs Runtime configuration: - Add configure_slow_logs.ts script to set query thresholds - Log queries > 1s at WARN, > 500ms at INFO, > 200ms at DEBUG This helps diagnose bottlenecks like the 15s search_unified trace where database queries were fast but OpenSearch was slow. Setup: Deploy with pulumi up, then run configure_slow_logs.ts
Contributor
Code reviewFound 1 issue that needs to be addressed: Missing CloudWatch Logs Resource PolicyLocation: The PR creates CloudWatch Log Groups and configures Without this resource policy, the deployment will either:
Required fix: Add a CloudWatch Logs resource policy before the
The policy needs to:
Reference: macro/infra/stacks/opensearch/index.ts Lines 162 to 164 in e560282 |
e560282 to
143f61c
Compare
Grant es.amazonaws.com service principal permission to write logs to CloudWatch Log Groups. This policy is required for OpenSearch to publish slow query logs to CloudWatch. Without this policy, OpenSearch domain creation succeeds but logs are not written to CloudWatch.
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.
see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createdomain-configure-slow-logs.html