# Adding extra/context to every log entry

**URL:** <https://discuss.elastic.co/t/adding-extra-context-to-every-log-entry/332434>\
**Category:** APM\
**Tags:** php\
**Created:** [May 3, 2023, 1:59pm UTC](https://discuss.elastic.co/t/adding-extra-context-to-every-log-entry/332434 "2023-05-03T13:59:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Legion112](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/legion112/32/118696_2.png) [@Legion112](https://discuss.elastic.co/u/Legion112)\
**Post date:** [May 3, 2023, 1:59pm UTC](https://discuss.elastic.co/t/adding-extra-context-to-every-log-entry/332434/1 "2023-05-03T13:59:27Z")

</div>

I would like to add to Monolog extra current transaction and trace id  
How would I do that?

Which particular field should I use to make Elasticsearch understand that particular log belongs to trace/transaction?  
Are there any hardcoded keys used for displaying those things in APM and Discovery?

---

<div class="post-metadata">

**Author:** ![Sergey\_Kleyman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_kleyman/32/39333_2.png) [@Sergey\_Kleyman](https://discuss.elastic.co/u/Sergey_Kleyman)\
**Post date:** [May 3, 2023, 9:01pm UTC](https://discuss.elastic.co/t/adding-extra-context-to-every-log-entry/332434/2 "2023-05-03T21:01:54Z")

</div>

Hi @Legion112. Welcome to our community!  
I've added a code snippet at [Add support for Log correlation (AKA Logging integration) · Issue #682 · elastic/apm-agent-php · GitHub](https://github.com/elastic/apm-agent-php/issues/682#issuecomment-1533741467)  
Please take a look and let us know if that is what you are looking for.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 24, 2023, 5:02pm UTC](https://discuss.elastic.co/t/adding-extra-context-to-every-log-entry/332434/3 "2023-05-24T17:02:51Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
