1

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?

1 Answer 1

1

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.

5
  • I'm not using App Engine. Logs are sent with google-fluentd from compute engine or GKE. Only PHP Stacktrace are missing, Java, Python and Go are just working fine.
    – Yann Coleu
    Commented Aug 2, 2018 at 13:53
  • I am trying to reproduce your issue. In the meantime you could have a look on this documentation about how to implement Stackdriver Error Reporting for PHP, if you hadn't already.
    – Rubén C.
    Commented Aug 3, 2018 at 15:35
  • "Thanks for the feedback! Votes cast by those with less than 15 reputation are recorded, but do not change the publicly displayed post score". I can't sorry :(
    – Yann Coleu
    Commented Aug 8, 2018 at 11:32
  • Hahaha, you are right, my bad. Help some people! ;)
    – Rubén C.
    Commented Aug 8, 2018 at 11:34
  • And I just discovered that you can accept the answer. No reputation is needed for this.
    – Rubén C.
    Commented Aug 9, 2018 at 15:49

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.