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

Adding the field container.id to the logs through the log correlation feature #461

Open
chazragg opened this issue Sep 16, 2023 · 1 comment
Labels
agent-dotnet enhancement New feature or request

Comments

@chazragg
Copy link

chazragg commented Sep 16, 2023

I believe it would be beneficial to enhance the logs by incorporating container.id alongside ElasticApmTransactionID and ElasticApmTraceId when using the log correlation feature. Currently, the Elastic Agent exclusively includes the container.id field in traces and metrics sent to the APM server. While this certainly helps with correlation for linking traces back to logs and also certain metrics back to the infrastructure panel, there are some UI elementals such as Overview > Instances and Transactions > Trace sample > Investigate where you can click into the container logs and these only work if the container.id field is present in the logs

Describe alternatives you've considered
The only way to do this currently would be to handle the collection and injection of the container id yourself on the application side but it seems wasteful to perform the same operation twice when the elastic Agent already performs this step and I believe it would be a small but effective addition.

@chazragg chazragg added the enhancement New feature or request label Sep 16, 2023
@WilliamRoxit
Copy link

Also missing this. For now I just do this which works for now but might break in future:
containerId = File.ReadAllLines("/proc/self/cgroup")
.FirstOrDefault(x => x.Contains(":name="))
?.Split('/')
?.Last();
Enrich.WithProperty("ContainerId", containerId);

@stevejgordon stevejgordon transferred this issue from elastic/apm-agent-dotnet Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-dotnet enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants