Log-based metrics count the log entries that match a given filter for the
current project. For example, you could create a metric to track the number of
trips created over time with the following query:

```bash
    resource.type="audited_resource"
    resource.labels.method="maps.fleetengine.v1.TripService.ReportBillableTrip"
```

For an overview and instructions on how to create log-based metrics, see
[Log-based metrics](https://cloud.google.com/logging/docs/logs-based-metrics).

> [!NOTE]
> **Note:** The data for a user-defined log-based metric comes only from log entries received after the metric is created. A metric isn't retroactively populated with data from previously logged entries.

## Set up alerts

You can create alerts to notify customers when a metric falls out of a defined
threshold, and specify notification channels for those alerts. See [Configure
log-based alerting policies](https://cloud.google.com/logging/docs/alerting/log-based-alerts).

## What's next

Learn how to [analyse logs with BigQuery](https://developers.google.com/maps/documentation/mobility/operations/cloud-logging/big-query.md.txt).