# Filtering messages from Logstash codec rubydebug output

**URL:** <https://discuss.elastic.co/t/filtering-messages-from-logstash-codec-rubydebug-output/339212>\
**Category:** Logstash\
**Created:** [July 25, 2023, 3:15pm UTC](https://discuss.elastic.co/t/filtering-messages-from-logstash-codec-rubydebug-output/339212 "2023-07-25T15:15:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaeemmasood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaeemmasood/32/102383_2.png) [@zaeemmasood](https://discuss.elastic.co/u/zaeemmasood)\
**Post date:** [July 25, 2023, 3:15pm UTC](https://discuss.elastic.co/t/filtering-messages-from-logstash-codec-rubydebug-output/339212/1 "2023-07-25T15:15:06Z")

</div>

Our logtsash conf file is using tcp input plugin to ingest messages from different ports.

The output part is as follows:

```auto
output {

    if [@metadata][indexPrefix] {

        file {
                path => "/opt/total/logs/ts/TCS_multi_debug.log"
                codec => rubydebug
                }

    elasticsearch {
     hosts => ["xx-xx-xx-xx:33045"]
     hosts => ["xx-xx-xx-xx:33045"]
     hosts => ["xx-xx-xx-xx:33045"]
     hosts => ["xx-xx-xx-xx:33045"]
     user => "elastic"
     password => "xxxxxxxxxxxxxx"
     index => "%{[@metadata][indexPrefix]}-%{+YYYY.MM.dd}"
     action => "index"
                        }
                }

        }

```

I want the `/opt/total/logs/ts/TCS_multi_debug.log` to **only** show/ write all messages related to a particular port in the **input** section.

Please guide me on how to achieve this.

Thanks

---

<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:** [August 22, 2023, 3:15pm UTC](https://discuss.elastic.co/t/filtering-messages-from-logstash-codec-rubydebug-output/339212/2 "2023-08-22T15:15:26Z")

</div>

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