Google Cloud Operations Suite : Log-based Metrics in Action
If you are using Google Cloud Operations Suite, you would have definitely used Logs Explorer. It is a central place where you can search and analyze logs from various Google Cloud Platform services, your applications and even audit logs.
Often, when it comes to your applications, a common use case that I have seen come up is that you would like to search for a particular text in the logs, which might be of interest and can be converted into a metric. A few examples of this might be:
Your application prints out some error message or specific text. Say “Error:…” or “Order Placed” or an obscure legacy message that has been there in your code for a while.
While you can use the Logs Explorer to search for all occurences of the save and maybe even save the query for future invocations, you want to go one step further. What if you could convert that into a metric that is measurable and which you can plot on a dashboard, raise alerts if goes above or beyond a certain threshold and more. All of that is perfectly possible via a feature called the Logs-based Metrics.
I have written a blog post that takes you step by step of how you can take a sample application log and convert some pattern of text to a Log-based metrics, which you can then visualize on a chart and configure alerts, to raise notifications if you go above a threshold (warning) value.
Check out the blog post at the official Google Cloud Blog.
Thanks for reading. If you have been using Log-based Metrics in your applications, do share what interesting metric or use case that you solved!