# FileBeat How to control the ports used

**URL:** https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296
**Category:** Beats
**Tags:** filebeat
**Created:** [January 2, 2022, 3:27pm UTC](https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296 "2022-01-02T15:27:05Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![gaogao110](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gaogao110/32/99733_2.png) [@gaogao110](https://discuss.elastic.co/u/gaogao110)
#### Post date: [January 2, 2022, 3:27pm UTC](https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296/1 "2022-01-02T15:27:05Z")

</div>

During use, the program will randomly start the port, is there any way to control ?

---

<div class="post-metadata">

### Author: ![legoguy1000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/legoguy1000/32/54301_2.png) [@legoguy1000](https://discuss.elastic.co/u/legoguy1000)
#### Post date: [January 2, 2022, 4:31pm UTC](https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296/2 "2022-01-02T16:31:13Z")

</div>

Randomly start what port? Are u using one of the inputs that listens on a port; udp, tcp, netflow...?

---

<div class="post-metadata">

### Author: ![gaogao110](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gaogao110/32/99733_2.png) [@gaogao110](https://discuss.elastic.co/u/gaogao110)
#### Post date: [January 3, 2022, 12:47pm UTC](https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296/3 "2022-01-03T12:47:13Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/9/49202c29c533e030e4e12a25995f882b6a40d3ff.png)  
ex

For example:  
output to ES fliebeat will launch a random port

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [January 3, 2022, 12:54pm UTC](https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296/4 "2022-01-03T12:54:26Z")

</div>

This is the client port that filebeat is using to connect to Elasticsearch, you do not control that.

---

<div class="post-metadata">

### Author: ![gaogao110](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gaogao110/32/99733_2.png) [@gaogao110](https://discuss.elastic.co/u/gaogao110)
#### Post date: [January 3, 2022, 1:08pm UTC](https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296/5 "2022-01-03T13:08:21Z")

</div>

Thank you reply

```
  I think it is necessary in the scenario of strict port management, 
  Because the server can only open a fixed single port.

  Is there any solution to this problem?
```

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [January 3, 2022, 1:23pm UTC](https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296/6 "2022-01-03T13:23:30Z")

</div>

I'm sorry, but I do not see any issue or problem.

Your server is not listening on that `54998` port, this port was created by the filebeat process to communicate with your Elasticsearch, it is a client port for the TCP connection, it can be any port in the available port ranges, which is normally from `1024` to `65535`.

There is no option in filebeat to limit this client port, if you can only use a specific range, than you will need to change this in the operating system level, which is out of the scope of this forum and should be done with caution as this can impact your system.

---

<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: [January 31, 2022, 3:24pm UTC](https://discuss.elastic.co/t/filebeat-how-to-control-the-ports-used/293296/7 "2022-01-31T15:24:04Z")

</div>

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