google-cloud-platformcommentsgoogle-cloud-stackdrivergoogle-cloud-logging

Google Stackdriver Logging add comments to advanced filter


I wanted to document some of the more complicated Stackdriver logging filters I'm using. I'd prefer to put the comments near the relevant sections of the filter instead of a separate file, but I can't find any method for adding comments in the docs. Is there a way?

If there isn't an official way, does anyone have a hack to add no-effect statements with arbitrary text?


Solution

  • It is now possible to have line comments by using the -- prefix:

    -- All of our target users are emitted by Compute Engine instances.
    resource.type = "gce_instance"
    -- Looking for logs from "alex".
    jsonPayload.targetUser = "alex"
    

    Documentation: https://cloud.google.com/logging/docs/view/logging-query-language#comments