# Excluding AWS ALB Health check from nginx logs

**URL:** <https://discuss.elastic.co/t/excluding-aws-alb-health-check-from-nginx-logs/108149>\
**Category:** Logstash\
**Created:** [November 17, 2017, 2:49pm UTC](https://discuss.elastic.co/t/excluding-aws-alb-health-check-from-nginx-logs/108149 "2017-11-17T14:49:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kersmacko](https://avatars.discourse-cdn.com/v4/letter/k/65b543/32.png) [@kersmacko](https://discuss.elastic.co/u/kersmacko)\
**Post date:** [November 17, 2017, 2:49pm UTC](https://discuss.elastic.co/t/excluding-aws-alb-health-check-from-nginx-logs/108149/1 "2017-11-17T14:49:09Z")

</div>

Hello,

I've got a couple of NGINX instances running behind an ALB in AWS. I have Logstash forwarding the instances' access logs to elastic search instances. I've been trying to filter out the ELB health checks from being push to Elastic Search. Something like this:

output {  
if "[@metadata][user\_agent]" != "ELB-HealthChecker/2.0" {  
elasticsearch {  
hosts =\> "[XX.XXX.XX.XXX:9200](http://XX.XXX.XX.XXX:9200)"  
manage\_template =\> false  
index =\> "nginx-%{+YYYY.MM.dd}"  
document\_type =\> "%{[@metadata][type]}"  
}  
}

I tried going the other way too. Creating a new filter and using the the drop plugin. Something to the effect of:

filter {  
if "[nginx][access][user\_agent]" == "ELB-HealthChecker/2.0" {drop {}}  
}

neither of these seem to exclude the health checks from Elastic.

---

<div class="post-metadata">

**Author:** ![Hush077](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hush077/32/22500_2.png) [@Hush077](https://discuss.elastic.co/u/Hush077)\
**Post date:** [November 17, 2017, 7:19pm UTC](https://discuss.elastic.co/t/excluding-aws-alb-health-check-from-nginx-logs/108149/2 "2017-11-17T19:19:15Z")

</div>

```
if ([message] =~ /^.*HealthChecker.*/) {
  drop {}
}
```

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 21, 2017, 6:21am UTC](https://discuss.elastic.co/t/excluding-aws-alb-health-check-from-nginx-logs/108149/3 "2017-11-21T06:21:29Z")

</div>

What does an example document you want to drop look like? Use a `stdout { codec => rubydebug { metadata => true } }` output.

---

<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:** [December 19, 2017, 6:21am UTC](https://discuss.elastic.co/t/excluding-aws-alb-health-check-from-nginx-logs/108149/4 "2017-12-19T06:21:31Z")

</div>

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