0

Can I specify the service name in Logstash input plugin?

I'm deploying Opensearch with logstash in local Kubernetes cluster. And i have a java application in local kubernetes with service:

kind: Service
apiVersion: v1
metadata:
  name: kube-test-service
  namespace: default
spec:
  selector:
    app: kube-test-pod
  ports:
  - name: http
    port: 8083

My logstash configuration looks like:

    input {
      http {
        host => "kube-test-service"
        port => 8083
      }
    }

    output {
      opensearch {
        hosts => ["http://opensearch:9200"]
        index => "opensearch-logstash-docker-%{+YYYY.MM.dd}"
        user => "user"
        password => "password"
      }
      stdout {}
    }

If I call the service from the Logstash pod using curl, I get a response. However, when I specify a similar host in the configuration, I get an error:

[ERROR] 2024-06-16 11:11:10.857 [[main]<http] javapipeline - A plugin had an unrecoverable error. Will restart this plugin.
  Pipeline_id:main
  Plugin: <LogStash::Inputs::Http host=>"kube-test-service", port=>8083, id=>"fc36dfe33a8e39a77d92b4045e2e6892c7360d08cb6dea7889d6b6cdefdb6484", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_d5456350-dcce-4408-8602-1792377af16e", enable_metric=>true, charset=>"UTF-8">, ssl=>false, ssl_enabled=>false, ssl_client_authentication=>"none", ssl_verify_mode=>"none", ssl_handshake_timeout=>10000, ssl_cipher_suites=>["TLS_AES_256_GCM_SHA384", "TLS_AES_128_GCM_SHA256", "TLS_CHACHA20_POLY1305_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256"], ssl_supported_protocols=>["TLSv1.2", "TLSv1.3"], additional_codecs=>{"application/json"=>"json"}, response_headers=>{"Content-Type"=>"text/plain"}, threads=>12, max_pending_requests=>200, max_content_length=>104857600, response_code=>200, verify_mode=>"none", tls_min_version=>1, tls_max_version=>1.3>
  Error: Cannot assign requested address
  Exception: Java::JavaNet::BindException

1 Answer 1

0

That error message indicates that Logstash was unable to open the configured TCP/8083 listening port for some reason. Typically this is because something else is already using it.

1
  • Hmm, I have a pretty simple cluster where port 8083 is set for one pod. How can I check if the port is busy? Commented Jun 17 at 14:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .