# Exclude line regex wont work

**URL:** <https://discuss.elastic.co/t/exclude-line-regex-wont-work/101855>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [September 26, 2017, 1:54pm UTC](https://discuss.elastic.co/t/exclude-line-regex-wont-work/101855 "2017-09-26T13:54:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thunder](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Thunder](https://discuss.elastic.co/u/Thunder)\
**Post date:** [September 26, 2017, 1:54pm UTC](https://discuss.elastic.co/t/exclude-line-regex-wont-work/101855/1 "2017-09-26T13:54:18Z")

</div>

Hi,

I trying to exclude lines from the logs.  
Some lines from the log:  
Connect from 192.168.3.6:54422 to 192.168.3.2:3306 (mysql/TCP)  
[26/Sep/2017:00:19:50 +0200] 94.0.38.45 - - "" 408 160 "" "" 58010 859 "www~" "www" "" -1 -1 -1 -1 600124 cR-- 200 200 0 0 0 0 0  
Connect from 192.168.3.14:60552 to 192.168.3.2:3306 (mysql/TCP)  
Connect from 192.168.3.6:34000 to 192.168.3.2:11211 (couchbase/TCP)  
[26/Sep/2017:00:31:18 +0200] 82.112.195.218 - - "GET /index.php HTTP/1.1" 200 2965 "" "" 20429 864 "www" "www\_servers" "MOON" 21 0 0 175 196 --NI 199 199 10 11 0 0 0

My regex from filebeat.yml  
exclude\_lines: ['^Connect']

As you can see on playground ( [https://play.golang.org/p/5O2geFTGhg](https://play.golang.org/p/5O2geFTGhg) ) it works fine, but on my test server it wont exclude those lines.

What I'm missing?

Thanks Robert

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [September 26, 2017, 1:56pm UTC](https://discuss.elastic.co/t/exclude-line-regex-wont-work/101855/2 "2017-09-26T13:56:29Z")

</div>

Please share your config file (use three backticks before and after to get proper formatting [it's markdown]). What version are you using?

---

<div class="post-metadata">

**Author:** ![Thunder](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Thunder](https://discuss.elastic.co/u/Thunder)\
**Post date:** [September 26, 2017, 2:21pm UTC](https://discuss.elastic.co/t/exclude-line-regex-wont-work/101855/3 "2017-09-26T14:21:22Z")

</div>

Hi, I'm using: filebeat version 5.6.1 (amd64), libbeat 5.6.1

```auto
filebeat.prospectors:
- input_type: log
  paths:
    - /var/log/archive/2017/lb0?/haproxy/??/192.168.3.2?.haproxyinflog.??

exclude_lines: ['^Connect']

#----------------------------- Logstash output --------------------------------
output.logstash:
  hosts: ["localhost:5043"]

#================================ Logging =====================================
logging.level: info
logging.selectors: ["*"]

```

---

<div class="post-metadata">

**Author:** ![tudor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tudor/32/3753_2.png) [@tudor](https://discuss.elastic.co/u/tudor)\
**Post date:** [September 26, 2017, 2:30pm UTC](https://discuss.elastic.co/t/exclude-line-regex-wont-work/101855/4 "2017-09-26T14:30:42Z")

</div>

The `exclude_lines` option should be indented another two spaces, so that it applies to the prospector, not global.

---

<div class="post-metadata">

**Author:** ![Thunder](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Thunder](https://discuss.elastic.co/u/Thunder)\
**Post date:** [September 28, 2017, 9:16am UTC](https://discuss.elastic.co/t/exclude-line-regex-wont-work/101855/5 "2017-09-28T09:16:18Z")

</div>

Thanks, that solved my problem.

---

<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:** [October 26, 2017, 9:17am UTC](https://discuss.elastic.co/t/exclude-line-regex-wont-work/101855/6 "2017-10-26T09:17:16Z")

</div>

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