Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set log group on the x-ray segment #17

Closed
garyd203 opened this issue Aug 21, 2020 · 2 comments
Closed

Set log group on the x-ray segment #17

garyd203 opened this issue Aug 21, 2020 · 2 comments

Comments

@garyd203
Copy link
Owner

garyd203 commented Aug 21, 2020

Be able to explicitly set the AWS CLoudwatch Group used for this segment. This appears to be set using the field segment['aws']['cloudwatch_logs']['logGroup'] (according to the Java SDK). NB: More likely to be log_group since everything else is snakecased

None of the python plugins currently set this (as of SDK v2.6.0), and it is unknowable for execution environments like ECS anyway. So let's provide the convenience. aws/aws-xray-sdk-python#188 tracks the official SDK's implementation of this feature

@grandstairs
Copy link

grandstairs commented Aug 31, 2024

You are a life-saver. Thank you so much for figuring out you have to add the traceId field to the log and specify the Document: { aws: { cloudwatch_logs: { log_group: "name-goes-here"}}} in order for cloudwatch to show logs related to the trace.

{
    "Id": "1-66d31855-6f5d130426895f3a46d02c27",
    "Duration": 0,
    "Segments": [
        {
            "Id": "6b2f00e244c2001a",
            "Document": {
                "id": "6b2f00e244c2001a",
                "name": "myservice",
                "start_time": 1725110357.4398508,
                "trace_id": "1-66d31855-6f5d130426895f3a46d02c27",
                "end_time": 1725110357.4400752,
                "aws": {
                    "cloudwatch_logs": {
                        "log_group": "appLogs"
                    }
                },
                "subsegments": [
                    {
                        "id": "ff18b78ebef2cf6d",
                        "name": "DatabaseCall",
                        "start_time": 1725110357.4398944,
                        "end_time": 1725110357.439969,
                        "http": {
                            "response": {
                                "status": 200
                            }
                        },
                    }
                ]
            }
        }
    ]
}

@garyd203
Copy link
Owner Author

garyd203 commented Sep 3, 2024

Glad it helped @grandstairs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants