Closed codefatherru closed 2 years ago
The log level won't impact the query log. Can you provide your redacted APM configuration and the version of the module you are using? Are you setting the configuration in the Laravel .env
file?
cat .env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:YbXZ8QXOI6//jCInPKsu5bUJgDxqcRdM54ktXt8ZWf0=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lavarel
DB_USERNAME=lavarel
DB_PASSWORD=pass
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
did I understand you correctly: even when
'debug' => true,
'log_level' => 'debug',
in app.php logs won't be sent to apm?
APM is for operational transaction events. It does not collect the actual application log events. Log events are ingested to ElasticStack via other means. The Laravel APM agent collects timing an event data for the current request and pushes that to APM. This provides insight into the real time performance of your application. The agent and APM do support capturing an displaying Exceptions as well, but that does not include routine log entries.
The query log referred to is the Eloquent database queries run during the request. Laravel provides hooks which making accessing that information, including duration, easy. Those become individual spans within the larger transaction, which allows you to visualize how the transaction is processed.
Since I don't see any APM entries in your .env
content, I assume you published the elastic-apm.php
configuration file and modified it directly. But we may be pursuing the wrong problem if you are looking for log data rather than transaction data.
I removed confidential data from my post. Connection to elastic is undoubtedly correct because of successful handling of Error/Exception. but as I told, there is no perfomance data even with APM_THRESHOLD = 1
I use
php artisan --version Laravel Framework 5.8.18 philkra/elastic-apm-laravel": "^5.8"
Does your Laravel log contain any errors related to sending the transaction data to APM? I'm not sure what circumstances would cause the agent to send exceptions but not transactions.
The APM_THRESHOLD
only applies when APM_QUERYLOG
is set to auto
. I would leave that set to true
(the default) which should log all queries regardless of threshold.
But more fundamentally than that, the queries are only spans within a transaction. You should see the transaction data pushed to APM even if no queries are being run. So looking for a cause in the Laravel logs is my only suggestion. After that, it will require more investigation and debugging.
closing as repo is going to be archived.
hi I have successfuly installed the package, Registered the middleware, successfuly set up Error/Exception Handling (I see them in elastic), but neither log is written even with APM_THRESHOLD = 1 nor Log while Level set to "debug".