# Multiple data sources over same port

**URL:** <https://discuss.elastic.co/t/multiple-data-sources-over-same-port/288598>\
**Category:** Logstash\
**Created:** [November 8, 2021, 8:28am UTC](https://discuss.elastic.co/t/multiple-data-sources-over-same-port/288598 "2021-11-08T08:28:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IsaacKr](https://avatars.discourse-cdn.com/v4/letter/i/c89c15/32.png) [@IsaacKr](https://discuss.elastic.co/u/IsaacKr)\
**Post date:** [November 8, 2021, 8:28am UTC](https://discuss.elastic.co/t/multiple-data-sources-over-same-port/288598/1 "2021-11-08T08:28:28Z")

</div>

We are ingesting data from multiple data sources over port 514 and using Logstash to ship them out to multiple destinations. Is there a way to tag ingested data based on source IP so that it can be forwarded to the correct destination?

Something like

```auto
input {
   udp {
      port => 514
      source_port => x.x.x.x
      tags => "cef"
   }
   udp {
      port => 514
      source_port => y.y.y.y.y
      tags => "syslog"
   }
}

```

Where the source\_port would be the IP of the data source.

---

<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:** [November 8, 2021, 1:20pm UTC](https://discuss.elastic.co/t/multiple-data-sources-over-same-port/288598/2 "2021-11-08T13:20:05Z")

</div>

It depends on how your message looks like, you can use some string from your message to add tags in the `filter` block.

```auto
filter {
    if "something" in [message] {
        mutate {
            add_tag => ["tag"]
        }
    }
}

```

Or you can also parse your message and use a similar condition with the value of specific field, but is not possible to do what you want in the input, there is nothing like that config.

---

<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:** [November 8, 2021, 5:05pm UTC](https://discuss.elastic.co/t/multiple-data-sources-over-same-port/288598/3 "2021-11-08T17:05:31Z")

</div>

The udp input [adds](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-udp.html#plugins-inputs-udp-source_ip_fieldname) the source ip of the the message to the event, so you can add tags conditional upon that. It does not include the source port.

---

<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:** [December 6, 2021, 5:05pm UTC](https://discuss.elastic.co/t/multiple-data-sources-over-same-port/288598/4 "2021-12-06T17:05:53Z")

</div>

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