Google pubsub plugin not working as expected

I am using the google pub-sub input plugin.
the following is my input configuration

      google_pubsub {
        project_id => "krail-proj-kgov-rai-doc-92zx4"
        topic => "rail_logs"
        subscription => "rail-gov_logs"
        include_metadata => true
        codec => "json"
        json_key_file => "/tmp/keyfile.json"
        type => "google-pubsub-dry"
      }

Iam getting this error:

    [2021-01-12T07:10:44,253][ERROR][logstash.inputs.googlepubsub] io.grpc.StatusRuntimeException: PERMISSION_DENIED: Cloud Pub/Sub API has not been used in project 123456797423 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/pubsub.googleapis.com/overview?project=123456797423 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
    [2021-01-12T07:10:45,459][ERROR][logstash.javapipeline    ][main] A plugin had an unrecoverable error. Will restart this plugin.
      Pipeline_id:main
      Plugin: <LogStash::Inputs::GooglePubSub json_key_file=>"/tmp/keyfile.json", codec=><LogStash::Codecs::JSON id=>"json_1ddd860a-c40a-4f76-a648-37382947c69", enable_metric=>true, charset=>"UTF-8">, project_id=>"krail-proj-kgov-rai-doc-92zx4", topic=>"rail_logs", subscription=>"rail-gov_logs", id=>"447ddss3d8ad64ac50b32c22f623ccc344324887343seeeceddefe372", include_metadata=>true, type=>"google-pubsub-dry", enable_metric=>true, max_messages=>5, create_subscription=>false>
      Error: Expected the service InnerService [FAILED] to be TERMINATED, but the service has FAILED
     Exception: Java::JavaLang::IllegalStateException
      Stack: com.google.common.util.concurrent.AbstractService.checkCurrentState(com/google/common/util/concurrent/AbstractService.java:345)
    com.google.common.util.concurrent.AbstractService.awaitTerminated(com/google/common/util/concurrent/AbstractService.java:308)
    com.google.api.core.AbstractApiService.awaitTerminated(com/google/api/core/AbstractApiService.java:104)
    jdk.internal.reflect.GeneratedMethodAccessor47.invoke(jdk/internal/reflect/GeneratedMethodAccessor47)
    jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:566)
    org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:441)
    org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:305)
    usr.share.logstash.vendor.bundle.jruby.$2_dot_5_dot_0.gems.logstash_minus_input_minus_google_pubsub_minus_1_dot_2_dot_1.lib.logstash.inputs.google_pubsub.run(/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-google_pubsub-1.2.1/lib/logstash/inputs/google_pubsub.rb:277)
    usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.inputworker(/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:328)
    usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.RUBY$method$inputworker$0$__VARARGS__(usr/share/logstash/logstash_minus_core/lib/logstash//usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb)
    usr.share.logstash.logstash_minus_core.lib.logstash.java_pipeline.start_input(/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:320)
    org.jruby.RubyProc.call(org/jruby/RubyProc.java:274)
    java.lang.Thread.run(java/lang/Thread.java:834)

Have anyone faced a similar issue?.

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