user1849038
user1849038

Reputation: 31

Google cloud pubsub aggregated sink

I find the docs for gcloud stuff detailed but hardly the easiest to follow. Is anyone out there able to tell me what I'm doing that means my topic never received the logs I believe it should. Many thanks:

  1. Create a project called logproj, enable PubSub API and create a topic called mytopic.

  2. Create organization wide aggregated sink with the destination of the PubSub topic I just created, with the sink containing admin activity logs only:

gcloud logging sinks create mysink pubsub.googleapis.com/projects/logproj-12345/topics/mytopic --include-children --organization=123456789123 --log-filter='"logName:activity" AND logName:"/logs/cloudaudit.googleapis.com%2Factivity"'

  1. The above command completes successfully and gives me a service account called [email protected] that I need to add to the topic and give PubSub Publisher role, which I do via the Web UI.

  2. In order to test the topic is receiving organization wide activity logs, I create a test project. Then use the log viewer and select the pubsub topic, but the only logs I can see are from me creating the topic in the logproj project.

What am I missing?

Thanks in advance.

Upvotes: 0

Views: 1736

Answers (1)

MrtN
MrtN

Reputation: 136

Messages published to Pub/Sub cannot be found in the Stackdriver logs. If you want to view the messages published to your topic:

  1. Create a subscription for your topic

  2. Use command-line to pull messages: https://cloud.google.com/sdk/gcloud/reference/pubsub/subscriptions/pull

Alternatively, you could implement a simple subscriber. Code examples can be found here: https://cloud.google.com/pubsub/docs/pull

Upvotes: 1

Related Questions