# Logstash input tcp keepalive

**URL:** <https://discuss.elastic.co/t/logstash-input-tcp-keepalive/82375>\
**Category:** Logstash\
**Created:** [April 14, 2017, 4:04am UTC](https://discuss.elastic.co/t/logstash-input-tcp-keepalive/82375 "2017-04-14T04:04:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![qin](https://avatars.discourse-cdn.com/v4/letter/q/91b2a8/32.png) [@qin](https://discuss.elastic.co/u/qin)\
**Post date:** [April 14, 2017, 4:04am UTC](https://discuss.elastic.co/t/logstash-input-tcp-keepalive/82375/1 "2017-04-14T04:04:37Z")

</div>

**I use the logstash TCP plugin, this is a server ; In the process of use, The client abnormal disconnected the connection, However the server didn't disconnect, So server TCP connections have been increased;**  
**I try to modify the OS tcp\_keepalive parameters, it is invalid；**

**tcp config:**  
`input { tcp { host => "0.0.0.0" port => 4561 mode => "server" codec => json_lines } } output { stdout{codec =>rubydebug} elasticsearch { hosts => ["host1:9292","host2:9292"] flush_size => 10000 idle_flush_time => 2 index=>"logstash-task-%{taskId}-%{+YYYYMMdd}" } }`

**The number of connections of port 4561：**  
`[root@logstash-01 ~]# netstat -apn | grep 4561 | wc -l 2069 [root@logstash-01 ~]#`

`[root@logstash-01 ~]# sysctl -a | grep keep net.ipv4.tcp_keepalive_intvl = 75 net.ipv4.tcp_keepalive_probes = 9 net.ipv4.tcp_keepalive_time = 1800`

---

<div class="post-metadata">

**Author:** ![qin](https://avatars.discourse-cdn.com/v4/letter/q/91b2a8/32.png) [@qin](https://discuss.elastic.co/u/qin)\
**Post date:** [April 14, 2017, 10:41am UTC](https://discuss.elastic.co/t/logstash-input-tcp-keepalive/82375/2 "2017-04-14T10:41:26Z")

</div>

help me please

---

<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:** [May 12, 2017, 10:51am UTC](https://discuss.elastic.co/t/logstash-input-tcp-keepalive/82375/3 "2017-05-12T10:51:12Z")

</div>

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