# PHP APM Agent — Log HTTP headers and payload under transaction metadata

**URL:** <https://discuss.elastic.co/t/php-apm-agent-log-http-headers-and-payload-under-transaction-metadata/316810>\
**Category:** APM\
**Tags:** php\
**Created:** [October 17, 2022, 3:12pm UTC](https://discuss.elastic.co/t/php-apm-agent-log-http-headers-and-payload-under-transaction-metadata/316810 "2022-10-17T15:12:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Its\_Anton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its_anton/32/111286_2.png) [@Its\_Anton](https://discuss.elastic.co/u/Its_Anton)\
**Post date:** [October 17, 2022, 3:12pm UTC](https://discuss.elastic.co/t/php-apm-agent-log-http-headers-and-payload-under-transaction-metadata/316810/1 "2022-10-17T15:12:34Z")

</div>

Hi!

Is there a way to log HTTP headers and payload under transaction metadata for PHP agent? I could not find any solution to how to do that.

---

<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:** [November 7, 2022, 11:12am UTC](https://discuss.elastic.co/t/php-apm-agent-log-http-headers-and-payload-under-transaction-metadata/316810/2 "2022-11-07T11:12:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Peter\_Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_elastic/32/91235_2.png) [@Peter\_Elastic](https://discuss.elastic.co/u/Peter_Elastic)\
**Post date:** [December 4, 2022, 10:31am UTC](https://discuss.elastic.co/t/php-apm-agent-log-http-headers-and-payload-under-transaction-metadata/316810/3 "2022-12-04T10:31:27Z")

</div>

Hi Anton,

You might be able to set additional context to the transaction like the following:

```auto
ElasticApm::getCurrentTransaction()->context()->setLabel('userId', Auth::id());

```

That way you can implement additional information while processing the transaction with its spans.

---

<div class="post-metadata">

**Author:** ![Peter\_Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/peter_elastic/32/91235_2.png) [@Peter\_Elastic](https://discuss.elastic.co/u/Peter_Elastic)\
**Post date:** [December 4, 2022, 10:31am UTC](https://discuss.elastic.co/t/php-apm-agent-log-http-headers-and-payload-under-transaction-metadata/316810/4 "2022-12-04T10:31:39Z")

</div>


