Security log processing method, electronic device, and storage medium
By introducing the master device and the slave device into the distributed anti-DDOS device, the synchronous collection and transmission of log information is realized, which solves the synchronization problem of multi-device log processing and improves the real-time monitoring and protection effect of DDOS attacks.
Patent Information
- Application Number
- CN202210844266.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-18
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-07-18
AI Technical Summary
In distributed anti-DDOS devices, how to efficiently process log information generated by multiple devices to ensure the synchronization and accuracy of log information, especially real-time monitoring and protection during DDOS attacks.
By introducing the master device and the slave device into the distributed anti-DDOS device, the master device regularly issues DMT instructions to the slave device, collects and summarizes log information, and stores and indexes it in the local database to ensure that each protection device collects and indexes at the same time. Deliver logs to achieve synchronization and independence of log information.
It realizes the synchronous collection and transmission of log information, ensuring that the main device can accurately reflect the traffic status and DDOS attack status at the same time, reducing deduplication operations and improving the performance and monitoring accuracy of the protection equipment.
Smart Images

Figure CN115174249B
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a security log processing method, an electronic device, and a computer-readable storage medium. Background Art
[0002] Distributed Denial of Service (DDoS) combines multiple computers as attack platforms, uses malicious programs through remote connections, and launches DDOS attacks on one or more target servers, consuming the computing resources or network bandwidth of the target server, so that the target server cannot provide services normally, making it impossible for users to access the services on the target server normally. More seriously, when hackers launch DDOS attacks on target servers, they may steal the core data on the target server. It is particularly important to take necessary protective measures against DDOS attacks, and it is also very necessary to collect log information of network traffic and attack status during the protection process. The collected log information can reflect the real-time situation of the current network and the operating status of the equipment. Therefore, maintenance personnel can analyze the log information and enable targeted protection measures for attacks, thereby achieving the best protection effect.
[0003] Due to the huge traffic of DDOS attacks, the performance of a single anti-DDOS device is insufficient, and distributed anti-DDOS devices are often used to resist DDOS attacks. How to process the log information generated by multiple devices under distributed anti-DDOS devices is an urgent problem to be solved. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a security log processing method, an electronic device, and a computer-readable storage medium for synchronously collecting log information generated by multiple protection devices under a distributed anti-DDOS device.
[0005] On the one hand, the present application provides a method for processing a security log, which is applied to a distributed anti-DDOS device, wherein the distributed anti-DDOS device includes a switching device and a plurality of protection devices, wherein the plurality of protection devices include a master device and a plurality of slave devices, including:
[0006] The master device periodically sends a DMT instruction instructing the multiple protection devices to transmit logs; wherein the DMT instruction includes a collection time period and a transmission time;
[0007] Each protection device transmits the log information collected during the collection time period to the master device at the transmission time in response to the DMT instruction;
[0008] The master device aggregates the log information transmitted by the multiple protection devices and stores it in a local database, and writes the log index information of the stored log information into a protection structure matching the log information; wherein the protection structure is a structure corresponding to the protection object.
[0009] Through the above measures, each protection device in the distributed anti-DDOS device can collect and transmit logs at the same time, ensuring the synchronization of log information, so that the log information summarized by the main device can more accurately reflect the traffic status of accessing the server at the same time and the DDOS attack status of the server; in addition, the log information transmitted by each protection device represents the traffic processed by a single protection device, and the log information of each protection device summarized by the main device is independent of each other, and no additional deduplication operation is required.
[0010] In one embodiment, the method further comprises:
[0011] After obtaining the log information transmitted by any protection device, the master device checks whether the log information includes an attack start log; wherein the attack start log indicates the start of a DDOS attack on any target server;
[0012] If it exists, the target IP in the attack start log is used as the protection object, and the target IP is searched in the protection structure built locally;
[0013] If a protection structure corresponding to the target IP is found, after the attack start log is written into the database, the log index information of the attack start log is written into the protection structure corresponding to the target IP;
[0014] If the protection structure corresponding to the destination IP is not found, a corresponding protection structure is created for the destination IP, and after the attack start log is written into the database, the log index information of the attack start log is written into the protection structure corresponding to the destination IP.
[0015] Through the above measures, the main device can process the attack start log transmitted by each protection device, build a protection structure for the target server that is attacked by DDOS for the first time, and write the log index information of the attack start log of the protection object (server) corresponding to the protection structure into the constructed protection structure.
[0016] In one embodiment, the method further comprises:
[0017] After obtaining the log information transmitted by any protection device, the master device checks whether the log information includes an attack end log; wherein the attack end log indicates that the DDOS attack on any target server is ended;
[0018] If it exists, the destination IP in the attack end log is used to search in the locally constructed protection structure;
[0019] After the attack end log is written into the database, the log index information of the attack end log is written into the found protection structure.
[0020] Through the above measures, the main device can process the attack end logs transmitted by each protection device, thereby improving the monitoring of DDOS attacks and recording the ended DDOS attacks in the database.
[0021] In one embodiment, each of the protection devices transmits the log information collected during the collection time period to the master device at the transmission time in response to the DMT instruction, including:
[0022] Each protection device collects a general flow log and an attack flow log as log information within the collection time period; wherein the general flow log corresponds to the flow divided by the destination IP, and the attack flow log corresponds to the attack flow divided by the source IP and the destination IP;
[0023] After the transfer time is reached, each protection device transfers the collected log information to the master device.
[0024] Through the above measures, each protection device can respond to DMT instructions and periodically and synchronously collect general traffic logs and attack traffic logs that have been identified as attack traffic.
[0025] In one embodiment, the method further comprises:
[0026] After receiving the message forwarded by the switching device, each protection device determines whether the message is the first attack traffic message according to the protection strategy;
[0027] If so, an attack start log is generated for the attack traffic corresponding to the message, and the attack start log is used as log information.
[0028] Through the above measures, the protection device can perform DDOS attack detection on the messages it processes, and then generate attack start logs for the attack traffic in time, thereby monitoring the attack traffic.
[0029] In one embodiment, the method further comprises:
[0030] After any protection device generates an attack start log for the attack traffic, it monitors the attack traffic, and if the attack traffic meets the attack termination condition, it generates an attack end log and uses the attack end log as log information.
[0031] Through the above measures, the protection device can monitor the attack traffic, so as to generate an attack end log in time when the DDOS attack ends, and record the termination of the attack behavior with log information.
[0032] In one embodiment, the method further comprises:
[0033] Before the protection device collects log information, the switching device determines the traffic hash according to the source IP and destination IP of the message received from the outside;
[0034] The switching device searches for the traffic hash in a local traffic distribution table; wherein the traffic distribution table includes a plurality of traffic distribution table entries, each of which includes a mapping relationship between the traffic hash and a device identifier of a protection device;
[0035] If a traffic distribution table entry corresponding to the traffic hash is found, the switching device sends the message to the protection device indicated by the traffic distribution table entry;
[0036] If no traffic allocation table entry corresponding to the traffic hash is found, the switching device allocates a protection device to the traffic hash, constructs a traffic allocation table entry based on the device identifier of the allocated protection device and the traffic hash, and sends the message to the allocated protection device.
[0037] Through the above measures, the switching equipment can quickly distribute the received messages and give full play to the performance of each protection device in the distributed anti-DDOS equipment.
[0038] In one embodiment, the method further comprises:
[0039] The master device receives a log information query request for any protection object and returns a number of log index information in the protection structure of the protection object;
[0040] In response to a log information acquisition request for any log index information, the master device reads log information corresponding to the log index information from the database and returns the read log information.
[0041] Through the above measures, a fast log query service can be provided with the help of the protection structure.
[0042] On the other hand, the present application provides an electronic device, the electronic device comprising:
[0043] processor;
[0044] a memory for storing processor-executable instructions;
[0045] Wherein, the processor is configured to execute the above-mentioned security log processing method.
[0046] Furthermore, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program can be executed by a processor to complete the above-mentioned security log processing method. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application are briefly introduced below.
[0048] Figure 1 A schematic diagram of an application scenario of a security log processing method provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;
[0050] Figure 3 A flowchart of a method for processing a security log provided in an embodiment of the present application;
[0051] Figure 4 A flowchart of a method for processing an attack start log provided in an embodiment of the present application;
[0052] Figure 5 A flowchart of a method for processing an attack end log provided in an embodiment of the present application;
[0053] Figure 6 The data provided for one embodiment of the present application is intended to represent the data;
[0054] Figure 7 A flowchart of a message distribution method provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0055] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0056] Similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0057] Figure 1 Schematic diagram of an application scenario of the security log processing method provided in the embodiment of the present application. Figure 1As shown, the application scenario includes a distributed anti-DDOS device 20 and a server 30; the distributed anti-DDOS device 20 includes a switching device and multiple protection devices, and the protection device includes a master device and multiple slave devices; the switching device is used to receive messages sent from the external network to the server and distribute the messages to the protection device; the protection device can protect against DDOS attacks, thereby filtering out normal messages and handing them over to the server 30 for processing. In the process of processing traffic, each protection device can generate log information, which is summarized and stored by the master device.
[0058] like Figure 2 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 2 A processor 11 is taken as an example. The processor 11 and the memory 12 are connected via a bus 10. The memory 12 stores instructions that can be executed by the processor 11. The instructions are executed by the processor 11 so that the electronic device 1 can execute all or part of the process of the method in the following embodiment. In one embodiment, the electronic device 1 can be the above-mentioned switching device or master device or slave device, which is used to execute the security log processing method.
[0059] The memory 12 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0060] The present application also provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by the processor 11 to complete the security log processing method provided by the present application.
[0061] See also Figure 3 , is a flow chart of a method for processing a security log provided by an embodiment of the present application, such as Figure 3 As shown, the method may include the following steps 310 to 330.
[0062] Step 310: The master device periodically sends a DMT instruction instructing the multiple protection devices to transmit logs; wherein the DMT instruction includes a collection time period and a transmission time.
[0063] The distributed anti-DDOS device includes multiple protection devices. When started, the multiple protection devices communicate with each other through a preset election mechanism to determine a master device. The other protection devices except the master device are slave devices.
[0064] A timing process or a timing thread can be started on the master device to periodically send DMT (Data Message Transmission) instructions to multiple protection devices in the distributed anti-DDOS device according to a preset cycle duration. Here, the cycle duration can be configured according to actual needs. For example, the cycle duration can be 1 minute, 5 minutes, 30 minutes, etc. The DMT instruction can instruct each protection device to transmit log information to the main device; the DMT instruction includes a collection time period and a transmission time. The collection time period indicates the time period for each protection device to collect log information. The collection time period can be represented by a start time and an end time, or by a collection duration, a start time or an end time. For example, the DMT instruction can indicate that log collection starts after 10 seconds, and the collection duration is 1 minute. Then each protection device can collect 1 minute of log information 10 seconds after receiving the DMT instruction; the transmission time indicates the time for each protection device to transmit log information to the main device. The transmission time can be the end time of the collection time period, or a time point after the collection time period. For example, the DMT instruction can indicate that log information is transmitted after 80 seconds. Then each protection device can transmit log information to the main device 80 seconds after receiving the DMT instruction.
[0065] The timing thread or timing process on the master device can periodically send DMT instructions to the master device and each slave device.
[0066] Step 320: Each protection device responds to the DMT instruction and transmits the log information collected during the collection time period to the master device at the transmission time.
[0067] After each protection device receives the DMT instruction, it can parse out the collection time period and the delivery time, and collect the log information of the traffic processed by itself within the collection time period, where the log information can include the log information of the DDOS attack traffic. Each protection device can write the collected log information into the local data queue. After the delivery time is reached, each protection device can transfer the collected log information from its own data queue to the main device. In one embodiment, the log information collected by each protection device can record the device identification of the protection device, so that the main device can summarize the log information transmitted by different devices. In one embodiment, each protection device is equipped with a multi-core CPU (Central Processing Unit). For each protection device, different CPU cores can be used to process the work of writing log information to the data queue and transferring log information from the data queue to the main device. By decoupling the work of log collection and log transmission through the data queue, the overall performance of the protection device can be improved.
[0068] For each slave device, the slave device can send the log information collected by itself to the master device. For the master device, the log information collected by itself can be directly obtained.
[0069] Step 330: The master device aggregates the log information transmitted by multiple protection devices and stores it in the local database, and writes the log index information of the stored log information into the protection structure matching the log information; wherein the protection structure is a structure corresponding to the protection object.
[0070] After receiving log information from multiple protection devices, the master device can summarize the log information and store it in the local database. The log information stored in the database has corresponding log index information (for example: the data table identifier and table item identifier of the log information stored in the database). Since the master device may receive log information of DDOS attack traffic, after writing such log information into the database, the master device can also write the log index information of the log information into the protection structure.
[0071] Here, the protection structure is used to store the relevant data of the protection object, and the protection object is the server that needs to be protected from DDOS attacks, which can be represented by the server IP address. After determining that any server has received a DDOS attack, the server can be determined as a protection object and a corresponding protection structure can be constructed for it.
[0072] After the main device writes the log information of the DDOS attack traffic into the database, it finds the corresponding protection structure based on the destination IP of the traffic in the log information and writes the log index information to the protection structure, which helps to directly obtain the log information of the traffic related to the protection object from the protection structure later.
[0073] Through the above measures, each protection device in the distributed anti-DDOS device can collect and transmit logs at the same time, ensuring the synchronization of log information, so that the log information summarized by the main device can more accurately reflect the traffic status of accessing the server at the same time and the DDOS attack status of the server; in addition, the log information transmitted by each protection device represents the traffic processed by a single protection device, and the log information of each protection device summarized by the main device is independent of each other, and no additional deduplication operation is required.
[0074] In one example, see Figure 4 , is a flow chart of a method for processing an attack start log provided by an embodiment of the present application, such as Figure 4 As shown, the method may include the following steps 410 to 440.
[0075] Step 410: After obtaining the log information transmitted by any protection device, the main device checks whether the log information includes an attack start log; wherein the attack start log indicates that a DDOS attack has started against any target server.
[0076] The log information transmitted by the protection device to the main device may include the attack start log. After the main device obtains the log information from any protection device, it can check whether it contains the attack start log. Here, the attack start log can include an attack start identifier, which is used to indicate that the network device corresponding to the source IP in the attack start log starts to carry out a DDOS attack on the target server corresponding to the destination IP.
[0077] On the one hand, if there is no attack start log, the master device can process the log information as usual. On the other hand, if there is an attack start log, the master device can continue to perform step 420.
[0078] Step 420: If it exists, the target IP in the attack start log is used as the protection object, and the target IP is searched in the locally constructed protection structure.
[0079] In the case where there is an attack start log, the master device can take the destination IP recorded in the attack start log as the protection object and search for the protection structure corresponding to the target IP.
[0080] Step 430: If the protection structure corresponding to the destination IP is found, after the attack start log is written into the database, the log index information of the attack start log is written into the protection structure corresponding to the destination IP.
[0081] In one case, a protection structure corresponding to the destination IP is found, indicating that before the attack start log is received, the target server corresponding to the destination IP has been attacked by DDOS. In this case, the master device can write the attack start log into the database and write the log index information of the attack start log into the found protection structure.
[0082] Step 440: If the protection structure corresponding to the destination IP is not found, a corresponding protection structure is created for the destination IP, and after the attack start log is written into the database, the log index information of the attack start log is written into the protection structure corresponding to the destination IP.
[0083] In another case, the protection structure corresponding to the target IP is not found, indicating that before receiving the attack start log, the target server corresponding to the target IP has not been attacked by DDOS. In this case, the master device can build a protection structure for the target server, and the IP address of the target server is recorded in the protection structure. The master device can write the attack start log into the database and write the log index information of the attack start log into the built protection structure.
[0084] When the master device writes the attack start log into the database, it can create a corresponding attack flow table entry for the attack start log in the attack flow table of the database. The attack flow table entry may include the attack flow identifier AID assigned to the attack flow, the destination address, the processing action for the attack flow, the attack type, the attack start time in the attack start log, the attack status, the geographic location, etc. In addition, the attack flow table entry may also subsequently write the attack update time, the attack end time, etc. The master device may use the attack flow identifier AID as the log index information of the attack start log.
[0085] Through the above measures, the main device can process the attack start log transmitted by each protection device, build a protection structure for the target server that is attacked by DDOS for the first time, and write the log index information of the attack start log of the protection object (server) corresponding to the protection structure into the constructed protection structure.
[0086] In one embodiment, see Figure 5 , is a flow chart of a method for processing an attack end log provided in an embodiment of the present application, such as Figure 5 As shown, the method may include the following steps 510 to 530.
[0087] Step 510: After obtaining the log information transmitted by any protection device, the main device checks whether the log information includes an attack end log; wherein the attack end log indicates that the DDOS attack on any target server is ended.
[0088] The log information transmitted by the protection device to the main device may include an attack end log. After the main device obtains the log information from any protection device, it can check whether the attack end log is included. Here, the attack end log may include an attack end identifier, which is used to indicate that the network device corresponding to the source IP in the attack end log has ended the DDOS attack on the target server corresponding to the destination IP.
[0089] On the one hand, if there is no attack end log, the master device can process the log information as usual. On the other hand, if there is an attack end log, the master device can continue to execute step 520.
[0090] Step 520: If it exists, search the destination IP in the attack end log in the locally constructed protection structure.
[0091] Step 530: After the attack end log is written into the database, the log index information of the attack end log is written into the found protection structure.
[0092] In the case of an attack end log, the master device can search for the locally constructed protection structure based on the destination IP in the attack end log. Before receiving the attack end log, the master device has received the attack start log corresponding to the attack end log. For example: If an attack end log is received, where the source IP is IP1 and the destination IP is IP2, it means that the network device indicated by IP1 has stopped the DDOS attack on the target server indicated by IP2. Prior to this, the master device has received an attack start log where the source IP is IP1 and the destination IP is IP2. In this case, when the attack end log is received, the master device has already constructed the corresponding protection structure for the destination IP in the attack end log. The master device can find the corresponding protection structure based on the destination IP in the attack end log.
[0093] The master device may write the attack end log into the database, and write the log index information of the attack end log into the found protection structure.
[0094] When the master device writes the attack end log into the database, the attack end log may be written into the attack flow table entry created for the attack flow corresponding to the attack end log, and the attack end time in the attack end log may be written into the attack flow table entry.
[0095] Through the above measures, the main device can process the attack end logs transmitted by each protection device, thereby improving the monitoring of DDOS attacks and recording the ended DDOS attacks in the database.
[0096] In one embodiment, when each protection device transmits log information to the main device in response to the DMT instruction, it can collect general traffic logs and attack traffic logs as log information within the collection time period indicated by the DMT instruction. The general traffic log corresponds to traffic divided by destination IP, and the attack traffic log corresponds to attack traffic divided by source IP and destination IP.
[0097] For each protection device, after receiving the message assigned by the switching device, the protection device can determine that the traffic to which the message belongs is the traffic for accessing the server indicated by the destination IP based on the destination IP of the message, and can generate a general traffic log corresponding to the destination IP, and record the relevant information of the message in the general traffic log of the destination IP. In addition, if the protection device determines that the message belongs to attack traffic, in other words, the network device indicated by the source IP in the message is carrying out a DDOS attack on the target server indicated by the destination IP, then the protection device can generate an attack traffic log corresponding to the combination of the source IP and the destination IP, and record the relevant information of the message in the attack traffic log.
[0098] After the transfer time is reached, each protection device can transfer the collected log information to the main device. Exemplarily, the currently received DMT instruction indicates that the collection of 5 minutes of log information starts at 10 o'clock, and 10:06 is the transfer time. Each protection device can collect log information from 10 o'clock to 10:05, and transfer the log information to the main device at 10:06.
[0099] Through the above measures, each protection device can respond to DMT instructions and periodically and synchronously collect general traffic logs and attack traffic logs that have been identified as attack traffic.
[0100] In one embodiment, each protection device may check whether the message belongs to attack traffic when processing the message assigned by the switching device. After each protection device receives the message forwarded by the switching device, it may determine whether the message is a message of attack traffic that appears for the first time according to the protection strategy. Exemplarily, the protection strategy may be that for messages with the same source IP and destination IP, the total amount of messages per unit time reaches a preset quantity threshold. Here, the quantity threshold may be an empirical value.
[0101] If the message does not belong to attack traffic, or the message belongs to monitored attack traffic, the protection device can generate a general traffic log as usual based on the message, or generate a general traffic log and an attack traffic log.
[0102] If the message belongs to the first attack traffic, in other words, the protection device determines that the traffic to which the message belongs is attack traffic based on the currently received message, and then it can generate an attack start log, indicating that the network device corresponding to the source IP in the message starts to carry out a DDOS attack on the target server corresponding to the destination IP. The protection device can use the attack start log as log information and put it into the local data queue.
[0103] The protection device is not triggered by the DMT command to generate the attack start log, but continuously processes the message with the protection strategy to generate the attack start log. After the protection device generates the attack start log, it can transmit it as log information to the main device at the most recent transmission time.
[0104] Through the above measures, the protection device can perform DDOS attack detection on the messages it processes, and then generate attack start logs for the attack traffic in time, thereby monitoring the attack traffic.
[0105] In one embodiment, after any protection device generates an attack start log for the attack traffic, it can monitor the attack traffic and determine whether the attack traffic meets the attack termination condition during the monitoring process. Exemplarily, the attack termination condition can be that the total number of packets of the attack traffic per unit time is lower than a preset number threshold, and the duration reaches a preset duration threshold. Here, the duration threshold can be an empirical value, such as 10 minutes.
[0106] In one case, if the attack termination condition is not met, the attack traffic can be continuously monitored, and an attack traffic log and a general traffic log can be generated for the attack traffic when a DMT instruction is received.
[0107] In another case, if the attack termination condition is met, the protection device can generate an attack end log for the attack traffic, indicating that the network device corresponding to the source IP in the attack end log ends the DDOS attack on the target server corresponding to the destination IP. The protection device can use the attack end log as log information and put it into the local data queue.
[0108] The protection device is not triggered by the DMT command to generate the attack end log, but it continuously monitors the attack traffic and generates the attack end log when the network device corresponding to the attack traffic ends the DDOS attack. After generating the attack end log, the protection device can pass it to the main device as log information at the most recent transmission time.
[0109] Through the above measures, the protection device can monitor the attack traffic and generate an attack end log in time when the DDOS attack ends.
[0110] See also Figure 6, which is a data representation intent provided by an embodiment of the present application. In the present application, general traffic can be divided by destination IP, and attack traffic can be divided by source IP and destination IP. In this case, if there are three network devices with different source IPs launching a DDOS attack on the same target server, the traffic sent by the three network devices is divided into one general traffic and three attack traffics. For normal traffic that accesses the server normally, it is also divided into general traffic by destination IP.
[0111] The log information in the general flow dimension can be written into the general flow table, and each general flow corresponds to a general flow table entry. The general flow table entry may include the general flow identifier FID, destination address, start time, end time, etc. assigned to the general flow. After obtaining the general flow log transmitted by the protection device, the master device can write the general flow table entry corresponding to the general flow indicated by the general flow log. Figure 6 As shown, the general flow table includes multiple general flow table items, and each general flow table item includes multiple general flow logs.
[0112] The log information on the attack flow dimension can be written into the attack flow table, and each attack flow corresponds to an attack flow table entry. The main device obtains the attack start log transmitted by the protection device, creates an attack flow table entry for the attack flow, and writes the corresponding attack flow table entry when receiving the attack flow log later. After receiving the attack end log corresponding to the attack flow, the attack flow table entry can be updated to indicate that the attack behavior of a network device on a target server has ended.
[0113] In one embodiment, see Figure 7 , is a flow chart of a message distribution method provided in an embodiment of the present application, such as Figure 7 As shown, the method may include the following steps 301 to 304.
[0114] Step 301: Before the protection device collects log information, the switching device determines the traffic hash according to the source IP and destination IP of the message received from the outside.
[0115] The switching device in the distributed anti-DDOS device first receives the message from the external network to access the server. The switching device can parse the source IP and destination IP of the message, and calculate the hash value of the source IP and destination IP as a whole to obtain the traffic hash corresponding to the message.
[0116] Step 302: The switching device searches for a traffic hash in a local traffic distribution table; wherein the traffic distribution table includes a plurality of traffic distribution table entries, and each traffic distribution table entry includes a mapping relationship between a traffic hash and a device identifier of a protection device.
[0117] The switching device records the traffic allocated to each protection device through the local traffic allocation table. After obtaining the traffic hash of the message, the corresponding traffic allocation table entry can be found in the traffic allocation table.
[0118] Step 303: If a traffic distribution table entry corresponding to the traffic hash is found, the switching device sends the message to the protection device indicated by the traffic distribution table entry.
[0119] When the traffic allocation table entry corresponding to the traffic hash is found, it can be determined that the traffic to which the currently received message belongs has been allocated to the protection device recorded in the traffic allocation table entry. In this case, the switching device can directly send the message to the protection device indicated by the traffic allocation table entry.
[0120] Step 304: If no traffic allocation table entry corresponding to the traffic hash is found, the switching device allocates a protection device to the traffic hash, constructs a traffic allocation table entry based on the device identifier and traffic hash of the allocated protection device, and sends the message to the allocated protection device.
[0121] When the traffic allocation table entry corresponding to the traffic hash is not found, it can be determined that the traffic to which the currently received message belongs has not been allocated to any protection device. In this case, the switching device can allocate protection devices to the traffic hash based on a preset allocation rule. Exemplarily, the switching device allocates the traffic hash to each protection device in turn. Alternatively, the switching device can allocate the traffic hash based on the load balancing principle according to the number of messages processed by each protection device.
[0122] After assigning a protection device to a traffic hash, the switching device can construct a traffic allocation table entry based on the device identifier and traffic hash of the assigned protection device and write it into the traffic allocation table. The switching device can send the message to the protection device that has been assigned to process the traffic to which the message belongs.
[0123] Through the above measures, the switching equipment can quickly distribute the received messages and give full play to the performance of each protection device in the distributed anti-DDOS equipment.
[0124] In one embodiment, after the master device aggregates and stores the log information of multiple protection devices, it can provide a log information query service. After the master device receives a log information query request for any protection object, it can return some log index information in the protection structure of the protection object to the initiator of the log information query request. Exemplarily, when the master device receives a log information query request for server A, it can find the corresponding protection structure according to the IP address of server A, and obtain the log index information from it and return it.
[0125] After returning some log index information, the master device may receive a log information acquisition request, which includes at least one log index information of the log information to be acquired. The master device parses the log index information from the log information acquisition request, reads the corresponding log information from the local database according to the log index information, and returns the read log information to the initiator of the log information acquisition request.
[0126] Since the present application solution constructs a protection structure for each attacked protection object and writes log index information of the protection object-related traffic into the protection structure, a fast log query service can be provided with the help of the protection structure.
Claims
1. A method for processing security logs, applied to a distributed anti-DDOS device, wherein the distributed anti-DDOS device includes a switching device and a plurality of protection devices, wherein the plurality of protection devices includes a master device and a plurality of slave devices, wherein: include: The master device periodically sends a DMT instruction instructing the multiple protection devices to transmit logs; wherein the DMT instruction includes a collection time period and a transmission time; Each protection device transmits the log information collected during the collection time period to the master device at the transmission time in response to the DMT instruction; The master device aggregates the log information transmitted by the multiple protection devices and stores it in a local database, and writes the log index information of the stored log information into a protection structure matching the log information; wherein the protection structure is a structure corresponding to the protection object; The master device receives a log information query request for any protection object and returns a number of log index information in the protection structure of the protection object; In response to a log information acquisition request for any log index information, the master device reads log information corresponding to the log index information from the database and returns the read log information.
2. The method according to claim 1, characterized in that: The method further comprises: After obtaining the log information transmitted by any protection device, the master device checks whether the log information includes an attack start log; wherein the attack start log indicates the start of a DDOS attack on any target server; If it exists, the target IP in the attack start log is used as the protection object, and the target IP is searched in the protection structure built locally; If a protection structure corresponding to the target IP is found, after the attack start log is written into the database, the log index information of the attack start log is written into the protection structure corresponding to the target IP; If the protection structure corresponding to the destination IP is not found, a corresponding protection structure is created for the destination IP, and after the attack start log is written into the database, the log index information of the attack start log is written into the protection structure corresponding to the destination IP.
3. The method according to claim 1, characterized in that: The method further comprises: After obtaining the log information transmitted by any protection device, the master device checks whether the log information includes an attack end log; wherein the attack end log indicates that the DDOS attack on any target server is ended; If it exists, the destination IP in the attack end log is used to search in the locally constructed protection structure; After the attack end log is written into the database, the log index information of the attack end log is written into the found protection structure.
4. The method according to claim 1, characterized in that: Each of the protection devices transmits the log information collected in the collection time period to the main device in response to the DMT instruction at the transmission time, including: Each protection device collects a general flow log and an attack flow log as log information within the collection time period; wherein the general flow log corresponds to the flow divided by the destination IP, and the attack flow log corresponds to the attack flow divided by the source IP and the destination IP; After the transfer time is reached, each protection device transfers the collected log information to the master device.
5. The method according to claim 4, characterized in that The method further comprises: After receiving the message forwarded by the switching device, each protection device determines whether the message is the first attack traffic message according to the protection strategy; If so, an attack start log is generated for the attack traffic corresponding to the message, and the attack start log is used as log information.
6. The method according to claim 5, characterized in that The method further comprises: After any protection device generates an attack start log for the attack traffic, it monitors the attack traffic, and if the attack traffic meets the attack termination condition, it generates an attack end log and uses the attack end log as log information.
7. The method according to claim 4, characterized in that The method further comprises: Before the protection device collects log information, the switching device determines the traffic hash according to the source IP and destination IP of the message received from the outside; The switching device searches for the traffic hash in a local traffic distribution table; wherein the traffic distribution table includes a plurality of traffic distribution table entries, each of which includes a mapping relationship between the traffic hash and a device identifier of a protection device; If a traffic distribution table entry corresponding to the traffic hash is found, the switching device sends the message to the protection device indicated by the traffic distribution table entry; If no traffic allocation table entry corresponding to the traffic hash is found, the switching device allocates a protection device to the traffic hash, constructs a traffic allocation table entry based on the device identifier of the allocated protection device and the traffic hash, and sends the message to the allocated protection device.
8. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to execute the security log processing method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program can be executed by a processor to complete the security log processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Front end control method and system of domain name server (DNS)
CN103634315A
System and method for limiting access requests
CN104580216A
Method and system for carrying out multi-dimensional statistic analysis on large number of DNS journals
CN105634845A
Method and system for preventing network attack
CN109495423A
Fault processing method, fault processing device and storage medium
CN111478798A
