# FileBeat EOF Error

**URL:** <https://discuss.elastic.co/t/filebeat-eof-error/60882>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [September 19, 2016, 12:38pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882 "2016-09-19T12:38:56Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Maxwell\_Flanders](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Maxwell\_Flanders](https://discuss.elastic.co/u/Maxwell_Flanders)\
**Post date:** [September 23, 2016, 2:41pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/21 "2016-09-23T14:41:34Z")

</div>

Hey guys, I found the root of our issue was actually on a misconfigured filter on the logstash end that was clogging the filter workers queue. I guess that manifested itself eventually in filebeats's logs.

Edit: Posted this in wrong thread. Copying it to the correct thread that I started: [Missing a lot of logs sent via filebeats](https://discuss.elastic.co/t/missing-a-lot-of-logs-sent-via-filebeats/61185/7)

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [September 23, 2016, 3:57pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/22 "2016-09-23T15:57:56Z")

</div>

It's a combination of filters/outputs in logstash slowing down inputs + beats input closing connection if this happens.

Related github issue for most recent LS beats input plugin: [https://github.com/logstash-plugins/logstash-input-beats/issues/141](https://github.com/logstash-plugins/logstash-input-beats/issues/141)

Workarounds: older versions require you to increase `congestion_threshold`, newer versions require you to increase `client_inactivity_timeout`. In either case it's a good idea trying to figure out the reason for the slowdowns in LS, like some expensive filters.

---

<div class="post-metadata">

**Author:** ![Maxwell\_Flanders](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Maxwell\_Flanders](https://discuss.elastic.co/u/Maxwell_Flanders)\
**Post date:** [September 23, 2016, 4:04pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/23 "2016-09-23T16:04:11Z")

</div>

Yeah mine was a case where we had a DNS filter with the wrongs dns ip's in it, so it was doomed to utter failure. However, in cases where honest throughput is just so heavy that it slows you these tools could still definitely help. Would increasing logstash worker number or increasing filebeat worker numbers be expected to help in a situation like that??

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [September 27, 2016, 9:32am UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/24 "2016-09-27T09:32:55Z")

</div>

there are a number of options in filebeat to increase throughput (some at the cost of increased memory usage).

e.g. `filebeat.publish_async` and `output.logstash.pipelined`. Adding workers + enabling load balancing can increase throughput as well (depends on mix of workers, `filebeat.spool_size` and `output.logstash.bulk_max_size`).

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 7, 2016, 9:54am UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/25 "2016-10-07T09:54:19Z")

</div>

Hi, sadly our test did not proceed well, none of the above workaround worked 100%, we were still getting that error.  
As we had the opportunity, we moved to a larger cluster: 3 HUGE machines. We expected one of them to be able to take the whole load but we used 3 for test.

It happened again. EOF

Thus it could not be a problem of fully loaded machine so we moved to changing other parameters.  
We found out that removing `load_balance` in filebeat solved the problem, or at least it seems to.

Again using only 1 single logstash output in filebeat works good (we split our source in 3 group and each group goes to one LS machine), now we have this configuration from 24h and it's working pretty well.

This is not a good solution for us, as we have a cluster of machines we wants it to be working efficiently and reliably.  
Do you have any idea on why this is happening? how may we solve it?

thanks

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [October 7, 2016, 3:24pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/26 "2016-10-07T15:24:36Z")

</div>

can you elaborate which setups + configs did you try exactly and how they failed (too slow, filebeat getting stuck...)?

Did you update the beats input plugin?

Did you set `client_inactivity_timeout` to 15 minutes?

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 7, 2016, 4:52pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/27 "2016-10-07T16:52:40Z")

</div>

Yes I did, but just little improvements

now I have logstash with 24 workers 8GB of heap space, everything else is default as you suggested (better machines, no throughput problems!)  
filebeat default batch size and time

they fail with the EOF error in filebeat and no log being collected form that machine.  
now I have the same configuration, no load balancer, logger machines are divided in group and each group mapped one single LS node, and it is working

filter I use are just elapsed, grok and mutate as of now, i don't want to extend before I know it is working

thanks

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [October 7, 2016, 10:06pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/28 "2016-10-07T22:06:17Z")

</div>

can you share logs from logstash and filebeat + filebeat configuration + logstash beats input settings? EOF (end of file) is triggered by some remote closing the socket for whatever reason, it's not in the control of filebeat itself. I don't see how proper load-balancing in filebeat can trigger an EOF in filebeat, besides potential longer waiting times. Plus beats should reconnect upon EOF, that is, it's not really be critical.

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 10, 2016, 8:52am UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/29 "2016-10-10T08:52:05Z")

</div>

after 2 days running, EOF came out also with the configuration without load\_balance.

this is the stats from kibana -\> I connected the filebeat log itself (it has been cut but the search is in kibana is "EOF")  
it seems that they appear especially during night (off-load period)

 ![](https://us1.discourse-cdn.com/elastic/original/2X/0/0e69607231c068958370076eccebee912aa251c6.png)

I just checkd: logs are always the same as above, nothing on logstash side, EOF and ignore\_older on FileBeat side (see topic [https://discuss.elastic.co/t/filebeat-file-is-falling-under-ignore-older/61210/3](https://discuss.elastic.co/t/filebeat-file-is-falling-under-ignore-older/61210/3) )

in filebeat i have lot of prospectors with this configuration

```
- input_type: log

  paths:
    - d:Logger\2
  exclude_lines: ["^\\s*$"]
  include_lines: ["^([a-z]|[A-Z])"]
  fields:
    catena: 11
  fields_under_root: true
  ignore_older: 10m
  close_inactive: 2m
  clean_inactive: 15m
  document_type: log2

```

general fb conf are the following

```
output.logstash:
  hosts: ["10.10.10.10"]
  template.name: "filebeat"
  template.path: "filebeat.template.json"
  template.overwrite: false

```

in LS i have the following

LS\_HEAP\_SIZE="8g"  
LS\_OPTS="-b 1000 -r --verbose"  
LS\_JAVA\_OPTS="{LS\_JAVA\_OPTS} -Djava.io.tmpdir={LS\_HOME} -Xms8g"

I've checked di JVM stats and they seems to be very good

LS1

 ![](https://us1.discourse-cdn.com/elastic/original/2X/a/a75bc8b4364004f8cdc05305beb9748885afda3d.png)

LS2

 ![](https://us1.discourse-cdn.com/elastic/original/2X/3/3985d1f934fcd01246cdc1677879842570e66ac1.png)

LS3

 ![](https://us1.discourse-cdn.com/elastic/original/2X/6/6e9431cdba8ad2bf345d8b7544457d9d1bb60d66.png)

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 10, 2016, 9:19am UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/30 "2016-10-10T09:19:22Z")

</div>

> [@steffens](#):
>
> Did you update the beats input plugin?

@steffens could you please tell me how to update the plugin? thanks!

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [October 10, 2016, 10:39am UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/31 "2016-10-10T10:39:55Z")

</div>

Here is the command how to update the plugin: [https://www.elastic.co/guide/en/beats/libbeat/current/logstash-installation.html#logstash-input-update](https://www.elastic.co/guide/en/beats/libbeat/current/logstash-installation.html#logstash-input-update)

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 10, 2016, 12:25pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/32 "2016-10-10T12:25:18Z")

</div>

We've done it about 3h ago: still 3 EOF messages in the last hour (as expected they arrive during lunch time when load is low, now it's increasing again. next will be this evening when load is decreasing)

---

<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 10, 2016, 12:39pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/33 "2016-10-10T12:39:00Z")

</div>

Closed on October 10, 2016, 12:39pm UTC

This topic was automatically closed after 21 days. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [October 10, 2016, 1:26pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/34 "2016-10-10T13:26:22Z")

</div>

Opened on October 10, 2016, 1:26pm UTC



---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [October 10, 2016, 1:31pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/35 "2016-10-10T13:31:33Z")

</div>

Can you please share you beats input configuration in logstash + logs from logstash at times you discovered the timeouts?

As I said, EOF is not critical, as beats will reconnect. Logstash might still close connection if it finds connection to be "idle" (e.g. very very low sending rate). Which seems to be the case here. Once beats finds it has new events to send it will reconnect and send events. If load-balancing is used, these idle-phases will increase in duration, that's why connections being closed in case of load-balancing is more likely.

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 10, 2016, 2:23pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/36 "2016-10-10T14:23:37Z")

</div>

here it is!

```
 beats {
                port => 5044
                client_inactivity_timeout => 300
        }

```

nothing in logstash side ☹

this is part of last night: from 22 to 3

```
{:timestamp=>"2016-10-09T22:48:59.983000+0200", :message=>"Elapsed, 'end event' received", :end_tag=>"dsc_start_finished", :unique_id_field=>"thread_id", :level=>:info}
{:timestamp=>"2016-10-09T22:49:00.012000+0200", :message=>"Elapsed, 'start event' received", :start_tag=>"dsc_start_called", :unique_id_field=>"thread_id", :level=>:info}
{:timestamp=>"2016-10-10T03:00:07.358000+0200", :message=>"Elapsed, 'start event' received", :start_tag=>"dsc_start_called", :unique_id_field=>"thread_id", :level=>:info}
{:timestamp=>"2016-10-10T03:00:11.354000+0200", :message=>"Elapsed, 'start event' received", :start_tag=>"dsc_start_called", :unique_id_field=>"thread_id", :level=>:info}

```

During night your idea might hold, but during lunch time we are not at absolute zero, today we received 3 EOF but logs arrived at an average rate of 30 of logs per second. below the trend on the machine, the EOF arrived at 13.55.50 after 2 minutes at 30 l/s

 ![](https://us1.discourse-cdn.com/elastic/original/2X/d/d7f150f9c1bf8f74bff35a7ae6ed0e15667de8a0.png)

in this topic [https://discuss.elastic.co/t/filebeat-file-is-falling-under-ignore-older/61210/4](https://discuss.elastic.co/t/filebeat-file-is-falling-under-ignore-older/61210/4) @ruflin says that the ignore\_older error might be related to this error, but if this error is not important then what about that one?

I don't get why they are marked as ERR then

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [October 10, 2016, 2:41pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/37 "2016-10-10T14:41:23Z")

</div>

the connection EOF is logged as error, due to beats not being able to tell why connection has been closed by logstash or some device in between. If beats can reconnect, it's all ok. If beats can not reconnect for a long time this error should be taken more serious.

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 11, 2016, 8:16am UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/38 "2016-10-11T08:16:41Z")

</div>

ok but my error stays there for 10 hours during night 3 or 4 times per minute: it's long enough, isn't it?

I don't get why this is intended to work in this way, I have enough capacity, the system is not loaded and it stops connection. It sounds strange to me: I expect it to collect data and ack them until it is ready to process.

Do you have an other solution to solve this in my case? It's strange nobody else found it.  
Put a Redis in the middle may help? I do really need a solution to stop such errors. 😕

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [October 11, 2016, 11:24am UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/39 "2016-10-11T11:24:31Z")

</div>

3 to 4 times per minute is quite a lot. Your settings should be ok for 5 minutes. Any other device or firewall rules in between possibly closing connections? How long does it normally take for filebeat to reconnect?

Checking the [code](https://github.com/logstash-plugins/logstash-input-beats) how the timer is setup it seems to use [netty its IdleStateHandler](https://netty.io/4.0/api/io/netty/handler/timeout/IdleStateHandler.html). Setting `client_inactivity_timeout` to 0 should disable the idle connection closer in logstash.

I found the client timeout code [here](https://github.com/logstash-plugins/logstash-input-beats/blob/master/src/main/java/org/logstash/beats/BeatsHandler.java#L86). Unfortunately the log message is on debug level. Maybe you can change the logging level and recompile.

Have you tried any other values for `client_inactivity_timeout` ?

Have you checked active connection on logstash host via netstat?

If filebeat still get's EOF even with `client_inactivity_timeout` 0 (disables read timer), it's not logstash closing the connection but some other networking unit.

> I don't get why this is intended to work in this way, I have enough capacity, the system is not loaded and it stops connection

I guess Logstash tries to close inactive connections to protect itself from some kind of resource exhaustion regarding zombie-connections. TCP + network devices by nature is pretty fragile. Often times the connection might be dropped by some intermediary device or some service/device just crashing ending with some kind of Zombie-connection. This is due to TCP being stateful + requiring messages in order to synchronise state. Unfortunately sometimes these messages will not be send or received for different reasons ending with one end thinking the connection has been closed and the other end not being aware of any close events. Another property of TCP adding to this effect is, normally no messages are send if nothing needs to be send. That is, TCP implementations can not distinguish between connection loss and idle connection in this case. Your OS might time out idle connections after some amount of time as well (something like 2 hours). Long idle times on server + closes on client can result in hughe amount of zombie-connections taking resources on server. This kind of problem exists for any protocol using long-living TCP connections.

If disabling timer does not work for you, you can still give redis or kafka a try. When using redis be aware of resiliency options in redis, to not loose any logs if redis goes down for example.

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 12, 2016, 2:53pm UTC](https://discuss.elastic.co/t/filebeat-eof-error/60882/40 "2016-10-12T14:53:16Z")

</div>

we try a few parameter per day: now we put close\_inactive\_timeout = 0 and tomorrow we will see

> [@steffens](#):
>
> Any other device or firewall rules in between possibly closing connections? How long does it normally take for filebeat to reconnect?

It's difficult to say: we are working in a very large and complex network, we tried to check but we found nothing, any tcp socket we try to open between our machines is working fine, thus i suppose network is working. We just run a tcpdump on LS machine in a windows where 2 EOF happened. we found about 16 TCP RST from LS to FB  
do you suggest any alternative method to test network?

In netstat I see established connection with all machine we are using

[Previous page](https://discuss.elastic.co/t/filebeat-eof-error/60882.md?page=1)

[Next page](https://discuss.elastic.co/t/filebeat-eof-error/60882.md?page=3)
