Basically I'm monitoring the php-fpm error.log file with a custom config:
<source>
type tail
format none
path /var/log/php-fpm/error.log
pos_file /var/lib/google-fluentd/pos/php-fpm-error.pos
read_from_head true
tag php-fpm-error
</source>
With a custom log metric like this:
resource.type="gce_instance"
resource.labels.instance_id="123456"
logName="projects/example/logs/php-fpm-error"
"exited with code 127"
In the Metrics Explorer I can see the error event on the metric pretty clearly if I select "Count" as the Aggregation. However, in the Alert policy I don't see a way to specify an Aggregation.
Is the best method to just put the alert policy as "above count of 0" with "for most recent value"? It seems odd because the metric value is something really small like 0.02.
Thanks
An alert policy on Stackdriver Monitoring is for letting you know when your applications are not operating normally. Eg. you can set an alert if your application exited with ‘code 127’ five times within X amount of time.
If you’re looking to monitor this kind of events, I’ll suggest creating a Dashboard, in here you can set up a custom metric as a ‘Resource type’ and you have the option to set ‘Aggregate Resources’