google-compute-engine"/>
  • 11
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I use the unattended-upgrades package on my Debian Google Compute Engine instance to do security updates. It has the option of sending an email to notify me when a security upgrade was done. Do I need to go through the 3rd party bulk email services just to notify myself, or is there an easier way?

On google app engine, it was easy to do this via:

from google.appengine.api import mail
mail.send_mail(....

which generated an email coming from cron@cron-1022.appspotmail.com. I was hoping there was something correspondingly simple on compute engine.

I'd actually like to setup notifications / emails on other custom security events on my server.

Thanks.

I figured out a way to do send an email alert. First, enable Stackdriver error reporting.

Stackdriver expects errors that look like stack traces. And it triggers email alerts only for 'new' errors. So to fake out stackdriver, I encode the current date in the function name of a fake stack trace. This means I'll get at most one email per day. Then, for example from a shell, I can report an error:

gcloud beta error-reporting events report --service nodeapp --service-version 1 --message "Error: something bad happened
    at date-`date +%F`-func (tfile.js:2:1)"

Note, the '\n at' and then ' (tfile.js:2:1)' in the message quotes. Something like it is necessary to fake stackdriver into thinking it's a stack trace.

  • 0
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags