Using LTS to Quickly Query and Analyze WAF Access Logs
After you authorize WAF to access Log Tank Service (LTS), you can use the WAF logs recorded by LTS for quick and efficient real-time analysis, device O&M management, and analysis of service trends.
This practice uses the access log stream lts-waf-access of log group lts-waf as an example to describe how to use LTS to quickly query and analyze logs.
Prerequisites
- You have connected the website you want to protect to WAF.
- You have enabled LTS for WAF logging.
Procedure
- Log in to the management console.
- Click
in the upper left corner of the management console and select a region or project.
- Click
in the upper left corner of the page and choose Management & Governance > Log Tank Service.
- In the Log Group Name/ID column, click the name of the target log group (for example, lts-waf) to go the log stream page.
- In the Log Stream Name/ID column, click the name of log stream used for WAF access logs (for example, lts-waf-access), as shown in Figure 1. Then, select the Raw Logs tab.
- In the navigation pane on the left, choose Log Configuration. Then, go to the Log Content tab.
- Select JSON as the log structure, as shown in Figure 2.
If log content has been configured for the log stream, click
in the upper right corner of the parameter configuration area to reconfigure log content.
- In the Step 1 Select a sample log event. area, click Select from existing log event. In the displayed Select Log Event dialog box, select a log and click OK.
Figure 3 Select Log Event
- In the Step 2 Extract fields area, click Intelligent Extraction and enable (
) quick analysis for the log field you want to analyze (for example, remote_ip) as shown in Figure 4.
remote_IP: IP address of a client from which the request originates.
- Click Save. Then, LTS will start a quick analysis and do statistics for logs collected in a certain period. Figure 5 shows an example.
- In the navigation pane, choose Visualization. On the right pane, select a log query time range, enter an SQL statement in the search box, and click Query to query the specified log.
You can enter either of the following SQL statements in the search box to query logs of a specified IP address:
select * where remote_ip = 'xx.xx.xx.xx' or select * where remote_ip like 'xx.xx.xx%'
Feedback
Was this page helpful?
Provide feedbackFor any further questions, feel free to contact us through the chatbot.
Chatbot