Filebeat ships logs to remote logstash

Is it possible filebeat ships logs to remote logstash in differnt network ?

Yes, as long as it's allowed and routable.

So i need to use logstash's public ip and configure ufw to allow traffic from filebeat ip?