Search code examples
loggingstackdrivergoogle-cloud-stackdriver

Stackdriver advanced filter query without wildcards


I have logs being sent in JSON format to Stackdriver, each which contains an entry like:

name: pipeline.<application>.process

where <application> is a variable length string that represents various components in our system.

I would like a query to get all such logs, however, don't know how to do so given that stackdriver doesn't support wildcards or regex.

Ideally, something like a pipeline.*.process would be great, but I can't figure it out from the docs. Equally, <application> takes >40 forms, and so I don't want to create a custom metric for every one.


Solution

  • Filtering for

    jsonPayload.name: "pipeline."
    jsonPayload.name: ".process"
    

    should give you the results you want

    If you're interested in building a metric you can create a single log based metric that extracts the portion of the name value: https://cloud.google.com/logging/docs/logs-based-metrics/labels