# Filter spans based on response header and add a custom label

**URL:** <https://discuss.elastic.co/t/filter-spans-based-on-response-header-and-add-a-custom-label/275475>\
**Category:** APM\
**Tags:** rum\
**Created:** [June 9, 2021, 4:16pm UTC](https://discuss.elastic.co/t/filter-spans-based-on-response-header-and-add-a-custom-label/275475 "2021-06-09T16:16:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brulbi](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@brulbi](https://discuss.elastic.co/u/brulbi)\
**Post date:** [June 9, 2021, 4:16pm UTC](https://discuss.elastic.co/t/filter-spans-based-on-response-header-and-add-a-custom-label/275475/1 "2021-06-09T16:16:54Z")

</div>

Hi guys!

I recently installed apm-server, elasticsearch and Kibana on a Centos 7 test server.

Ths support for APM RUM-JS on apm-server was enabled.

I'm trying to find a way to filter extensions based on response headers and then add a custom label based on the value of that header.  
The response header I want to filter out is "X-Cache-Status" and then based on its "hit, miss, bypass ... '' value, add a custom label to the spam like "cache-status: hit".

Is it possible to implement this configuration in RUM-JS?

The purpose is to filter the spans and aggregate data, based on this custom label on kibana dashboards.

I've read some documentation for the RUM-JS agent, but I don't see any example response headers from some requests being used to enrich data sent by RUM-JS.  
Envoirment:  
**Kibana version** : 7.13

**Elasticsearch version** : 7.13

**APM Server version** : 7.13

**APM Agent language and version** : RUM-JS 5.8

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: yum in a centos 7

**Fresh install**

Thank you so much for everyone's help!

---

<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:** [June 30, 2021, 12:17pm UTC](https://discuss.elastic.co/t/filter-spans-based-on-response-header-and-add-a-custom-label/275475/2 "2021-06-30T12:17:40Z")

</div>

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