# Limit number of bytes read from a file

**URL:** <https://discuss.elastic.co/t/limit-number-of-bytes-read-from-a-file/200497>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [September 20, 2019, 9:45pm UTC](https://discuss.elastic.co/t/limit-number-of-bytes-read-from-a-file/200497 "2019-09-20T21:45:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kumarabhi](https://avatars.discourse-cdn.com/v4/letter/k/6a8cbe/32.png) [@kumarabhi](https://discuss.elastic.co/u/kumarabhi)\
**Post date:** [September 20, 2019, 9:45pm UTC](https://discuss.elastic.co/t/limit-number-of-bytes-read-from-a-file/200497/1 "2019-09-20T21:45:34Z")

</div>

Is there an option which can limit the number of bytes to be read from a file ?  
Some of the users are creating jobs that has very large log files and in that case i do not  
want to index all data but limit to a specific total\_bytes value for that file.

I have looked at the exclude\_lines and include\_lines option but users can get creative and abuse the system.

Thanks  
Abhi

---

<div class="post-metadata">

**Author:** ![kumarabhi](https://avatars.discourse-cdn.com/v4/letter/k/6a8cbe/32.png) [@kumarabhi](https://discuss.elastic.co/u/kumarabhi)\
**Post date:** [September 20, 2019, 9:55pm UTC](https://discuss.elastic.co/t/limit-number-of-bytes-read-from-a-file/200497/2 "2019-09-20T21:55:32Z")

</div>

I may be able to achieve it with drop event processor ([https://www.elastic.co/guide/en/beats/filebeat/master/drop-event.html](https://www.elastic.co/guide/en/beats/filebeat/master/drop-event.html))

---

<div class="post-metadata">

**Author:** ![kumarabhi](https://avatars.discourse-cdn.com/v4/letter/k/6a8cbe/32.png) [@kumarabhi](https://discuss.elastic.co/u/kumarabhi)\
**Post date:** [September 23, 2019, 5:45pm UTC](https://discuss.elastic.co/t/limit-number-of-bytes-read-from-a-file/200497/3 "2019-09-23T17:45:24Z")

</div>

processors:  
- drop\_event:  
when:  
range:  
log.offset.gte: 1048550

---

<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 21, 2019, 5:47pm UTC](https://discuss.elastic.co/t/limit-number-of-bytes-read-from-a-file/200497/4 "2019-10-21T17:47:33Z")

</div>

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