Pub/Sub subscriptions disappeared without any deletion logs

Problem

Pub/Sub subscription has disappeared without any Audit logs about deletion.

Environment

  • Cloud Pub/Sub

Solution

  1. Check if subscription expiration policy has been set (by default 31 days).
  2. Check if subscription has been inactive for the set duration.
  3. Check for logs with method InternalExpireInactiveSubscription using following log filter: 
    resource.type="pubsub_subscription" protoPayload.methodName="Subscriber.InternalExpireInactiveSubscription"
  4. Set expiration period to desired value. 31 days is the default expiration period. The minimum is 1 day.
  5. To prevent a subscription from expiring, set the expiration period to never.

Cause

By default, subscriptions expire after 31 days of inactivity (for instance, if there are no active connections, pull requests, or push successes). if subscription expiration policy has been set, subscriptions expire after a set duration of inactivity. 

Using subscription expiration policies, you can configure the inactivity duration or make the subscription persistent regardless of activity by setting the expiration period to never. You can also delete a subscription manually.