phpnginxgoogle-cloud-platformstackdrivergoogle-cloud-error-reporting

Getting PHP Stacktrace into Stackdriver Error Reporting with google-fluentd


Is it possible to show PHP Stacktrace and other errors into Stackdriver Error Reporting with Fluentd and log files?

With some applications in Java, Python or Go, errors are automatically shown in Stackdriver Error Reporting but not with PHP and I don't know why.

For example, these kind of errors are sent automatically to Google Cloud Logging but not shown in Error Reporting.

[error] 8795#8795: *6 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Exception: Always throw this error in /var/www/example.com/index.php

UPDATE 1

I need this feature in order to monitor about twenty PHP Symphony applications hosted in a GKE Cluster and some other in Compute Engine. Each application is defined with a deployment and output logs to stdout or in /var/log/nginx/error.log (for Compute Engine), pretty simple.

Do you know how to get these errors in Error Reporting without modifying my applications?


Solution

  • Based on "[...] With some applications in Java, Python or Go,[...]" I understand that you are using Google App Engine and PHP. As I don't know the environment (standard or flexible), I suggest you to read this guide about using Stackdriver Logging in App Engine apps.

    If you are using standard environment, have a look also in this reading and writing application logs in PHP document.

    If you miss information in the available logs, you can create custom logs, which will be also showed on Stackdriver. In order to do this, follow this guide about how to configure the Stackdriver Logging agent.

    UPDATE 1

    Stackdriver Error Reporting doesn’t support PHP language. It is in beta for Compute Engine right now. Since I am with GCP support, I asked to change the document I mentioned in the comment because is confusing. I could also file a feature request for you, but I would like to know your use case so it is more likely to be accepted.

    UPDATE 2

    I filed this feature request for you and you can add your own comments now. You should starred the FR to give it more visibility and receive comments and status updates. The Compute Engine team might ask questions there too.