This topic describes how to use Logtail to collect WordPress logs.
Background information
WordPress is an open source content management system that you can use to create blogs. WordPress is based on the PHP language and the MySQL system. The following example shows a WordPress log:
192.0.2.0 - - [07/Jan/2022:21:06:39 +0800] "GET /wp-admin/js/password-strength-meter.min.js?ver=4.4 HTTP/1.0" 200 776 "http://wordpress.c4a1a0aecdb1943169555231dcc4adfb7.cn-hangzhou.alicontainer.com/wp-admin/install.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/192.0.2.1 Safari/537.36"
Procedure
Simple Log Service provides configuration wizards to help you create Logtail configurations. The following example describes how to collect WordPress logs in full regex mode.
Log on to the Simple Log Service console.
In the Import Data section, select RegEx - Text Log.
Select the project and Logstore. Then, click Next.
Create a machine group.
If a machine group is available, add the machine group to Applied Server Groups.
If no machine group is available, perform the following steps to create a machine group. In this example, an Elastic Compute Service (ECS) instance is used.
On the ECS Instances tab, select the ECS instance and click Create.
For more information, see Install Logtail on ECS instances.
In the Parameter Confirmation dialog box, click OK.
Make sure that the value of the Execution Status parameter is Success. Then, click Complete Installation.
In the Create Machine Group step, enter a machine group name and retain the default settings for other parameters. Then, click Next.
For more information, see Create an IP address-based machine group.
Confirm that the machine group is displayed in the Applied Server Groups section and click Next.
ImportantIf you apply a machine group immediately after you create the machine group, the heartbeat status of the machine group may be FAIL. This issue occurs because the machine group is not connected to Simple Log Service. To resolve this issue, you can click Automatic Retry. If the issue persists, see What do I do if no heartbeat connections are detected on Logtail?
In the Logtail Configuration step, create a Logtail configuration.
For more information about Logtail-related parameters, see Logtail configuration.
Preview data, configure indexes, and then click Next. For more information about indexes, see Create indexes.
Click Log Query. You are redirected to the query and analysis page of your Logstore.
You must wait approximately 1 minute for the indexes to take effect. Then, you can view the collected logs on the Raw Logs tab. For more information, see Query and analyze logs.