Gateway equipment traffic statistical analysis method and gateway equipment
By extracting and classifying traffic data in the memory of the gateway device and creating corresponding dimension directories in the log database, the problem of limited storage space of the gateway device is solved, and efficient traffic data query and analysis is achieved.
Patent Information
- Application Number
- CN202411959755.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-22
AI Technical Summary
Due to the limited storage space of gateway devices, traffic data cannot be stored in a long-term dimension, resulting in low efficiency in traffic analysis.
By extracting traffic data in the memory of the gateway device and determining the corresponding dimension directory in the log database based on the data information, the traffic data is written from the memory to the preset format file. In response to the query instruction, parse the query time and obtain the target traffic data in the target dimension directory.
It realizes the rapid determination of the target dimension directory based on query time, improves the efficiency of traffic data query, and expands the queryable time dimension.
Smart Images

Figure CN119862159A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of gateway traffic statistics, and in particular to a gateway device traffic statistics analysis method and a gateway device. Background Art
[0002] The gateway device can store the traffic data generated by the device when using the network, so as to perform traffic statistics analysis on applications or users based on the traffic data.
[0003] With the development and popularization of the Internet, the volume and amount of network traffic are increasing. With the increase of network traffic and the increase of network application types, the traffic data generated is very large. These traffic data will occupy the storage space of the gateway device in the memory. Due to the limited storage space of the gateway device, it is impossible to store traffic data of a longer time dimension, and it is also impossible to query traffic data based on a longer time dimension.
[0004] In order to expand the queryable time dimension, the query can be performed in the log database. However, since the log database contains a large amount of log data, including other log data besides traffic log data, a large amount of log data will affect the gateway device's query of traffic data, resulting in low efficiency of traffic analysis. Summary of the invention
[0005] Some embodiments of the present application provide a gateway device traffic statistics analysis method and a gateway device to solve the problem of low efficiency of traffic analysis.
[0006] In a first aspect, some embodiments of the present application provide a gateway device traffic statistics analysis method, which is applied to a gateway device, including:
[0007] extracting traffic data in the memory of the gateway device;
[0008] Acquiring data information of the traffic data;
[0009] Determine, according to the data information, a dimension directory in a log database that matches the data information, the dimension directory having a dimension identifier for indicating time dimension information of a preset format file, and the dimension directory including a preset format file;
[0010] Writing the flow data into the preset format file from the memory;
[0011] In response to a first query instruction for querying traffic data, parsing a query time from the first query instruction;
[0012] The target traffic data is obtained in the target dimension directory of the log database, where the target dimension directory is a dimension directory whose dimension identifier matches the query time.
[0013] In some embodiments, before the step of determining, according to the data information, a dimension catalog in a log database that matches the data information, the method further includes:
[0014] Setting at least one time granularity, where the time granularity is used to indicate the interval duration for obtaining write traffic data;
[0015] Obtaining a data source item of the traffic data;
[0016] The dimension catalog is created according to the data source item and the time granularity.
[0017] In some embodiments, the time granularity includes a first time granularity, a second time granularity, and a third time granularity. Before the step of acquiring target traffic data in the target dimension directory of the log database, the method includes:
[0018] Obtaining a time threshold for determining a target dimension catalog, wherein the time threshold includes a first time threshold, a second time threshold, and a third time threshold;
[0019] If the query time is less than the first time threshold, marking the dimension directory corresponding to the first time granularity as the target dimension directory;
[0020] If the query time is greater than or equal to the first time threshold and less than the second time threshold, the dimension directory corresponding to the second time granularity is marked as the target dimension directory;
[0021] If the query time is greater than or equal to the second time threshold and less than the third time threshold, the dimension directory corresponding to the third time granularity is marked as the target dimension directory.
[0022] In some embodiments, the data source item includes a first source item and a second source item, and the step of creating the dimension catalog according to the data source item and the time granularity includes:
[0023] Creating the first dimension catalog based on the first source item and the time granularity, and creating the second dimension catalog based on the second source item and the time granularity;
[0024] The dimensional catalog is generated according to the first dimensional catalog and the second dimensional catalog.
[0025] In some embodiments, the step of writing the traffic data from the memory into the preset format file includes:
[0026] At intervals of a preset time, the traffic data is written into a subfile in the preset format file;
[0027] Obtaining a first quantity of the sub-files;
[0028] When the first number is equal to the first number threshold, compressing the first number of sub-files to obtain a first compressed file;
[0029] The preset format file is generated according to the first compressed file.
[0030] In some embodiments, after the step of compressing the sub-files whose number is equal to the file number threshold to obtain a first compressed file, the method further includes:
[0031] Obtaining a second quantity of the first compressed file;
[0032] When the second number is equal to a second number threshold, compressing the second number of first compressed files to obtain second compressed files;
[0033] The preset format file is generated according to the second compressed file.
[0034] In some embodiments, the step of writing the traffic data from the memory into the preset format file includes:
[0035] Detecting the storage margin corresponding to the storage source of the preset format file;
[0036] When the storage margin is less than or equal to the storage threshold, the redundant data files in the preset format file are deleted.
[0037] In some embodiments, before the step of deleting the redundant data files in the preset format file, the step includes:
[0038] Obtaining the writing time of the flow data in the preset format file;
[0039] The preset format file whose writing time is greater than or equal to the determination threshold is set as a redundant data file.
[0040] In some embodiments, after the step of parsing the query time from the first query instruction, the method further includes:
[0041] In response to a second query instruction, parsing an updated query time from the second query instruction;
[0042] The current query time is updated according to the updated query time.
[0043] In a second aspect, some embodiments of the present application provide a gateway device, including a controller and a memory, wherein the memory is configured to store a log database, and the controller is configured to:
[0044] extracting traffic data in the memory of the gateway device;
[0045] Acquiring data information of the flow data;
[0046] Determine, according to the data information, a dimension directory in a log database that matches the data information, the dimension directory having a dimension identifier for indicating time dimension information of a preset format file, and the dimension directory including a preset format file;
[0047] Writing the flow data into the preset format file from the memory;
[0048] In response to a first query instruction for querying traffic data, parsing a query time from the first query instruction;
[0049] The target traffic data is obtained in the target dimension directory of the log database, where the target dimension directory is a dimension directory whose dimension identifier matches the query time.
[0050] It can be seen from the above technical solutions that the present application provides a method for traffic statistics analysis of a gateway device and a gateway device. The method extracts traffic data from the memory of the gateway device and determines the data information of the traffic data, thereby determining the dimension directory that matches the data information in the log database based on the data information, and writing the traffic data from the memory into a preset format file. In response to a first query instruction for querying traffic data, the query time is parsed from the first query instruction, the target traffic data is obtained from the target dimension directory of the log database, and the query of the traffic data is completed. The present application extracts traffic data from the memory and creates a dimension directory in the log database, thereby classifying the traffic data according to different time dimensions of the dimension directory. When querying, the target dimension directory can be quickly determined according to the query time, thereby improving the query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0052] Figure 1 A flow chart of a method for statistically analyzing traffic of a gateway device provided in some embodiments of the present application;
[0053] Figure 2 A flowchart of creating a dimension directory for a gateway device provided in some embodiments of the present application;
[0054] Figure 3A flow chart of a gateway device querying a target dimension directory according to different query times provided in some embodiments of the present application;
[0055] Figure 4 A flowchart of a gateway device performing file compression provided in some embodiments of the present application. DETAILED DESCRIPTION
[0056] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0057] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0058] The terms "first", "second", "third", etc. in the specification and the above drawings of this application are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise specified. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0059] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0060] The gateway device can store the traffic data generated by the device when using the network, so as to perform statistical analysis on the traffic of applications or users based on the traffic data. For example, when a user uses a terminal device to start an application, based on the user's IP address, the user's traffic data can be obtained, that is, the traffic data generated based on the user's IP address, so as to analyze the user's use of traffic data. For another example, when a user runs an application through a terminal device, the gateway device can also obtain the application traffic data generated by the application during the use of the application, so as to analyze the application's use of traffic data.
[0061] The gateway device can also count user traffic data and application traffic data at the same time. For example, when the terminal device simultaneously starts the first application and the second application based on the user's IP address, the user traffic data should be the sum of the traffic data of the first application and the traffic data of the second application, so as to determine the user traffic usage based on the user traffic data, and determine the traffic usage of each application under the user's IP address based on the traffic data of the first application and the traffic data of the second application, thereby improving the accuracy and breadth of traffic analysis.
[0062] The gateway device needs to perform traffic data analysis based on the time dimension. For example, the gateway device can obtain user traffic data within 10 minutes, so as to analyze the usage of user traffic within the time dimension of 10 minutes. With the development and popularization of the network, the volume and amount of network traffic are increasing. With the increase of network traffic and the increase of network application types, the traffic data generated is very large. These traffic data will occupy the storage space of the gateway device in the memory of the gateway device. Due to the limited storage space of the gateway device, it is impossible to store traffic data of a longer time dimension, and it is also impossible to query traffic data based on a longer time dimension.
[0063] In order to expand the queryable time dimension, the query can be performed in the log database. However, since the log database contains a large amount of log data, including other log data besides traffic log data, a large amount of log data will affect the gateway device's query of traffic data, resulting in low efficiency of traffic analysis.
[0064] In order to solve the problem of low efficiency of traffic analysis, some embodiments of the present application provide a gateway device traffic statistics analysis method, which is applied to a gateway device, such as Figure 1 As shown, the method includes:
[0065] S100: Extracting traffic data from the memory of the gateway device.
[0066] Traffic data includes user traffic data and application traffic data. For a terminal device with the same user IP address, multiple applications can be run at the same time. Correspondingly, each application can generate application traffic data during the use of traffic. The sum of application traffic data generated by all applications should be the same as the user traffic data.
[0067] The traffic data is stored in the memory of the gateway device. Therefore, the traffic data can be extracted from the memory of the gateway device to save the memory margin of the gateway device. On the other hand, in the process of extracting the traffic data, the traffic data can also be classified according to the user IP address and application category to obtain user traffic data and application traffic data.
[0068] S200: Acquire data information of the flow data.
[0069] The data information is used to indicate the source and time granularity of the traffic data. For example, when a user watches videos and plays games simultaneously through a terminal device with the user's IP address, the terminal device runs the video application and the game application at the same time. When the gateway device wants to count the user traffic data within a preset time granularity, it can obtain the user traffic data within the preset time granularity in the traffic data, that is, the traffic data generated by the terminal device with the user's IP address within the time granularity. When the gateway device wants to count the application traffic data of the game application within the preset time granularity, the traffic data includes the traffic data generated by the game application within the preset time granularity.
[0070] Among them, for user traffic data, the data source is the terminal device of the user's IP address, and for application traffic data, the data source is the game application. Therefore, the data source can be classified into user source and application source. The time granularity is the duration of updating traffic data. For example, when the time granularity is 10 minutes, the gateway device can update the traffic data every 10 minutes, so that the gateway device can subsequently find the corresponding traffic data according to the time granularity.
[0071] The dimension directory may have a dimension identifier for indicating the time dimension information of a preset format file. For example, when all preset format files in the dimension directory are format files with a duration of 10 minutes, the gateway device may add a dimension identifier in the dimension directory to indicate that the duration of the format file is 10 minutes.
[0072] S300: Determine, according to the data information, a dimension directory in a log database that matches the data information.
[0073] The log database is stored in a storage area other than the memory of the gateway device, such as a device hard disk, a storage disk, etc. After obtaining the data information, the dimension directory in the log database that matches the data information can be determined according to the data information, wherein the dimension directory has a dimension identifier for representing the time dimension information of the preset format file, and the dimension directory includes the preset format file. Based on different time dimension information, the gateway device can create multiple dimension directories in the log database to store the traffic data in the corresponding dimension directory to complete the classified storage of the traffic data.
[0074] Each dimension directory includes multiple preset format files. The gateway device can write traffic data into the preset format file under the corresponding dimension directory. For example, user traffic data with a time granularity of 10 minutes is written into the preset format file in the dimension directory of the user traffic data with a time granularity of 10 minutes.
[0075] In some embodiments, the gateway device may set at least one time granularity, and the time granularity is used to indicate the interval duration for obtaining write traffic data. For example, the gateway device may set three time granularities, and illustratively, the three time granularities are divided into a first time granularity of 10 minutes, a second time granularity of 1 hour, and a third time granularity of 4 hours. The gateway device may also obtain a data source item of the traffic data after obtaining the traffic data, wherein the data source item is used to indicate the source of the traffic data, including a first data item source and a second data item source, and taking the first source item as a user source item and the second source item as an application source item as an example, the user source item corresponds to the user traffic data, and the application source item corresponds to the application data.
[0076] After respectively obtaining the time granularity and the data source item, the gateway device may create a dimension directory in the log database according to the data source item and the time granularity, for example, creating a first dimension directory according to the first source item and the time granularity, and creating a second dimension directory according to the second source item and the time granularity.
[0077] Taking the above example as an example, Figure 2 As shown, for a time granularity of 10 minutes, a dimensional directory of user source items for 10 minutes, i.e., a first dimensional directory A, and a dimensional directory of application source items for 10 minutes, i.e., a second dimensional directory A, can be generated; for a time granularity of 1 hour, a dimensional directory of user source items for 1 hour, i.e., a first dimensional directory B, and a dimensional directory of application source items for 1 hour, i.e., a second dimensional directory B, can be generated; for a time granularity of 4 hours, a dimensional directory of user source items for 4 hours, i.e., a first dimensional directory C, and a dimensional directory of application source items for 4 hours, i.e., a second dimensional directory C, can be generated.
[0078] In some embodiments, the gateway device can also generate a dimensional directory based on the user source item, the application source item and the time granularity at the same time, thereby improving the source path for performing classified storage of traffic data and improving the accuracy of queries. Taking the time granularity of 10 minutes as an example, a dimensional directory of "10 minutes-user source item, application source item" can be generated, that is, a third dimensional directory.
[0079] S400: Writing the traffic data into the preset format file from the memory.
[0080] After determining the dimension directory that matches the data information system, the flow data can be written into a preset format file from the memory to transfer the flow data from the memory to the log database for storage. For example, when the flow data is user flow data with a time granularity of 10 minutes, the flow data needs to be written into a preset format file in the dimension directory of "10 minutes-user source item" to perform corresponding classification on the flow data.
[0081] It should be noted that the preset format file is a compressed format file, and its memory usage is smaller than the memory usage of traffic data. Therefore, in the same storage space, traffic data of a longer time dimension can be stored. For this reason, the gateway device can query traffic data of a longer time dimension, thereby increasing the time range of traffic analysis.
[0082] In some embodiments, since the generation of traffic data is a continuous dynamic action, when 10 minutes of user traffic data is obtained, the terminal device corresponding to the user's IP address is still continuously generating traffic data. When the time granularity changes from 10 minutes to the next time granularity, for example, the next time granularity is 20 minutes, the user traffic data generated within 20 minutes is written into the corresponding "20 minutes-user source item" dimension directory.
[0083] S500: In response to a first query instruction for querying traffic data, parsing a query time from the first query instruction.
[0084] When the writing of traffic data is completed, when the user wants to perform traffic analysis, he can input the first query instruction to the gateway device. The first query time should include the query time. For example, the first query instruction can be "query user traffic data within 3 days". The gateway device can respond to the first query instruction and obtain the query time, that is, 3 days.
[0085] S600: Acquire target traffic data in the target dimension directory of the log database.
[0086] After obtaining the query time, the gateway device can determine the corresponding target dimension directory in the log database according to the query time. The target dimension directory is a dimension directory whose dimension identifier matches the query time, and the gateway device can obtain the target traffic data in the target dimension directory.
[0087] In some embodiments, traffic data stored in memory for a short period of time can be queried within a basic time length. For example, traffic data within one hour can be queried directly from the memory of the gateway device. When the query duration is greater than one hour, the target dimension directory can be determined according to different time granularities. To this end, the gateway device can obtain a time threshold for determining the target dimension directory. Taking the time granularity including the first time granularity, the second time granularity and the third time granularity as an example, the time threshold may include a first time threshold T1, a second time threshold T2 and a third time threshold T3. Different time thresholds may correspond to different dimension directories. For the sake of description, in this embodiment, T will be used to represent the query time, such as Figure 3As shown, when T is less than the first time threshold T1 and greater than the basic duration, the dimension directory corresponding to the first time granularity can be marked as the target dimension directory. For another example, when T is greater than or equal to the first time threshold T1 and less than the second time threshold T2, the dimension directory corresponding to the second time granularity is marked as the target dimension directory. For another example, when T is greater than or equal to the second time threshold T2 and less than the third time threshold T3, the dimension directory corresponding to the third time granularity is marked as the target dimension directory. By setting different time thresholds at different time granularities, the target dimension directory can be quickly determined in the log database when querying traffic data, thereby improving the efficiency of traffic queries.
[0088] It should be noted that when the writing time of the traffic data is greater than T3, the preset format file corresponding to the traffic data may be marked as a redundant data file and not included in the query range.
[0089] In some embodiments, in the target dimension directory, the traffic data written in the preset format file includes user traffic data and application traffic data. For this purpose, the query source item can also be parsed in the first query instruction. For example, when the query source item is a user source item, the user traffic data in the target dimension directory is marked as target traffic data.
[0090] In some embodiments, Figure 4 As shown, the preset format file can be divided into multiple sub-files. When the gateway device writes the traffic data from the memory to the preset format file, the traffic data can be written into the sub-files first. For example, the traffic data generated by the first terminal device corresponding to the first user IP address is stored in one sub-file, and the traffic data generated by the second terminal device corresponding to the second user IP address is stored in another sub-file. The sub-file can be a CSV file, which is used to store traffic data in text form, so that the traffic data is switched from memory storage to file storage, saving storage space.
[0091] During the process of writing traffic data, the gateway device can obtain a first number of sub-files. When the first number is equal to a first number threshold, the first number of sub-files can be compressed to obtain a first compressed file, thereby generating a preset format file according to the first compressed file.
[0092] The first compressed file may be a file whose memory usage is less than that of the sub-file. For example, when the first quantity threshold is 10, the gateway device may compress 10 CSV files into a parquet file, thereby further saving storage space.
[0093] In the process of compressing sub-files to obtain the first compressed file, the gateway device can also obtain a second quantity of the first compressed files. When the second quantity is equal to a second quantity threshold, the gateway device can also compress the second quantity of the first compressed files, thereby saving storage space for storing the first compressed files to obtain the second compressed file, and then generate a preset format file based on the second compressed file.
[0094] In some embodiments, when the traffic data is written into the preset format file, the gateway device can detect the storage margin of the preset format file storage source. When the storage margin is less than or equal to the storage threshold, it means that the storage source has or will soon have no space to store the preset format file. Therefore, the gateway device can delete some preset format files to release storage space to store newly generated traffic data. To this end, the gateway device can obtain redundant data files in the preset format file and delete the redundant data files to release storage space.
[0095] In some embodiments, redundant data files can be determined based on the writing time of the traffic data. For example, the larger the time interval from the current time, the earlier the traffic data was written. Therefore, this part of the preset format file may have exceeded the query range. For this reason, the gateway device can mark this part of the preset format data as redundant file data.
[0096] Based on this, the gateway device can set a determination threshold to filter redundant data files in the preset format file according to the determination threshold. To this end, the gateway device can also obtain the writing time of the flow data in the preset format file. When the writing time is greater than or equal to the determination threshold, it means that the time for writing flow data in the preset format file is too long. Therefore, these preset format files can be set as redundant data files.
[0097] In some embodiments, the user may also input a second query instruction to update the query time. The gateway device may respond to the second query instruction, parse the updated query time from the second query instruction, and update the current query time according to the updated query time to instruct the gateway device to redetermine the target traffic data in the target dimension directory according to the updated query time.
[0098] Some embodiments of the present application further provide a gateway device, the gateway device comprising a controller and a memory, the memory being configured to store a log database, and the controller being configured to:
[0099] S100: Extracting traffic data from the memory of the gateway device.
[0100] S200: Acquire data information of the flow data.
[0101] S300: Determine, according to the data information, a dimension directory in a log database that matches the data information.
[0102] The dimension directory has a dimension identifier for indicating time dimension information of a preset format file, and the dimension directory includes a preset format file.
[0103] S400: Writing the traffic data into the preset format file from the memory.
[0104] S500: In response to a first query instruction for querying traffic data, parsing a query time from the first query instruction.
[0105] S600: Acquire target traffic data in the target dimension directory of the log database.
[0106] The target dimension directory is a dimension directory whose dimension identifier matches the query time.
[0107] It can be seen from the above technical solutions that the present application provides a method for traffic statistics analysis of a gateway device and a gateway device. The method extracts traffic data from the memory of the gateway device and determines the data information of the traffic data, thereby determining the dimension directory that matches the data information in the log database based on the data information, and writing the traffic data from the memory into a preset format file. In response to a first query instruction for querying traffic data, the query time is parsed from the first query instruction, the target traffic data is obtained from the target dimension directory of the log database, and the query of the traffic data is completed. The present application extracts traffic data from the memory and creates a dimension directory in the log database, thereby classifying the traffic data according to different time dimensions of the dimension directory. When querying, the target dimension directory can be quickly determined according to the query time, thereby improving the query efficiency.
[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0109] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are intended to better explain the present disclosure, so that those skilled in the art can better use the embodiments.
Claims
1. A gateway device traffic statistics analysis method, applied to a gateway device, characterized in that: include: extracting traffic data in the memory of the gateway device; Acquiring data information of the flow data; Determine, according to the data information, a dimension directory in a log database that matches the data information, the dimension directory having a dimension identifier for indicating time dimension information of a preset format file, and the dimension directory including a preset format file; Writing the flow data into the preset format file from the memory; In response to a first query instruction for querying traffic data, parsing a query time from the first query instruction; The target traffic data is obtained in the target dimension directory of the log database, where the target dimension directory is a dimension directory whose dimension identifier matches the query time.
2. The method for analyzing gateway device traffic statistics according to claim 1, characterized in that: Before the step of determining a dimension catalog in a log database that matches the data information according to the data information, the method further includes: Setting at least one time granularity, where the time granularity is used to indicate the interval duration for obtaining write traffic data; Obtaining a data source item of the traffic data; The dimension catalog is created according to the data source item and the time granularity.
3. The method for analyzing gateway device traffic statistics according to claim 2, characterized in that: The time granularity includes a first time granularity, a second time granularity and a third time granularity. Before the step of acquiring target traffic data in the target dimension directory of the log database, the method includes: Obtaining a time threshold for determining a target dimension catalog, wherein the time threshold includes a first time threshold, a second time threshold, and a third time threshold; If the query time is less than the first time threshold, marking the dimension directory corresponding to the first time granularity as the target dimension directory; If the query time is greater than or equal to the first time threshold and less than the second time threshold, the dimension directory corresponding to the second time granularity is marked as the target dimension directory; If the query time is greater than or equal to the second time threshold and less than the third time threshold, the dimension directory corresponding to the third time granularity is marked as the target dimension directory.
4. The method for analyzing gateway device traffic statistics according to claim 2, characterized in that: The data source items include a first source item and a second source item, and the step of creating the dimension catalog according to the data source items and the time granularity includes: Creating the first dimension catalog based on the first source item and the time granularity, and creating the second dimension catalog based on the second source item and the time granularity; The dimensional catalog is generated according to the first dimensional catalog and the second dimensional catalog.
5. The method for analyzing gateway device traffic statistics according to claim 1, characterized in that: The step of writing the flow data from the memory into the preset format file comprises: At intervals of a preset time, the traffic data is written into a subfile in the preset format file; Obtaining a first quantity of the sub-files; When the first number is equal to the first number threshold, compressing the first number of sub-files to obtain a first compressed file; The preset format file is generated according to the first compressed file.
6. The method for analyzing gateway device traffic statistics according to claim 5, characterized in that: After the step of compressing the sub-files whose number is equal to the file number threshold to obtain a first compressed file, the method further includes: Obtaining a second quantity of the first compressed file; When the second number is equal to a second number threshold, compressing the second number of first compressed files to obtain second compressed files; The preset format file is generated according to the second compressed file.
7. The method for analyzing gateway device traffic statistics according to claim 1, characterized in that: The step of writing the flow data from the memory into the preset format file comprises: Detecting the storage margin corresponding to the storage source of the preset format file; When the storage margin is less than or equal to the storage threshold, the redundant data files in the preset format file are deleted.
8. The method for analyzing gateway device traffic statistics according to claim 7, characterized in that: Before the step of deleting the redundant data files in the preset format file, the method includes: Obtaining the writing time of the flow data in the preset format file; The preset format file whose writing time is greater than or equal to the determination threshold is set as a redundant data file.
9. The method for analyzing gateway device traffic statistics according to claim 1, characterized in that: After the step of parsing the query time from the first query instruction, the method further includes: In response to a second query instruction, parsing an updated query time from the second query instruction; The current query time is updated according to the updated query time.
10. A gateway device, characterized in that: The invention comprises a controller and a memory, wherein the memory is configured to store a log database, and the controller is configured to: extracting traffic data in the memory of the gateway device; Acquiring data information of the flow data; Determine, according to the data information, a dimension directory in a log database that matches the data information, the dimension directory having a dimension identifier for indicating time dimension information of a preset format file, and the dimension directory including a preset format file; Writing the flow data into the preset format file from the memory; In response to a first query instruction for querying traffic data, parsing a query time from the first query instruction; The target traffic data is obtained in the target dimension directory of the log database, where the target dimension directory is a dimension directory whose dimension identifier matches the query time.