title: Connecting Logstash to Kafka in Azure through public IP
body: <p>I'm having trouble connecting Logstash to my Kafka instance running in Azure. My kafka host has a static public IP address. Everything works fine if I spool up a Logstash machines inside the same subnet and connect the two. But, when I try to send data to the kafka instance via the public IP address, I receive errors. For example, trying to connect my Logstash instance from home to the Azure cloud environment. </p>
  
  <p>Here are the relevant config files and what I have tried:</p>
  
  <p>Logstash output:</p>
  
  <pre><code>  kafka {
      bootstrap_servers =&gt; "my public ip:9092"
      codec =&gt; json
      topic_id =&gt; "tagger"
    }
  </code></pre>
  
  <p>Before proceeding, netcat verified that I can indeed reach the port on kafka, there is not a firewall in between blocking the connection.</p>
  
  <p>Here is my kafka <strong>server.properties</strong> file with the settings I have tried based on similar problems in other answers.</p>
  
  <pre><code>#--------------------------------------------------------#
  #Logstash says: Sending batch to Kafka failed. Will retry after a delay. {:batch_size=&gt;1, :failures=&gt;1, :sleep=&gt;0.01}
  #advertised.listeners=PLAINTEXT://10.10.100.4:9092
  #listeners=PLAINTEXT://10.10.100.4:9092
  #--------------------------------------------------------#
  #Logstash says: Sending batch to Kafka failed. Will retry after a delay. {:batch_size=&gt;1, :failures=&gt;1, :sleep=&gt;0.01}
  #advertised.listeners=PLAINTEXT://10.10.100.4:9092
  #listeners=PLAINTEXT://0.0.0.0:9092
  #--------------------------------------------------------#
  #Logstash says: Error while fetching metadata with correlation id 1 : {tagger=LEADER_NOT_AVAILABLE}
  #advertised.listeners=PLAINTEXT://publicip:9092
  #listeners=PLAINTEXT://0.0.0.0:9092
  #--------------------------------------------------------#
  #Logstash says: Error while fetching metadata with correlation id 1 : {tagger=LEADER_NOT_AVAILABLE}
  #advertised.listeners=PLAINTEXT://publicip:9092,SEC://10.10.100.4:9093
  #listeners=PLAINTEXT://0.0.0.0:9092,SEC://10.10.100.4:9093
  #--------------------------------------------------------#
  #Logstash says: Error while fetching metadata with correlation id 1 : {tagger=LEADER_NOT_AVAILABLE}
  advertised.listeners=PLAINTEXT://publicip:9092
  advertised.hostname=dnsname.com
  </code></pre>
  
  <p>Lastly, here is the config that worked for me fine when I was running Logstash and Kafka in the same subnet in the Azure environment:</p>
  
  <pre><code>listeners=PLAINTEXT://10.10.100.4:9092,SSL://10.10.100.4:9093
  advertised.listeners=PLAINTEXT://10.10.100.4:9092,SSL://10.10.100.4:9093
  </code></pre>
  
  <p>This is driving me crazy, Thank you for any help as I continue looking</p>