# SANITIZE FIELD NAMES in body when contain sensitive values

**URL:** <https://discuss.elastic.co/t/sanitize-field-names-in-body-when-contain-sensitive-values/323626>\
**Category:** APM\
**Tags:** go\
**Created:** [January 20, 2023, 7:29pm UTC](https://discuss.elastic.co/t/sanitize-field-names-in-body-when-contain-sensitive-values/323626 "2023-01-20T19:29:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Antonio\_Pinto\_d](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_antonio_pinto_d/32/116223_2.png) [@Jose\_Antonio\_Pinto\_d](https://discuss.elastic.co/u/Jose_Antonio_Pinto_d)\
**Post date:** [January 20, 2023, 7:29pm UTC](https://discuss.elastic.co/t/sanitize-field-names-in-body-when-contain-sensitive-values/323626/1 "2023-01-20T19:29:47Z")

</div>

I'm trying to sanitize sensitive fields in body, but I can't do this. It's not work to me.

```auto
func NewGorillaMux() Http {
	router := mux.NewRouter().PathPrefix("/").Subrouter()
	router.Use(middleware.NewCorsMiddleware("*").Apply)
	router.Use(middleware.NewAuthorizationMiddleware(getAllPathsAlloweds()).Apply)
	router.Use(middleware.NewContentTypeApplicationJson().Apply)

	apmgorilla.Instrument(router) // APM here

	return GorillaMux{Router: router}
}

```

I'm using environment variables:

```auto
ELASTIC_APM_CAPTURE_BODY=all;
ELASTIC_APM_SANITIZE_FIELD_NAMES=credit_card_namber,password;

```

But when I test my request I can see that it's not work.

I could see on doc "A list of patterns to match the names of HTTP headers, cookies, and POST form fields to redact." and I'm not sure when they said "POST form fields" means request with JSON body too;

So, What's wrong I'm making and how I can do this works?

I'm using by:  
APM Server version v2.2.0:  
APM Agent language and version golang 1.18.1:  
[http://go.elastic.co/apm/module/apmgorilla/v2](http://go.elastic.co/apm/module/apmgorilla/v2)

---

<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 10, 2023, 3:30pm UTC](https://discuss.elastic.co/t/sanitize-field-names-in-body-when-contain-sensitive-values/323626/2 "2023-02-10T15:30:09Z")

</div>

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