Log storage method, device, server and computer-readable storage medium
By classifying and storing the change data of the target application, the problem that existing log systems cannot record and store log information from multiple dimensions is solved, and the integrity and effectiveness of log information are achieved.
Patent Information
- Application Number
- CN201911039202.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-29
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2039-10-29
AI Technical Summary
The existing log system only records a single log information and cannot record and store it from multiple dimensions, resulting in the inability to quickly locate the log information when querying it. The single log information is easily tampered with, resulting in false information or loss.
By detecting the change data of the target application, determining the change type, and classifying the change data according to the preset classification rules, generating dimensional information, determining the target location of the classification log in the preset CUBE model, and storing it.
It realizes multi-dimensional classification and storage of log information, avoids tampering and loss of log information, and ensures the integrity and effectiveness of log information.
Smart Images

Figure CN110941526B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a log storage method, device, server, and computer-readable storage medium. Background Art
[0002] Logging is an essential part of a complete system. The function of the log is to record the program execution process and program execution results. With a complete log record, data and record support can be provided when it is necessary to verify the program running track or collect program data.
[0003] At present, the log system only records and retains a single log information, and does not further process, classify, record and store the log information. It also does not record and store it from multiple dimensions such as the changer, change tool, and change object. As a result, it is impossible to quickly query the log information when querying the log information, and it is impossible to quickly locate the problem. At the same time, it is difficult to provide effective support for some audit work. Moreover, a single log information record is easily tampered with, resulting in false log information or loss of log information, and the integrity and validity of the log information cannot be guaranteed. Summary of the invention
[0004] The main purpose of the present application is to provide a log storage method, device, server and computer-readable storage medium, aiming to solve the technical problem that the existing single log information record is easily tampered with, resulting in false log information or log information loss, and the integrity and validity of the log information cannot be guaranteed.
[0005] In a first aspect, the present application provides a log storage method, the log storage method comprising the following steps:
[0006] Detecting changed data of a target application and determining a change type of the changed data;
[0007] Classify the change data according to the preset classification rule corresponding to the change type to obtain at least one classification log;
[0008] Obtaining a log identifier of the classification log, and generating dimension information of the classification log according to the change type and the log identifier of the classification log;
[0009] Determine the target position of the classified log in the preset CUBE model according to the dimension information of the classified log;
[0010] The classification log is stored according to the target location of the classification log in the preset CUBE model.
[0011] In a second aspect, the present application further provides a log storage device, the log storage device comprising:
[0012] A first determination module, configured to detect the changed data of the target application and determine the change type of the changed data;
[0013] A classification module, used to classify the change data according to a preset classification rule corresponding to the change type to obtain at least one classification log;
[0014] A generating module, used for acquiring a log identifier of the classified log, and generating dimension information of the classified log according to the change type and the log identifier of the classified log;
[0015] A second determination module is used to determine the target position of the classification log in the preset CUBE model according to the dimension information of the classification log;
[0016] The storage module is used to store the classification log according to the target position of the classification log in the preset CUBE model.
[0017] In a third aspect, the present application also provides a server, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the log storage method described in the above invention are implemented.
[0018] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the log storage method as described in any one of the above inventions are implemented.
[0019] The present application provides a log storage method, device, server and computer-readable storage medium, including detecting change data of a target application and determining a change type of the change data; classifying the change data according to a preset classification rule corresponding to the change type to obtain at least one classification log; obtaining a log identifier of the classification log, and generating dimension information of the classification log according to the change type and the log identifier of the classification log; determining a target position of the classification log in a preset CUBE model according to the dimension information of the classification log; storing the classification log according to the target position of the classification log in the preset CUBE model, classifying a single log, and storing the obtained at least one classification log in the CUBE model, thereby avoiding the situation where the log information is changed and causing the log information to be false or lost, and ensuring the integrity and validity of the log information. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 A flow chart of a log storage method provided in an embodiment of the present application;
[0022] Figure 2 for Figure 1 A schematic diagram of the sub-step flow of the log storage method in FIG.
[0023] Figure 3 for Figure 1 A schematic diagram of the sub-step flow of the log storage method in FIG.
[0024] Figure 4 for Figure 1 A schematic diagram of the sub-step flow of the log storage method in FIG.
[0025] Figure 5 for Figure 1 A schematic diagram of the sub-step flow of the log storage method in FIG.
[0026] Figure 6 A flowchart of another log storage method provided in an embodiment of the present application;
[0027] Figure 7 A schematic block diagram of a log storage device provided in an embodiment of the present application;
[0028] Figure 8 This is a schematic block diagram of the structure of a server involved in an embodiment of the present application.
[0029] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0031] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0032] The embodiments of the present application provide a log storage method, device, server and computer-readable storage medium. The log storage method can be applied to a server.
[0033] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0034] Please refer to Figure 1 , Figure 1 A flow chart of a log storage method provided in an embodiment of the present application.
[0035] like Figure 1 As shown, the log storage method includes steps S101 to S105.
[0036] Step S101, detecting the changed data of the target application and determining the change type of the changed data;
[0037] The server detects the changed data of the target application in real time. When the changed data of the target application is detected, the server obtains the attribute information of the changed data and determines the change type of the changed data based on the attribute information of the changed data. The changed data is the data recorded by the application during operation, or the data generated by the application based on the user's instructions. The changed data includes records of database login personnel, login time, execution actions, changed files, etc. For example, when it is detected that the changed data is a database login personnel, the change type of the changed data is determined to be a database change by obtaining the attribute information of the database login personnel as a database; when it is detected that the changed data is a changed file, the change type of the changed data is determined to be a file change by obtaining the attribute information of the changed file as a changed file.
[0038] In one embodiment, specifically, referring to Figure 2 , step S101 includes: sub-step S1011 to sub-step S1014.
[0039] Sub-step S1011, detecting the log file of the target application;
[0040] The server detects the log file of the target application in real time. The log file is responsible for recording the log information generated by the target application in the application's log system. The log information can be data information generated when the application is running, or it can be data information generated based on user instructions. The data information generated by the application is used as change data and recorded in the log file.
[0041] Sub-step S1012: when the change data in the log file is detected, the name of the change tool in the change data is obtained, and the preset tool type library is retrieved;
[0042] When the server detects the change data in the log file, the name of the change tool in the change data is obtained. For example, when the change data in the log file is detected, the name of the change tool in the change data is obtained. The change tool name includes the script tool name, the code decompression tool name, the system restart tool name, etc. The pre-stored tool type library is retrieved, and the tool type library is a pre-set tool name and change type.
[0043] Sub-step S1013, analyzing the changed tool name through the preset tool type library to obtain the tool type corresponding to the changed tool name;
[0044] The server analyzes the acquired change tool name through the preset tool type library, thereby acquiring the tool type of the change tool name. Specifically, when the change tool name is acquired, the preset tool type library is searched to acquire the tool type corresponding to the change tool name. For example, when the acquired change tool name is mysql, mysql is searched in the preset tool type library to acquire mysql as a script type, thereby determining that the change data is a script type.
[0045] Sub-step S1014: determining the change type of the changed data according to the acquired tool type.
[0046] The change type of the changed data is determined by the acquired tool type. For example, when the acquired tool type is a script type, the change type of the changed data is determined to be a database change, and when the acquired tool type is a code decompression, system restart, etc. type, the change type of the changed data is determined to be a file change.
[0047] Step S102: classify the change data according to the preset classification rules corresponding to the change type to obtain at least one classification log;
[0048] When determining the change type of the change data, obtain the preset classification rules of the change type, classify the change data according to the preset classification rules, and obtain at least one classification log. For example, the change type is database change, and the preset classification rules of database change are time, executor, execution action, etc. The change data is classified according to time, executor, and execution action to obtain time log, executor log, execution action log, etc. The time log includes the time of entering the database, the time of changing the data, etc. The executor log includes the account and password for logging into the target application, the account and password for logging into the database, etc. The execution work log includes the changed data, name, etc. When the change data is obtained, the change data meets the preset classification rules of more than two classification logs, and at least one classification log is obtained. There is no limit on the number of classification logs.
[0049] In one embodiment, specifically, referring to Figure 3 , step S102 includes: sub-step S1021 to sub-step S1022.
[0050] Sub-step S1021, calling a preset classification library corresponding to the change type, and reading preset classification rules of each classification log in the preset classification library;
[0051] When the server determines the change type of the changed data, it calls the preset classification library corresponding to the change type and reads the classification rules of each classification log in the preset classification library. For example, when the change type is determined to be a database change, the preset classification library corresponding to the database change is called, the change object log, change script log, and database change log in the preset classification library are read, and the preset classification rules of the change object log, change script log, and database change log are read. When the change type is determined to be a file change, the preset classification library corresponding to the file change is called, the change object log, change initiator log, tool execution result log, and application restart log in the preset classification library are read, and the preset classification rules of the change object log, change initiator log, tool execution result log, and application restart log are read.
[0052] Sub-step S1022: Acquire attribute information of the changed data, classify the changed data according to preset classification rules of each classification log and the attribute information, and obtain at least one classification log.
[0053] Acquire the attribute information of the change data, and classify the change data based on the preset classification rules of each classification log and the attribute information of the change data, so as to obtain at least one classification log. For example, when the change type is a database change, obtain the preset classification rules of the change object log, the change script log, and the database change log of the database change, wherein the preset classification rules of the change object log are to record the database login personnel, login time, execution data, logout time, etc., the preset classification rules of the change script log are to record the database script execution time, execution library, execution user, execution data, end time, etc., and the database change log records the tool call time, the calling user, the deployment server that initiates the call action, the script name executed by the calling script tool, etc.
[0054] When the attribute information of the change data is obtained as the database login personnel, the database login personnel is determined to be the change object log. When the name information of the database login personnel is the same as that of the calling user and the executing user, the change object log, the change script log, and the database change log are obtained, and a change data is recorded in the classification logs of different dimensions. When the change type is a file change, the preset classification library corresponding to the file change is obtained, and the preset classification rules of the change object log, the change initiator log, the tool execution result log, and the application restart log in the preset classification library are read, wherein the preset classification rule of the change object log is to record the application system change personnel, change time, changed files, etc., the preset classification rule of the change initiator log is to record the change initiating user, initiation time, change object, called change tool and change password, the preset classification rule of the tool execution result log is for each change tool to record the time when each change tool is called, the call execution data, etc., and the preset classification rule of the application restart log is to record the data restarted after the application change. Through the attribute information of the change data, the classification log to which the change data belongs is determined, and at least one classification log is obtained.
[0055] Step S103: Obtain a log identifier of the classification log, and generate dimension information of the classification log according to the change type and the log identifier of the classification log;
[0056] When multiple classification logs are obtained, the log identifier of the classification log is obtained, and the dimension information of the classification log is generated by combining the change type and the log identifier of the classification log. For example, when the log identifier of the change script log is obtained, the log identifier of the change script log and the database change are used to generate the dimension information of the change script log. The dimension information of the classification log is generated with the change type as the first dimension and the log identifier as the second dimension, wherein the dimension information includes the time dimension, and the time in the time dimension information is the time recorded in the classification log.
[0057] Step S104: Determine the target position of the classified log in the preset CUBE model according to the dimension information of the classified log;
[0058] When the dimension information of the classification log is obtained, the preset CUBE model is called, and the preset CUBE model is queried through the dimension information of the classification log to determine the target location of the classification log in the preset CUBE model. CUBE (data cube) is an OLAP cube composed of three dimensions. The cube contains cell (sub-cube) values that meet the conditions. These cells contain the data to be analyzed, which are called metrics. Cube: A multidimensional space constructed by dimensions, which contains all the basic data to be analyzed, and all aggregate data operations are performed on the cube. Dimension: It is an angle to observe data. For example, application, change type, and time are all dimensions.
[0059] Three dimensions constitute a cube space. Dimension can be understood as an axis of a cube. There is a special dimension, namely the measure dimension. Dimension member: the basic unit that constitutes the dimension. For the time dimension, its members are: first quarter, second quarter, third quarter, and fourth quarter. Level: the hierarchical structure of the dimension. There are two levels: natural level and custom level. For the time dimension, (year, month, day) is one level of it, and (year, quarter, month) is another level of it. A dimension can have multiple levels. The level can be understood as a path for unit data aggregation. Level: The level constitutes the level. For a level of the time dimension (year, month, day), the year is a level, the month is a level, and the day is a level. Obviously, these levels have a parent-child relationship. Measure: the data to be analyzed and displayed, that is, the indicator. This CUBE model is a model for storing application log information. The CUBE model can store log information of multiple applications, and each application can be divided into multiple classified logs based on different change types. There is no limit on the number of dimension hierarchies of this CUBE model.
[0060] In one embodiment, specifically, referring to Figure 4 , step S104 includes: sub-step S1041 to sub-step S1044.
[0061] Sub-step S1041, querying the preset CUBE model according to the first dimension and the second dimension in the dimension information, and obtaining the target hierarchical space corresponding to the first dimension and the second dimension;
[0062] After obtaining the first and second dimensions in each dimension information, query the preset CUBE model based on the obtained first and second dimensions. The CUBE model is composed of blocks in layers, and each layer has three dimensions. Based on the first and second dimensions, obtain the classification log in the target layer of the CUBE model. For example, take each layer of the preset CUBE model as a spatial coordinate system, where the X-axis is the time dimension, the Y-axis is the change type dimension, and the Z-axis is the log identifier dimension. When the first dimension is database change or file change, and the second dimension is change object log 1, search on the Y dimension by using database change as the search condition, and search on the Z axis by using change object log 1 as the search condition. Determine the classification log in the target layer of the preset CUBE model through the first and second dimensions.
[0063] Sub-step S1042, reading the time dimension information between the target levels, obtaining the current time, and rolling up the current time to generate a target date consistent with the time dimension information;
[0064] After determining the target levels of the classification log in the preset CUBE model, read the time dimension information of the target levels. Specifically, the target levels of the classification log are determined by the first dimension and the second dimension, and the first dimension and the second dimension are both dimension information of the classification log. Therefore, the obtained time dimension is only the time dimension information corresponding to the classification log. Get the current moment, which can be the time of reading the current system record or the change time in the classification log. Roll up the read current moment to generate a target date consistent with the time dimension information. Rolling up is the aggregation from fine-grained data to high-level. For example, when the time dimension information between the target levels is 2018 and 2019, and the current moment is 14:20 on August 2, 2018, the current moment 14:20 on August 2, 2018 is aggregated to 2018, which is the same target date as 2018 on the time dimension.
[0065] Sub-step S1043, determining the target block of the classified log between the target levels according to the target date;
[0066] The target block of the classification log between the target levels is determined by the generated target log. For example, when the target date of the classification log is 2018, 2018 is used as the search condition and the search is performed on the Z axis, where the Z axis is the time dimension. The target block corresponding to the classification log between the target levels is determined by 2018 on the X axis, database changes on the Y axis, and change object 1 on the Z axis.
[0067] Sub-step S1044: drilling down on the time dimension information on the target block based on the current moment to determine the target position of the classification log in the target block.
[0068] When the target block is obtained, the time dimension information on the target block is drilled at the current moment. Drilling is the change between different levels of the dimension, from the upper layer to the lower layer, or splitting the summary data into more detailed data. The preset CUBE model stores data by dimension level. For example, all the data for 2018 is stored in the first block, and the data for the first quarter of 2018 is stored in the sub-blocks of the first block, and the first block includes 4 sub-blocks. By drilling the time dimension on the target block at the current moment, the target position of the classified log in the target block is determined.
[0069] Step S105: store the classification log according to the target location of the classification log in the preset CUBE model.
[0070] When the target location of the classification log in the preset CUBE model is obtained, the classification log is stored in the corresponding target location.
[0071] In one embodiment, specifically, referring to Figure 5 , step S105 includes: sub-step S1051 to sub-step S1053.
[0072] Sub-step S1051, detecting whether there are corresponding sub-blocks at the target positions;
[0073] When determining the target location of the classified log, the server detects whether there is a sub-block at the target location in the preset CUBE model. For example, when determining the target location of the classified log in the preset CUBE model, the server obtains the interface of the target location, detects the state of the interface, and determines whether there is a corresponding sub-block at the target location based on the state of the interface. If multiple classified logs are obtained, the target location corresponding to each classified log in the preset CUBE model is determined, and then each target location is detected to determine whether there is a corresponding sub-block.
[0074] Sub-step S1052: if a sub-block at the target position is detected, the classification log is stored in the sub-block;
[0075] When the server detects that there is a corresponding sub-block at the target location, the classification log is stored in the sub-block. For example, when the server detects that the state of the interface at the target location is a preset state, it is determined that there is a corresponding sub-block at the target location, and the classification log is added to the sub-block for storage. Among them, when multiple classification logs are obtained, if a sub-block at the target location corresponding to each classification log is detected, each classification log is added to the corresponding sub-block in turn for storage.
[0076] Sub-step S1053: If it is detected that no sub-block exists at the target position, the sub-block is constructed at the target position, and the classification log is stored in the sub-block.
[0077] When the server detects that there is no sub-block at the target position, a sub-block is constructed at the target position where there is no sub-block, and the classification log is stored in the constructed sub-block. For example, when the server detects that the state at the interface of the target position is not a preset state, it is determined that there is no sub-block at the target position, a sub-block is constructed at the target position, and the classification log is added to the sub-block for storage.
[0078] In this embodiment, by classifying a single log, multiple classified logs are obtained, and the same change data is recorded in different classified logs, thereby avoiding the situation where the log information is changed and the log information is false or lost. The classified logs are stored in a preset CUBE model to ensure the integrity and validity of the log information.
[0079] Please refer to Figure 6 , Figure 6 A flowchart of another log storage method provided in an embodiment of the present application.
[0080] like Figure 6 As shown, the log storage method includes steps S201 to S208.
[0081] Step S201: Detect the changed data of the target application and determine the change type of the changed data.
[0082] The server detects the changed data of the target application in real time. When the changed data of the target application is detected, the server obtains the attribute information of the changed data and determines the change type of the changed data based on the attribute information of the changed data. The changed data is the data recorded by the application during operation, or the data generated by the application based on the user's instructions. The changed data includes records of database login personnel, login time, execution actions, changed files, etc. For example, when it is detected that the changed data is a database login personnel, the change type of the changed data is determined to be a database change by obtaining the attribute information of the database login personnel as a database; when it is detected that the changed data is a changed file, the change type of the changed data is determined to be a file change by obtaining the attribute information of the changed file as a changed file.
[0083] Step S202: classify the change data according to the preset classification rules corresponding to the change type to obtain at least one classification log.
[0084] When determining the change type of the change data, the preset classification rules of the change type are obtained, and the change data is classified according to the preset classification rules, thereby obtaining at least one classification log. For example, the change type is a database change, and the preset classification rules of the database change are time, executor, execution action, etc. The change data is classified according to time, executor, and execution action to obtain a time log, executor log, execution action log, etc. The time log includes the time of entering the database, the time of changing the data, etc. The executor includes the account and password for logging into the target application, the account and password for logging into the database, etc. The execution work includes the changed data, name, etc. When the change data is obtained, the change data meets the preset classification rules of two or more classification logs, and at least one classification log is obtained, and there is no limit on the number of sub-classification logs.
[0085] Step S203: Obtain a log identifier of the classification log, and generate dimension information of the classification log according to the change type and the log identifier of the classification log.
[0086] When multiple classification logs are obtained, the log identifier of the classification log is obtained, and the dimension information of the classification log is generated by combining the change type and the log identifier of the classification log. For example, when the log identifier of the change script log is obtained, the log identifier of the change script log and the database change are used to generate the dimension information of the change script log. The dimension information of the classification log is generated with the change type as the first dimension and the log identifier as the second dimension, wherein the dimension information includes the time dimension, and the time in the time dimension information is the time recorded in the classification log.
[0087] Step S204: Determine the target location of the classified log in the preset CUBE model according to the dimension information of the classified log.
[0088] When the dimension information of the classification log is obtained, the preset CUBE model is called, and the preset CUBE model is queried through the dimension information of the classification log to determine the target location of the classification log in the preset CUBE model. CUBE (data cube) is an OLAP cube composed of three dimensions. The cube contains cell (sub-cube) values that meet the conditions. These cells contain the data to be analyzed, which are called metrics. Cube: A multidimensional space constructed by dimensions, which contains all the basic data to be analyzed, and all aggregate data operations are performed on the cube. Dimension: It is an angle to observe data. For example, application, change type, and time are all dimensions.
[0089] Three dimensions constitute a cube space. Dimension can be understood as an axis of a cube. There is a special dimension, namely the measure dimension. Dimension member: the basic unit that constitutes the dimension. For the time dimension, its members are: first quarter, second quarter, third quarter, and fourth quarter. Level: the hierarchical structure of the dimension. There are two levels: natural level and custom level. For the time dimension, (year, month, day) is one level of it, and (year, quarter, month) is another level of it. A dimension can have multiple levels. The level can be understood as a path for unit data aggregation. Level: The level constitutes the level. For a level of the time dimension (year, month, day), the year is a level, the month is a level, and the day is a level. Obviously, these levels have a parent-child relationship. Measure: the data to be analyzed and displayed, that is, the indicator. This CUBE model is a model for storing application log information. The CUBE model can store log information of multiple applications, and each application can be divided into multiple classified logs based on different change types. There is no limit on the number of dimension hierarchies of this CUBE model.
[0090] Step S205: Detect whether there are sub-blocks at the target position.
[0091] When the target location of the classified log in the preset CUBE model is obtained, the classified log is stored in the corresponding target location. For example, when the server determines the target location of the classified log in the preset CUBE model, obtains the interface of the target location, detects the state of the interface, and determines whether there is a corresponding sub-block at the target location based on the state of the interface. If multiple classified logs are obtained, the target location corresponding to each classified log in the preset CUBE model is determined, and then each target location is detected to determine whether there is a corresponding sub-block.
[0092] Step S206: If it is detected that a sub-block exists at the target position, the classification log is stored in the sub-block.
[0093] When the server detects that there are corresponding sub-blocks at the target location, the classification log is stored in the sub-block. For example, when the server detects that the state of the interface at the target location is the preset state, it is determined that there is a corresponding sub-block at the target location, and the classification log is added to the sub-block for storage. Among them, when multiple classification logs are obtained, if the sub-block at the target location corresponding to each classification log is detected, each classification log is added to the corresponding sub-block in turn for storage.
[0094] Step S207: During the process of constructing a sub-block at the target position, determine whether the sub-block at the target position is successfully constructed.
[0095] During the process of constructing the sub-block at the target location, the server determines whether the sub-block is successfully constructed at the target location. The preset CUBE model is in incremental construction mode. When new log information is detected in the application, the incremental construction mode is adopted to store the new log information in the preset CUBE model.
[0096] Step S208: If it is detected that the interface state at the target position is the preset state, it is determined that the sub-block at the target position is successfully constructed, and the classification log is stored in the sub-block.
[0097] When the state of the target location is detected as READY, RUNNING, or ERROR, the CUBE model is determined to have successfully constructed the sub-block, and the classification log is stored in the sub-block. For example, the server pre-agreed the state of the interface, and the state of the interface is agreed to be READY, RUNNING, or ERROR to indicate that the sub-block is successfully constructed. When the state of the interface is not detected to be one of the READY, RUNNING, or ERROR states, it is determined that the sub-block is unsuccessfully constructed at the interface.
[0098] In this embodiment, at least one classification log is obtained by classifying the change data of the application according to the preset classification rules of the change type, and the obtained classification log is stored in the preset CUBE model. Before storage, it is detected whether there is a sub-block at the target location of the classification log. If not, a sub-block of the classification log is constructed, and it is detected whether the sub-block is constructed successfully to avoid failure of classification log storage due to unsuccessful construction.
[0099] Please refer to Figure 7 , Figure 7 A schematic block diagram of a log storage device provided in an embodiment of the present application.
[0100] like Figure 7 As shown, the log storage device 400 includes: a first determination module 401 , a classification module 402 , a generation module 403 , a second determination module 404 , and a storage module 405 .
[0101] A first determination module 401 is used to detect the changed data of the target application and determine the change type of the changed data;
[0102] The classification module 402 is used to classify the change data according to the preset classification rules corresponding to the change type to obtain at least one classification log;
[0103] A generating module 403 is used to obtain a log identifier of the classification log, and generate dimension information of the classification log according to the change type and the log identifier of the classification log;
[0104] The second determination module 404 is used to determine the target position of the classification log in the preset CUBE model according to the dimension information of the classification log;
[0105] The storage module 405 is used to store the classification log according to the target position of the classification log in the preset CUBE model.
[0106] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module and unit can refer to the corresponding process in the aforementioned fraud identification method embodiment, and will not be repeated here.
[0107] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 8 Run on the server shown.
[0108] See also Figure 8 , Figure 8 A schematic block diagram of the structure of a server provided in an embodiment of the present application.
[0109] like Figure 8 As shown, the server includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0110] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any log storage method.
[0111] The processor is used to provide computing and control capabilities to support the operation of the entire server.
[0112] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any log storage method.
[0113] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0114] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0115] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0116] Detecting the changed data of the target application and determining the change type of the changed data;
[0117] Classify the change data according to the preset classification rules corresponding to the change type to obtain at least one classification log;
[0118] Obtaining a log identifier of the classification log, and generating dimension information of the classification log according to the change type and the log identifier of the classification log;
[0119] According to the dimension information of the classification log, determine the target location of the classification log in the preset CUBE model;
[0120] Store the classification logs according to their target location in the preset CUBE model.
[0121] In one embodiment, the processor, when implemented, is used to implement:
[0122] Check the target application's log files;
[0123] When the changed data in the log file is detected, the changed tool name in the changed data is obtained, and the preset tool type library is called;
[0124] Analyze the changed tool name through the preset tool type library to obtain the tool type corresponding to the changed tool name;
[0125] The change type of the changed data is determined based on the obtained tool type.
[0126] In one embodiment, the processor, when implemented, is used to implement:
[0127] Retrieve the preset classification library corresponding to the change type, and read the preset classification rules of each classification log in the preset classification library;
[0128] Acquire the attribute information of the changed data, classify the changed data according to the preset classification rules and attribute information of each classification log, and obtain at least one of the classification logs.
[0129] In one embodiment, the processor, when implemented, is used to implement:
[0130] The dimension information of the classification log is generated with the change type as the first dimension and the log identifier as the second dimension.
[0131] In one embodiment, the processor, when implemented, is used to implement:
[0132] According to the first dimension and the second dimension in the dimension information, the preset CUBE model is queried to obtain the target hierarchical space corresponding to the first dimension and the second dimension;
[0133] Read the time dimension information between the target levels, obtain the current time, and roll up the current time to generate a target date consistent with the time dimension information;
[0134] Determine the target block of the classification log between the target levels according to the target date;
[0135] Drill down on the time dimension information on the target block based on the current moment to determine the target position of the classification log in the target block.
[0136] In one embodiment, the processor, when implemented, is used to implement:
[0137] Check whether there are sub-blocks at the target position;
[0138] If it is detected that the sub-block exists at the target position, the classification log is stored in the sub-block;
[0139] If it is detected that the sub-block does not exist at the target position, a sub-block is constructed at the target position, and the classification log is stored in the sub-block.
[0140] In another embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0141] In the process of constructing a sub-block at the target position, determining whether the sub-block at the target position is successfully constructed;
[0142] If it is detected that the state at the target position is the preset state, it is determined that the sub-block at the target position is successfully constructed, and the classification log is stored in the sub-block.
[0143] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the log storage method of the present application.
[0144] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0145] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0146] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A log storage method, characterized in that: include: Detecting changed data of a target application and determining a change type of the changed data; Classify the change data according to the preset classification rule corresponding to the change type to obtain at least one classification log; Obtaining a log identifier of the classification log, and generating dimension information of the classification log according to the change type and the log identifier of the classification log; Determine the target position of the classified log in the preset CUBE model according to the dimension information of the classified log; The classification log is stored according to the target location of the classification log in the preset CUBE model.
2. The log storage method according to claim 1, characterized in that: The detecting the changed data of the target application and determining the change type of the changed data includes: Check the target application's log files; When the change data in the log file is detected, the change tool name in the change data is obtained, and a preset tool type library is retrieved; Analyze the changed tool name through the preset tool type library to obtain the tool type corresponding to the changed tool name; The change type of the change data is determined by the acquired tool type.
3. The log storage method according to claim 1, characterized in that: The step of classifying the change data according to the preset classification rule corresponding to the change type to obtain at least one classification log includes: Retrieving a preset classification library corresponding to the change type, and reading preset classification rules of each classification log in the preset classification library; Acquire the attribute information of the change data, classify the change data according to the preset classification rules of each of the classification logs and the attribute information, and obtain at least one of the classification logs.
4. The log storage method according to claim 1, characterized in that: The step of generating dimension information of the classification log according to the change type and the log identifier of the classification log includes: The dimension information of the classification log is generated with the change type as a first dimension and the log identifier as a second dimension.
5. The log storage method according to claim 4, characterized in that: Determining the target position of the classified log in the preset CUBE model according to the dimension information of the classified log includes: According to the first dimension and the second dimension in the dimension information, a preset CUBE model is queried to obtain target hierarchical spaces corresponding to the first dimension and the second dimension; Read the time dimension information between the target levels, obtain the current time, and roll up the current time to generate a target date consistent with the time dimension information; Determining a target block of the classified log between the target levels according to the target date; The time dimension information on the target block is drilled based on the current moment to determine the target position of the classification log in the target block.
6. The log storage method according to any one of claims 1 to 5, characterized in that: According to the target position of the classification log in the preset CUBE model, storing the classification log includes: Detecting whether there are sub-blocks at the target position; If it is detected that the sub-block exists at the target position, storing the classification log in the sub-block; If it is detected that the sub-block does not exist at the target position, the sub-block is constructed at the target position, and the classification log is stored in the sub-block.
7. The log storage method according to claim 6, characterized in that: The step of constructing the sub-block at the target position and storing the classification log in the sub-block comprises: In the process of constructing the sub-block at the target position, determining whether the sub-block is successfully constructed at the target position; If it is detected that the interface state at the target position is a preset state, it is determined that the sub-block at the target position is successfully constructed, and the classification log is stored in the sub-block.
8. A log storage device, characterized in that: The log storage device comprises: A first determination module, configured to detect the changed data of the target application and determine the change type of the changed data; A classification module, used to classify the change data according to a preset classification rule corresponding to the change type to obtain at least one classification log; A generating module, used for acquiring a log identifier of the classified log, and generating dimension information of the classified log according to the change type and the log identifier of the classified log; A second determination module is used to determine the target position of the classification log in the preset CUBE model according to the dimension information of the classification log; The storage module is used to store the classification log according to the target position of the classification log in the preset CUBE model.
9. A server, characterized in that: The server includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the log storage method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the log storage method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and system for multi-dimensional analysis of message service data
CN101197876A
Log based replication of distributed transactions using globally acknowledged commits
CN102037463A