PHP Configuration

Configuration Options

The PHP agent can be configured via either environment variables or code.

Environment Variables

You can also configure Scout APM via environment variables. To configure Scout via enviroment variables, uppercase the config key and prefix it with SCOUT_. For example, to set the key configuration via environment variables use: export SCOUT_KEY=YOURKEY

Code based

Scout APM variables can also be set via code:

For Laravel, you can use a skeleton configuration file

For Symfony, you can configure Scout in your config/packages/scoutapm.xml file

Common Configurations

Setting Name Description Default Required
key The organization API key. Yes
name Name of the application (ex: ‘Photos App’). Yes
monitor Whether monitoring data should be reported. false Yes
log_level Override the SCOUT log level. Can only be used to quiet the agent, will not override the underlying logger’s level "info" No

Additional Configurations

Setting Name Description Default Required
revision_sha The Git SHA associated with this release. See docs No
uri_reporting Whether to include, exclude, or partially include parameters the reported URI. See below for more info path No
uri_filtered_params A string containing a JSON array of filtered_params when uri_reporting is set to filtered_params. See below for more info See default values below No
scm_subdirectory The relative path from the base of your Git repo to the directory which contains your application code. No
ignore A string containing a JSON array of endpoints that Scout should ignore. [] No
ignore_jobs A string containing a JSON array of jobs (e.g. Artisan commands, or Queue Jobs) that Scout should ignore. ["horizon"] No
disabled_instruments A string containing a JSON array of instruments that Scout should not install. [] No
hostname The hostname the metrics should be aggregrated under. hostname No
log_payload_content Will log the payload that gets sent to the core agent. Useful for troubleshooting No
errors_ignored_exceptions Excludes certain exceptions from being reported [] No
errors_filtered_params Filtered parameters in exceptions [password, s3-key, scout_key] No

Core Agent Configurations

Setting Name Description Default Required
core_agent_dir Path to create the directory which will store the Core Agent. /tmp/scout_apm_core No
core_agent_download Whether to download the Core Agent automatically, if needed. True No
core_agent_launch Whether to start the Core Agent automatically, if needed. True No
core_agent_permissions The permission bits to set when creating the directory of the Core Agent. 700 No
core_agent_full_name The release/url we look for when downloading the core-agent. Auto-detected No
core_agent_triple If you are running a MUSL based Linux (such as ArchLinux), you may need to explicitly specify the platform triple. E.g. x86_64-unknown-linux-musl Auto detected No
core_agent_log_level The log level of the core agent process. This should be one of: "trace", "debug", "info", "warn", "error". This does not affect the log level of the PHP library. To change that, directly configure logging as per the documentation. "info" No
core_agent_log_file The log file for the Core Agent to write its logs to. If not set, it won’t be written. This does not affect the logging configuration of the Php library. To change that, directly configure the php logging module as per the below documentation "info" No
core_agent_config_file Point to a configuration file for the Core Agent. This may be useful for debugging your setup with files provided by Scout APM staff. No
core_agent_triple If you are running a MUSL based Linux (such as ArchLinux), you may need to explicitly specify the platform triple. E.g. x86_64-unknown-linux-musl Auto detected No
core_agent_socket_path The path to the socket to connect to the Core Agent, passed to it when launching. This may be either a TCP address, in the format tcp://<address>:<port>, or an absolute path to create as a Unix socket. The deafult is to use TCP. Prior to version 5.0.0, this defaulted to using a Unix socket in the same directoy as the core agent tcp://127.0.0.1:6590 No

Environments

It typically makes sense to treat each environment (production, staging, etc) as a separate application within Scout and ignore the development and test environments. Configure a unique app name for each environment as Scout aggregates data by the app name.

Ex:

export SCOUT_KEY=YOURKEY
export SCOUT_NAME=YOURAPPNAME (Production)

URI Reporting

Whether to include, exclude, or partially include parameters when reporting the URI. Possible values include, full_path (all parameters reported), filtered_params (see uri_filtered_params or below for more info), or path (remove all parameters). In 6.4+ the default is path, in 6.3 and lower the default is full_path

URI Filtered Parameters

By default, the value of uri_filtered_params is ['access', 'access_token', 'api_key' 'apikey', 'auth', 'auth_token', 'card', 'certificate', 'credentials', 'crypt', 'key', 'mysql_pwd', 'otp', 'passwd', 'password', 'private', 'protected', 'salt', 'secret', 'ssn', 'stripetoken', 'token']

When uri_filtered_params is set, we do not merge the default list and the new. To add or remove parameters from this filtering list, we suggest copying the above default list and making changes to it accordingly.

See the PHP agent’s repo for more info:

https://github.com/scoutapp/scout-apm-php/blob/master/src/Config/Source/DefaultSource.php