I’m new to GCP and trying to get a better grasp of how to effectively use Cloud Operations for monitoring my resources. More specifically, Custom log-based metrics**:** How do I go about creating metrics based on specific logs generated by my applications? I’d like to be able to track things like error rates or specific event occurrences.
Cloud Operations stack ( formerly Stackdriver ) is a great cloud-native tool for monitoring and logging purposes. Basically, creation of log-based metrics and log-based alerts is simple. You must:
Decide, on which level you want aggregate logs ( project, folder, organization )
Decide whether you need trigger something via matched logs or not ( if yes, PubSub logs-bucket, if not, Cloud Storage logs-storage bucket)
This will be more expensive, however, if you need analyze logs via SQL queries in a later time, BigQuery should be also used
Combine query, which will search matched logs. You can do it at your own, or use predefined one.