Skip to content

Bref New Relic Extension - Logs #389

Open
@tormodmacleod

Description

@tormodmacleod

Hello

I'm experimenting with the Bref New Relic Extension. So far it's going pretty well. I can see metrics, events and traces in the New Relic console. However, I don't see any logs. I've configured php/conf.d/newrelic-settings.ini as below

newrelic.appname = ${NEW_RELIC_APP_NAME}
newrelic.license = ${NEW_RELIC_LICENSE_KEY}
newrelic.daemon.address = ${NEW_RELIC_DAEMON_ADDRESS}

# Log to Cloud Watch
newrelic.logfile = /proc/self/fd/2

# Add config to capture infrequent requests
# https://github.com/brefphp/extra-php-extensions/issues/252#issuecomment-1020656379
newrelic.daemon.app_timeout = 120H
newrelic.daemon.app_connect_timeout = 15s

# Add super-techno debug for now
newrelic.loglevel = verbosedebug
newrelic.daemon.loglevel = debug

As you can see, I've tried to maximise my chances of getting logs through to New Relic. In index.php my colleague has added

<?php
require __DIR__ . '/vendor/autoload.php';

$logger = new \Bref\Logger\StderrLogger(\Psr\Log\LogLevel::DEBUG);
$logger->warning('Warning level log');
$logger->error('Error level log');
$logger->debug('Debug level log');
$logger->info('Info level log');
$logger->critical('Critical level log');
$logger->emergency('Emergency level log');
$logger->alert('Alert level log');
$logger->notice('Notice level log');


if (isset($_GET['exception'])) {
    throw new Exception('Exception thrown');
}

?>

We can see this in the Cloudwatch logs

2023-01-06T11:48:45.478+00:00   2023-01-06 11:48:45.477 +0000 (8 8) debug: Log Level (PSR-3): WARNING 
2023-01-06T11:48:45.478+00:00   2023-01-06 11:48:45.478 +0000 (8 8) debug: Log Forwarding Log Level (RFC5424) set to: 4 (WARNING) 
...
some lines removed for brevity
...
2023-01-06T11:48:50.164+00:00   [WARNING] Warning level log
2023-01-06T11:48:50.164+00:00   [ERROR] Error level log
2023-01-06T11:48:50.164+00:00   [DEBUG] Debug level log
2023-01-06T11:48:50.164+00:00   [INFO] Info level log
2023-01-06T11:48:50.164+00:00   [CRITICAL] Critical level log
2023-01-06T11:48:50.164+00:00   [EMERGENCY] Emergency level log
2023-01-06T11:48:50.164+00:00   [ALERT] Alert level log
2023-01-06T11:48:50.164+00:00   [NOTICE] Notice level log 

But I don't see any logs for my service in New Relic APM. I've tried looking within the New Relic Logs feature in case they're somehow not linked to the service. I've been unable to find them. Although that may be because I'm not really sure how to query for them.

It did occur to me that perhaps the extension doesn't handle logs. Or maybe I've just mis-configured something somewhere. I'd be very grateful for some advice

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions