# Logstash tcp output plugin

**URL:** https://discuss.elastic.co/t/logstash-tcp-output-plugin/364933
**Category:** Logstash
**Created:** [August 14, 2024, 9:08pm UTC](https://discuss.elastic.co/t/logstash-tcp-output-plugin/364933 "2024-08-14T21:08:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pradeep-logstashuser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pradeep-logstashuser/32/138018_2.png) [@pradeep-logstashuser](https://discuss.elastic.co/u/pradeep-logstashuser)
#### Post date: [August 14, 2024, 9:08pm UTC](https://discuss.elastic.co/t/logstash-tcp-output-plugin/364933/1 "2024-08-14T21:08:50Z")

</div>

Hi,

I am using the Logstash TCP output plugin, and even though I removed the `host` field from my event, I still receive the `%host` string at the beginning of the event string. Is there any option to remove that? When I print the `message` in the console, it prints exactly as expected without the `%host` string. However, when I use the file output plugin, the same issue occurs.

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [August 14, 2024, 9:43pm UTC](https://discuss.elastic.co/t/logstash-tcp-output-plugin/364933/2 "2024-08-14T21:43:06Z")

</div>

Are you setting the codec option on the output?

If you run

```
input { generator { count => 1 lines => ['Hello, world!'] } }
output { stdout { codec => line { } } }
output { stdout { codec => line { format => "%{message}" } } }

```

then the first output will produce

```
2024-08-14T21:50:59.332452045Z %{host} Hello, world!

```

and the second will produce

```
Hello, world!

```

That is because if the format option is not specified then it just calls .to\_s on the event, and that [adds](https://github.com/elastic/logstash/blob/d4519711a692f290c0d9e87401fb5d679f9385ff/logstash-core/src/main/java/org/logstash/Event.java#L418) the timestamp and host.

---

<div class="post-metadata">

### Author: ![pradeep-logstashuser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pradeep-logstashuser/32/138018_2.png) [@pradeep-logstashuser](https://discuss.elastic.co/u/pradeep-logstashuser)
#### Post date: [August 16, 2024, 6:09am UTC](https://discuss.elastic.co/t/logstash-tcp-output-plugin/364933/3 "2024-08-16T06:09:39Z")

</div>

Thank you so much for your response .it's working fine.
