# Filebeat exclude\_lines

**URL:** <https://discuss.elastic.co/t/filebeat-exclude-lines/276892>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [June 24, 2021, 8:45am UTC](https://discuss.elastic.co/t/filebeat-exclude-lines/276892 "2021-06-24T08:45:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Betorov](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Betorov](https://discuss.elastic.co/u/Betorov)\
**Post date:** [June 24, 2021, 8:45am UTC](https://discuss.elastic.co/t/filebeat-exclude-lines/276892/1 "2021-06-24T08:45:02Z")

</div>

Hi evreyone,  
I wanted to use exclude\_lines to exlude all line of a file exept the first one. (I want only the name of the file and his path i don't need his message).

```auto
filebeat.inputs:
- type: log
  enabled: true
  #close_eof: true
  #harvester_limit : 1
  exclude_lines: [.]  
  paths:
    - C:\Users\U1\Desktop\file_example\**\*
output.logstash:
  hosts: ["localhost:5044"]

```

My logstash does not receive any data 🙁. I think the reason is that filebeat exclude everything.

---

<div class="post-metadata">

**Author:** ![Betorov](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Betorov](https://discuss.elastic.co/u/Betorov)\
**Post date:** [June 24, 2021, 10:31am UTC](https://discuss.elastic.co/t/filebeat-exclude-lines/276892/3 "2021-06-24T10:31:43Z")

</div>

I don't know how I delete the first post but here it is:  
I do this to take the first value:

```auto
filebeat.inputs:
- type: log
  enabled: true
  #close_eof: true
  #harvester_limit : 1
  max_bytes : 1
  multiline.pattern: '.'
  multiline.match: after
  paths:
    - C:\Users\U1\Desktop\PE22KW-J1\*\**
output.logstash:
  hosts: ["localhost:5044"]

```

but I get this error (and the files are sent multiple times)

```auto
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 335 bytes line
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 91 bytes line
2021-06-24T12:16:11.811+0200 ERROR [reader_line] readfile/line.go:170 Error skipping until new line, err:reader closed
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 24 bytes line
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 307 bytes line
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 86 bytes line
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 873 bytes line
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 65 bytes line
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 380 bytes line
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 24 bytes line
2021-06-24T12:16:11.811+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 23 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 103 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 408 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 89 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 95 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 670 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 2987 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 47 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 29 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 1228 bytes line
2021-06-24T12:16:11.812+0200 WARN [reader_line] readfile/line.go:159 Exceeded 4 max bytes in line limit, skipped 216 bytes line
2021-06-24T12:16:11.812+0200 ERROR [reader_line] readfile/line.go:170 Error skipping until new line, err:reader closed

```

Someone know how to prevent filebeat from trying to send all file?

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [June 24, 2021, 2:35pm UTC](https://discuss.elastic.co/t/filebeat-exclude-lines/276892/4 "2021-06-24T14:35:16Z")

</div>

Hey @Betorov,

> [@Betorov](#):
>
> I want only the name of the file and his path i don't need his message

Filebeat is not thought for this use case, filebeat is thought to collect all the messages in the files, I don't think there is any way to do what you are trying to do.

But if you want to monitor files created in specific folders, you can give a try to auditbeat, that has features for this specific use case, as the [`file_integrity` module.](https://www.elastic.co/guide/en/beats/auditbeat/7.13/auditbeat-module-file_integrity.html)

---

<div class="post-metadata">

**Author:** ![Betorov](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Betorov](https://discuss.elastic.co/u/Betorov)\
**Post date:** [July 21, 2021, 2:37pm UTC](https://discuss.elastic.co/t/filebeat-exclude-lines/276892/5 "2021-07-21T14:37:45Z")

</div>

Thanks for your reply I am going to try it

---

<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:** [August 18, 2021, 4:38pm UTC](https://discuss.elastic.co/t/filebeat-exclude-lines/276892/6 "2021-08-18T16:38:12Z")

</div>

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