RabbitMQ and logstash Integration

I have deployed ELK stack in kubernetes cluster which is working fine. Now i have deployed rabbitMQ in the cluster and integrated with logstash so that i can view the message in kibana. My logstash configMap looks like this :

apiVersion: v1
kind: ConfigMap
metadata:
  name: logstash-configmap
  namespace: kube-system
data:
  logstash.yml: |
     http.host: "0.0.0.0"
     path.config: /usr/share/logstash/pipeline
  logstash.conf: |
   
    input {
      rabbitmq{
        host => "rabbitmq-cip-svc"
        port => 15672
        durable => true
      }
    }

     output {
        elasticsearch {
            hosts => [ "elasticsearch-logging:9200" ]
        }
    }

I also checked the config file inside the container using the command below and it has the same configuration as mentioned in the configmap.

kubectl exec logstash-deployment-d85dbdcdc-k662d --stdin --tty – binbash

Now the issue is the connection between rabbitmq and logstash is not working and when i checked the log i can see the following error message.

[INFO ] 2020-07-17 12:27:52.933 [Ruby-0-Thread-1: /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:22] agent - Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>} [INFO ] 2020-07-17 12:27:53.049 [Api Webserver] agent - Successfully started Logstash API endpoint {:port=>9600} [ERROR] 2020-07-17 12:30:03.834 [[main]<rabbitmq] rabbitmq - RabbitMQ connection error, will retry. {:error_message=>“Connection to localhost:5672 refused”, :exception=>“MarchHare::ConnectionRefused”}

Not sure from where it is picking up this configuration. Can someone help regarding this?