# How can I access headers or custom headers in APM?

**URL:** https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673
**Category:** APM
**Tags:** dotnet
**Created:** [January 3, 2020, 7:30am UTC](https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673 "2020-01-03T07:30:50Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Yusuf\_Karatoprak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yusuf_karatoprak/32/44539_2.png) [@Yusuf\_Karatoprak](https://discuss.elastic.co/u/Yusuf_Karatoprak)
#### Post date: [January 3, 2020, 7:30am UTC](https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673/1 "2020-01-03T07:30:51Z")

</div>

Hi;

I created some custom headers and trying toget value from value. But it returns me an empty value:

context.request.headers.correlationId : "9e27f9d3-b105-470d-9efb-4cede63ae3d6"

**Kibana version** : 6.8.1

**Elasticsearch version** : 6.8.1

**APM Server version** : apm-server-6.8.1

**APM Agent language and version** : C# ,6.8.1

**Browser version** : chrome last

---

<div class="post-metadata">

### Author: ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)
#### Post date: [January 3, 2020, 9:55am UTC](https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673/2 "2020-01-03T09:55:02Z")

</div>

Hi @Yusuf_Karatoprak

I remember we started discussing this previously 🙂

Could you tell me what you would like to achieve?

We automatically place the correlation id into an HTTP header, and the name of this header is `elastic-apm-traceparent`. By default this should make tracing across services work out of the box.

Now, if you use something where this does not work, because it’s an unsupported technology, then we have [an API for that](https://www.elastic.co/guide/en/apm/agent/dotnet/current/public-api.html#manually-propagating-distributed-tracing-context).

Unfortunately that’s all I can say now, but let’s follow up if your question is not answered. If I get more context hopefully I’ll be able to give a more useful answer.

---

<div class="post-metadata">

### Author: ![Yusuf\_Karatoprak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yusuf_karatoprak/32/44539_2.png) [@Yusuf\_Karatoprak](https://discuss.elastic.co/u/Yusuf_Karatoprak)
#### Post date: [January 20, 2020, 7:11am UTC](https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673/3 "2020-01-20T07:11:51Z")

</div>

Hi @GregKalapos , yes I read your response for my question. Your apm solution is awesome. I want to tell to you my issue with sample. First sample is working second is not working Why?

error.id : "00b684caebec44812a0776ebb5ededa1" (working)  
context.request.headers.correlationid : "701f904f-dc04-484e-a2e9-2483c3d586bf" (notworking)

---

<div class="post-metadata">

### Author: ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)
#### Post date: [January 27, 2020, 3:31pm UTC](https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673/4 "2020-01-27T15:31:33Z")

</div>

@Yusuf_Karatoprak, how does this work?

```auto
context.request.headers.correlationid

```

Is this some custom property you created? I assume this reads HTTP headers, right? If so, what is the name of the header that this reads? If it's `correlationid` (as I'd assume that it matches the name of the property) then that is the reason why it does not work - our correlation id is stored in the HTTP header with name `elastic-apm-traceparent` (but keep in mind this will change in the future).

---

<div class="post-metadata">

### Author: ![Yusuf\_Karatoprak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yusuf_karatoprak/32/44539_2.png) [@Yusuf\_Karatoprak](https://discuss.elastic.co/u/Yusuf_Karatoprak)
#### Post date: [January 30, 2020, 3:01pm UTC](https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673/5 "2020-01-30T15:01:34Z")

</div>

Unfortunately, it doesn't work . "context.request.headers.correlationid"

---

<div class="post-metadata">

### Author: ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)
#### Post date: [January 30, 2020, 3:55pm UTC](https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673/6 "2020-01-30T15:55:18Z")

</div>

What I meant is: what does `context.request.headers.correlationid` do? Is it a C# property as described above?

I get that it does not work as you intended it to work, I just try to figure out how is it implemented.

---

<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: [February 20, 2020, 11:55am UTC](https://discuss.elastic.co/t/how-can-i-access-headers-or-custom-headers-in-apm/213673/7 "2020-02-20T11:55:19Z")

</div>

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