Our WordPress integration monitors the performance of your WordPress web application, helping you diagnose issues in your application and optimize your code. Our WordPress integration makes use of our PHP, Apache, and MySQL integrations, and gives you a pre-built dashboard with your most important WordPress metrics like transactions, visitors, and call duration.
After setting up our WordPress integration, we give you a dashboard for your WordPress metrics.
You can install the infrastructure agent two different ways:
- Our guided install is a CLI tool that inspects your system and installs the infrastructure agent alongside the application monitoring agent that best works for your system. To learn more about how our guided install works, check out our Guided install overview.
- If you'd rather install our infrastructure agent manually, you can follow a tutorial for manual installation for Linux, Windows, or macOS.
Flex comes bundled with the New Relic infrastructure agent. To create a flex configuration file follow these steps:
Create a file named
read-wordpress-files-config.ymlin this path:bash$/etc/newrelic-infra/integrations.d
read-wordpress-files-config.ymlwith these details:
event_typeis a New Relic database table that you can query using NRQL. An example of
INSERT_WORDPRESS_PATH. Here, you need to enter the directory for your WordPress application, like:
Use this configuration file:integrations:- name: nri-flexinterval: 180sconfig:name: linuxDirectorySizeapis:- event_type: INSERT_EVENT_TYPEcommands:- run: du INSERT_WORDPRESS_PATHsplit: horizontalset_header: [dirSizeKB, dirName]regex_match: truesplit_by: (\d+)\s+
Open your WordPress application and then open the
Update the file with the values listed below:// Enable WP_DEBUG modedefine( 'WP_DEBUG', true );// Enable Debug logging to the /wp-content/debug.log filedefine( 'WP_DEBUG_LOG', true );
Once you start your application, you will see a
debug.log file in the
You can use our log forwarding to forward WordPress logs to New Relic.
On Linux machines, your log file named
logging.yml should be present in this path:
After creating the log file, add the following script to the
logs:- name: wordpress-debug.logfile: /src/www/wordpress/wp-content/debug.logattributes:logtype: wordpress_debug
Before you can start reading your data, use the instructions in our infrastructure agent docs to restart your infrastructure agent.
$sudo systemctl restart newrelic-infra.service
In a couple of minutes, your application will send metrics to one.newrelic.com.
You can choose our pre-built dashboard template named
WordPress Full Stack to monitor your WordPress application metrics. Follow these steps to use our pre-built dashboard template:
- From one.newrelic.com, go to the + Add data page.
- Click on Dashboards.
- In the search bar, type
WordPress Full Stack.
- The WordPress dashboard should appear. Click on it to install it.
Your WordPress dashboard is considered a custom dashboard and can be found in the Dashboards UI. For docs on using and editing dashboards, see our dashboard docs.
Here's an example NRQL query to check the delay for first input:
SELECT percentage(count(*),WHERE firstInputDelay < 100)AS 'Good (<100ms)', percentage(count(*),WHERE firstInputDelay >= 100 and firstInputDelay < 300)AS 'Needs improvement (>=100 <300ms)', percentage(count(*),WHERE firstInputDelay >= 300)AS 'Poor (> 300ms)'FROM PageViewTimingWHERE firstInputDelay IS NOT NULLTIMESERIES AUTO
To learn more about querying your data and creating custom dashboards, check out these docs: