Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Understanding the PHP Agent Logs


#1

In most cases when it comes to the PHP agent there are a lot of solutions that can be addressed quicker by taking a look at the logs. Since these logs reside on the side of the application that is being instrumented, it may be prudent for the engineers that use New Relic every day to understand common messages and what they mean.

Common Errors

ECONNREFUSED

Example:

warning: daemon connect(fd=7 uds=@newrelic-daemon) returned -1 errno=ECONNREFUSED. Failed to connect to the newrelic-daemon. Please make sure that there is a properly configured newrelic-daemon running. For additional assistance, please see: https://newrelic.com/docs/php/newrelic-daemon-startup-modes

Common Reason:

ECONNREFUSED is indicating that the /tmp/.newrelic.sock file is unreachable due to a refused connection possibly caused by SELinux or other security based procedures. The most common solution for this would be to go into your newrelic.ini file and change the newrelic.daemon.port to newrelic.daemon.port = "@newrelic-daemon", kill all existing daemon processes, and restart your PHP dispatcher. You can find more information about the use of abstract sockets with New Relic here, What is an abstract socket and why would I use it?.

ENOENT

Example:

warning: daemon connect(fd=6 uds=/tmp/.newrelic.sock) returned -1 errno=ENOENT. Failed to connect to the newrelic-daemon. Please make sure that there is a properly configured newrelic-daemon running. For additional assistance, please see: https://newrelic.com/docs/php/newrelic-daemon-startup-modes

Common Reason:

Like ECONNREFUSED, ENOENT means that the agent and daemon are having issues communicating. However, instead of the connection being refused it is due to either mismatched ports, from ./newrelic.sock currently being locked by another process, or from updating the agent without restarting the web server. A common fix for this is the one mentioned for ECONNREFUSED above.

EPIPE

Example:

2017-03-20 15:34:54.405 +0000 (11044 11044) error: TXNDATA failure: len=5484 errno=EPIPE

Common Reason:

New Relic collects any traces that are larger than 4x Apdex. If this error is showing than it means that the transaction sent to the daemon from the agent was too large and was dropped, and as of right now, the max size of 2mb. An easy way to remedy this situation is to set transaction_tracer.detail = 0 - This will reduce all transaction from system instrumented functions and user/framework custom functions, to just system instrumented functions. This should reduce the transaction trace size. If this doesn’t solve it, disabling SQL recording may result in success if the trace is reporting a lot of MySQL data in the trace.

Healthy Logs

php-agent.log

2019-02-12 18:13:52.513 +0000 (32574 32574) info: New Relic 8.1.0.209 ("avocado" - "708a1d74e22e") [daemon='@newrelic-daemon' php='7.2.10-0ubuntu0.18.04.1' zts=no sapi='apache2handler' apache='2.4.29' mpm=prefork pid=32574 ppid=1 uid=0 euid=0 gid=0 egid=0 backtrace=yes startup=agent os='Linux' rel='4.15.0-43-generic' mach='x86_64' ver='#46-Ubuntu SMP Thu Dec 6 14' node='schrodingersbox']

2019-02-12 18:13:52.514 +0000 (32574 32574) info: spawned daemon child pid=32592

newrelic-daemon.log

2019/02/12 18:13:52.537167 (32592) Info: New Relic daemon version 8.1.0.209-708a1d74e22e [listen="@newrelic-daemon" startup=agent pid=32592 ppid=32574 uid=0 euid=0 gid=0 egid=0 runtime="go1.8.3" GOMAXPROCS=1 GOOS=linux GOARCH=amd64]

2019/02/12 18:13:52.563054 (32596) Info: New Relic daemon version 8.1.0.209-708a1d74e22e [listen="@newrelic-daemon" startup=agent pid=32596 ppid=1 uid=0 euid=0 gid=0 egid=0 runtime="go1.8.3" GOMAXPROCS=1 GOOS=linux GOARCH=amd64]

2019/02/12 18:13:52.570425 (32610) Info: New Relic daemon version 8.1.0.209-708a1d74e22e [listen="@newrelic-daemon" startup=agent pid=32610 ppid=32596 uid=0 euid=0 gid=0 egid=0 runtime="go1.8.3" GOMAXPROCS=1 GOOS=linux GOARCH=amd64]

2019/02/12 18:13:52.570488 (32610) Info: collector configuration is &{CAFile: CAPath: Proxy:}

2019/02/12 18:13:52.570597 (32610) Info: daemon listening on @newrelic-daemon

2019/02/12 18:14:47.121236 (32610) Info: Reporting to: https://rpm.newrelic.com/accounts/ACCOUNT-NUMBER/applications/APPLICATION-NUMBER

2019/02/12 18:14:47.124515 (32610) Info: app 'lalala' connected with run id 'BM95zSFTtEXMABmHKgzMsFRcYw0kAAMBAAAjHQECBAzMsFMDAAk4LjEuMC4yMDkAD3NjaHJvZGluZ2Vyc2JveAAGbGFsYWxh'

The major things you should take away from healthy logs is that from the php-agent.log there is no failure to connect to the daemon and that in the newrelic-daemon.log shows that it is connected to your application on New Relic.

Useful Links

Generating logs for troubleshooting (PHP)