Using LTS to Configure Block Alarms for WAF Rules
Application Scenarios
After you authorize WAF to access Log Tank Service (LTS), you can use the attack logs recorded by LTS for quick and efficient real-time analysis, device O&M management, and analysis of service trends.
This topic walks you through how to enable LTS quick analysis for WAF attack logs and configure alarm rules to analyze WAF attack logs and generate alarms. In this way, you can gain insight into the protection status of your workloads in WAF in real time and make informed decisions.
Resource and Cost Planning
Resource |
Description |
Monthly Fee |
---|---|---|
Log Tank Service (LTS) |
|
For details about billing rules, see Billing Description. |
Simple Message Notification (SMN) |
SMN is billed based on downstream Internet traffic and notification messages. The fee composition in different scenarios is as follows:
|
For details about billing rules, see Billing Description. |
Web Application Firewall (WAF) |
Cloud - Standard edition
|
For details about pricing rules, see Billing Description. |
Step 1: Buy the Standard Edition Cloud WAF
The following describes how to buy the standard edition cloud WAF.
- Log in to Huawei Cloud management console.
- On the management console page, choose .
- In the upper right corner of the page, click Buy WAF. On the purchase page displayed, select Cloud Mode for WAF Mode.
- Region: Select the region nearest to your services WAF will protect.
- Edition: Select Standard.
- Expansion Package and Required Duration: Set them based on site requirements.
- Confirm the product details and click Buy Now in the lower right corner of the page.
- Check the order details and read the WAF Disclaimer. Then, select the box and click Pay Now.
- On the payment page, select a payment method and pay for your order.
Step 2: Add Website Information to WAF
The following example shows how to add a website information to WAF in cloud CNAME access mode.
- For details about the cloud load balancer access mode, see Connecting a Website to WAF (Cloud Mode - ELB Access).
- For details about the dedicated mode, see Connecting a Website to WAF (Dedicated Mode).
- In the navigation pane on the left, choose Website Settings.
- In the upper left corner of the website list, click Add Website.
- Select Cloud - CNAME and click Configure Now.
- Configure website information as prompted.
Figure 1 Configuring basic information
Table 2 Key parameters Parameter
Description
Example Value
Domain Name
Domain name you want to add to WAF for protection.
- The domain name has an ICP license.
- You can enter a single domain name (for example, top-level domain name example.com or level-2 domain name www.example.com) or a wildcard domain name (*.example.com).
www.example.com
Protected Port
The port over which the website traffic goes
Standard ports
Server Configuration
Web server address settings. You need to configure the client protocol, server protocol, server weights, server address, and server port.
- Client Protocol: protocol used by a client to access a server. The options are HTTP and HTTPS.
- Server Protocol: protocol used by WAF to forward client requests. The options are HTTP and HTTPS.
- Server Address: public IP address (generally corresponding to the A record of the domain name configured on the DNS) or domain name (generally corresponding to the CNAME record of the domain name configured on the DNS) of the web server that a client accesses.
- Server Port: service port over which the WAF instance forwards client requests to the origin server.
- Weight: Requests are distributed across backend origin servers based on the load balancing algorithm you select and the weight you assign to each server.
Client Protocol: Select HTTP.
Server Protocol: HTTP
Server Address: IPv4 XXX.XXX.1.1
Server Port: 80
Use Layer-7 Proxy
You need to configure whether you deploy layer-7 proxies in front of WAF.
Set this parameter based on your website deployment.
Yes
- Click Next. Then, whitelist WAF back-to-source IP address, test WAF, and modify DNS records as prompted.
Figure 2 Domain name added to WAF
Step 3: Enable LTS for Protection Logs
- 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 and choose Web Application Firewall under Security & Compliance.
- In the navigation pane on the left, choose Events.
- Click the Log Settings tab, enable LTS (), and select a log group and log stream. Table 3 describes the parameters.
Figure 3 Log settings
Table 3 Log configuration Parameter
Description
Example Value
Log Group
Select a log group or click View Log Group to go to the LTS console and create a log group.
lts-group-waf
Attack Log
Select a log stream or click View Log Stream to go to the LTS console and create a log stream.
An attack log includes information about event type, protective action, and attack source IP address of each attack.
lts-topic-waf-attack
Access Log
Select a log stream or click View Log Stream to go to the LTS console and create a log stream.
An access log includes key information about access time, client IP address, and resource URL of each HTTP access requests.
lts-topic-waf-access
- Click OK.
You can view WAF protection event logs on the LTS console.
Step 4: Quickly Analyze Block Logs Generated by Protection Rules
- Click in the upper left corner of the page and choose Management & Governance > Log Tank Service.
- In the log group list, expand the WAF log group and choose log stream attack.
- On the log stream details page, click in the upper right corner. On the page displayed, click the Cloud Structured Parsing tab.
- Select JSON for log structuring. Then, click Select from existing events and select a log in the dialog box displayed on the right.
- Click Intelligent Extraction to find the fields you want to analyze quickly. Enable these fields in the Quick Analysis column. After this, you can collect and analyze periodic logs.
Figure 4 Log extraction field
- Find the category field, click in the Alias column, change the field name, and click to save the settings.
There is already a built-in category field in the system so you need to change the alias name of the category field, or your settings cannot be saved.
- In the lower right corner of the list, click Save. LTS quickly analyzes and collects statistics on logs in the specified period.
- 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.
You can group logs by rule and URI. Enter the following SQL statement in the search box to query logs of a specified rule:
select rule, uri, count(*) as cnt where action = 'block' group by rule, uri order by cnt desc
Step 5: Configure Alarm Rules
- Click in the upper left corner of the page and choose Management & Governance > Log Tank Service.
- In the navigation pane on the left, choose Alarms > Alarm Rules.
- Click Create. In the dialog box displayed on the right, specify related parameters. Table 4 describes the parameters.
Figure 5 Create Alarm Rule
Table 4 Parameter description Parameter
Description
Example Value
Rule Name
Name of the custom rule
WAF alarms
Statistics
Select By SQL.
By SQL
Charts
Click Configure from Scratch.
- Specify Log Group Name and Log Stream Name.
- Query Time Range: Time range for log statistics
- Query Statement: Enter the SQL statement configured in Step 8, for example, select rule,uri,count(*) as cnt where action='block' group by rule,uri order by cnt desc.
None
Query Frequency
Frequency which triggers alarms Generally, a fixed custom interval of 5 minutes is selected.
Custom interval
5
minutes
Conditional Expression
Alarm threshold
cnt>5
Alarm Severity
Select an alarm severity based on the blocking emergency of the rule. The options are critical, major, minor, and info.
Major
Send Notification
Select Yes.
Yes
SMN Topic
Select a topic from the drop-down list or create a topic.
If there are no topics, click View Topic and perform the following steps to create a topic:- Create a topic. For details, see Creating a Topic.
- Add one or more subscriptions to the topic. You will need to provide a phone number, email address, function, platform application endpoint, DMS endpoint, or HTTP/HTTPS endpoint for receiving alarm notifications. For details, see Adding a Subscription.
- Confirm the subscription. After the subscription is added, confirm the subscription.
For details about topics and subscriptions, see the Simple Message Notification User Guide.
None
Time Zone/Language
You can modify the language and time zone for receiving messages.
None
Message Templates
Select an existing template from the drop-down list box or click Create Message Template and create a template.
sql_template
- Confirm all parameters and click OK. The alarm rule is configured. When the alarm rule is triggered, you will receive an alarm email or SMS message.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot