# Logstash change port

**URL:** <https://discuss.elastic.co/t/logstash-change-port/285895>\
**Category:** Logstash\
**Created:** [October 5, 2021, 9:03am UTC](https://discuss.elastic.co/t/logstash-change-port/285895 "2021-10-05T09:03:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mangeshs](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mangeshs](https://discuss.elastic.co/u/mangeshs)\
**Post date:** [October 5, 2021, 9:03am UTC](https://discuss.elastic.co/t/logstash-change-port/285895/1 "2021-10-05T09:03:21Z")

</div>

Logstash is running on 9600 by default and I want to run another logstash on same system  
Is there opion to change default port for logstash  
I don't want to use beats for this.  
beacuse I want to run two logstash with different conf files  
and  
If have change configuration in conf file I want to get data from already present files.  
Logstash is taking those files but elastic isn't. Can anyone help me??

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [October 5, 2021, 11:52am UTC](https://discuss.elastic.co/t/logstash-change-port/285895/2 "2021-10-05T11:52:18Z")

</div>

You can with multiple Logstash Inputs... eg

> **[Beats input plugin | Logstash Reference \[7.15\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html)**

Also with multiple protocols

```auto
input 
{
    tcp 
    {
        id => "main_tcp"
        port => "5043"
        codec => json
    }

    udp
    {
        id => "main_udp"
        port => 12201
        codec => "json"
    }
}

```

Logstash will bind to what you specify in the \*.conf files

---

<div class="post-metadata">

**Author:** ![mangeshs](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mangeshs](https://discuss.elastic.co/u/mangeshs)\
**Post date:** [October 5, 2021, 12:06pm UTC](https://discuss.elastic.co/t/logstash-change-port/285895/3 "2021-10-05T12:06:55Z")

</div>

I found the solution  
by editing logstash.yml file at config dir

```auto
http.host: "0.0.0.0"
#
# Bind port for the metrics REST endpoint, this option also accept a range
# (9600-9700) and logstash will pick up the first available ports.
#
http.port: 9650

```

but now already existing files are not indexing

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [October 5, 2021, 12:12pm UTC](https://discuss.elastic.co/t/logstash-change-port/285895/4 "2021-10-05T12:12:56Z")

</div>

That is for a different endpoint, the ports for ingesting data are controlled via the inputs modules, where 5044 is default. You are looking at the Logstash Configuration instead of the pipeline configuration

---

<div class="post-metadata">

**Author:** ![mangeshs](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mangeshs](https://discuss.elastic.co/u/mangeshs)\
**Post date:** [October 5, 2021, 12:41pm UTC](https://discuss.elastic.co/t/logstash-change-port/285895/5 "2021-10-05T12:41:46Z")

</div>

```auto
input {
	file{
		path => "/logs/archived/*.log"
		codec => multiline{
			pattern => "^[0-9]{4}-[0-9]{2}-[0-9]{2}"
			negate => true
			what => "previous"
	}
  }
}
filter{
	grok {
		match => {"message" => "%{TIMESTAMP_ISO8601:time_stamp}\s%{WORD:log_level}\s%{JAVACLASS:class}\s(\[%{DATA:thread}\])\s+(?<msg>(.|\r|\n)*)"}
	}
	mutate{
		gsub => ["time_stamp", " ", "T"]
	}
	mutate{
		gsub => ["time_stamp", ",", "."]
	}
	mutate{
		replace => {"time_stamp" => "%{time_stamp}Z"}
	}
}
output{
	stdout{
		codec => rubydebug
	}
	elasticsearch {
		hosts => ["http://0.0.0:9200"]
		index => "index-log"
  }
}

```

I am taking files from this path and if I made changes in config file I want to index already present files again

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [October 5, 2021, 1:05pm UTC](https://discuss.elastic.co/t/logstash-change-port/285895/6 "2021-10-05T13:05:02Z")

</div>

If you are using logstash to ingest a file, why do you need to change the logstash port number (5044)?

---

<div class="post-metadata">

**Author:** ![mangeshs](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@mangeshs](https://discuss.elastic.co/u/mangeshs)\
**Post date:** [October 6, 2021, 7:28am UTC](https://discuss.elastic.co/t/logstash-change-port/285895/7 "2021-10-06T07:28:37Z")

</div>

I want to use two config files and two logstash running so thats why

---

<div class="post-metadata">

**Author:** ![zx8086](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zx8086/32/94917_2.png) [@zx8086](https://discuss.elastic.co/u/zx8086)\
**Post date:** [October 6, 2021, 12:56pm UTC](https://discuss.elastic.co/t/logstash-change-port/285895/8 "2021-10-06T12:56:30Z")

</div>

You can use multiple pipelines and each pipeline listens on a different port up specify on the Logstash Input Module

> **[Multiple Pipelines | Logstash Reference \[7.15\] | Elastic](https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html)**

> **[Beats input plugin | Logstash Reference \[7.15\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html)**

> **[Tcp input plugin | Logstash Reference \[7.15\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-tcp.html)**

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 11, 2021, 1:06am UTC](https://discuss.elastic.co/t/logstash-change-port/285895/9 "2021-10-11T01:06:54Z")

</div>

This is a much better, and the recommended approach @mangeshs.

---

<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:** [November 8, 2021, 1:07am UTC](https://discuss.elastic.co/t/logstash-change-port/285895/10 "2021-11-08T01:07:37Z")

</div>

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