CN114637762A - Method and device for generating operation record and electronic equipment - Google Patents
Method and device for generating operation record and electronic equipment Download PDFInfo
- Publication number
- CN114637762A CN114637762A CN202210241825.7A CN202210241825A CN114637762A CN 114637762 A CN114637762 A CN 114637762A CN 202210241825 A CN202210241825 A CN 202210241825A CN 114637762 A CN114637762 A CN 114637762A
- Authority
- CN
- China
- Prior art keywords
- data change
- data
- information
- field
- database
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3466—Performance evaluation by tracing or monitoring
- G06F11/3476—Data logging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
- G06F16/254—Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides an operation record generation method, an operation record generation device and electronic equipment. The data monitoring equipment is capable of monitoring data change logs corresponding to the data processing interfaces through the data monitoring equipment and analyzing the data change logs to generate operation records after the data processing interfaces in at least one background system are subjected to data operation processing through the data monitoring equipment which is configured in advance, and the operation records are not required to be configured for each data processing interface in the background system, so that the operation is simplified, and the development workload is reduced.
Description
Technical Field
The present invention relates to the field of data processing, and in particular, to a method and an apparatus for generating an operation record, and an electronic device.
Background
A project typically has one or more backend systems, and data processing interfaces in the backend systems are typically used to add or delete configurations or data, which are typically stored in a relational database.
When the background system has problems due to configuration or data mismatching, important information such as configured operation time, operators and the like can be found through the operation recording function. Therefore, the data processing interface in the background system usually needs to generate an operation record when adding or deleting the configuration or data.
At present, it is usually necessary to configure a corresponding operation record code for each data processing interface in the background system in advance, and after the data processing interface completes the corresponding add, delete and modify operations, the operation record is written by using the operation record code.
When the number of the data processing interfaces is large, corresponding operation record codes need to be configured for each data processing interface, the operation is complex, and the development workload is large.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for generating an operation record, and an electronic device, so as to solve the problems that when the number of data processing interfaces is large, corresponding operation record codes need to be configured for each data processing interface, the operation is complex, and the development workload is large.
In order to solve the technical problems, the invention adopts the following technical scheme:
a generation method of an operation record is applied to a data monitoring device, wherein the data monitoring device is communicated with at least one background system, and the generation method comprises the following steps:
acquiring a data change log corresponding to a database of the background system, and extracting data change information in a field of the data change information included in the data change log; the data change information comprises operation main body information and data change content which are determined after a data processing interface of the background system performs data processing operation and are added to the field by a database of the background system;
extracting operation subject information from the data change information based on an operation subject extraction rule;
determining data change content corresponding to a preset data change field in the data change information;
and generating an operation record comprising the operation subject information and the data change content.
Optionally, obtaining a data change log corresponding to the database of the background system includes:
acquiring a data change log set corresponding to a database of the background system;
and screening unprocessed data change logs from the data change log set based on the position field in the data change logs.
Optionally, extracting operation subject information from the data change information based on an operation subject extraction rule includes:
acquiring a first SQL statement comprising operation subject information in the data change information;
and analyzing the first SQL statement to obtain operation subject information which is positioned behind a preset character in the first SQL statement.
Optionally, after extracting the operation subject information from the data change information based on the operation subject extraction rule, the method further includes:
the operation subject information is saved to a temporary variable.
Optionally, determining data change content corresponding to a preset data change field in the data change information includes:
acquiring a second SQL statement comprising data change content in the data change information;
judging whether a preset data change field exists in the second SQL statement;
if the data change content exists, determining a data change identifier corresponding to the preset data change field, and extracting the data change content corresponding to the data change identifier from the second SQL statement.
Optionally, determining a data change identifier corresponding to the preset data change field includes:
acquiring a corresponding relation between a preset data change field and a data change identifier;
and inquiring to obtain a data change identifier corresponding to the preset data change field from the corresponding relation.
An operation record generating device applied to a data monitoring device, wherein the data monitoring device is in communication with at least one background system, and the generating device comprises:
the information extraction module is used for acquiring a data change log corresponding to a database of the background system and extracting data change information in a field of the data change log, wherein the field of the data change information is included in the data change log; the data change information comprises operation main body information and data change content which are determined after a data processing interface of the background system performs data processing operation and are added to the field by a database of the background system;
the main body determining module is used for extracting operation main body information from the data change information based on an operation main body extraction rule;
the change content determining module is used for determining data change content corresponding to a preset data change field in the data change information;
and the record generating module is used for generating an operation record comprising the operation subject information and the data change content.
Optionally, when the information extraction module is configured to obtain a data change log corresponding to the database of the background system, the information extraction module is specifically configured to:
and acquiring a data change log set corresponding to the database of the background system, and screening unprocessed data change logs from the data change log set based on the position fields in the data change logs.
Optionally, the subject determination module is specifically configured to:
and acquiring a first SQL statement comprising operation subject information in the data change information, and analyzing the first SQL statement to obtain the operation subject information which is positioned behind a preset character in the first SQL statement.
An electronic device, comprising: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to execute the above-described operation record generation method.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides a method and a device for generating an operation record and electronic equipment, wherein the data monitoring equipment can be communicated with at least one background system, the data monitoring equipment acquires a data change log corresponding to a database of the background system, extracts data change information in a field of the data change log, which comprises the data change information, extracts operation subject information from the data change information based on an operation subject extraction rule, determines data change content corresponding to a preset data change field in the data change information, and generates the operation record comprising the operation subject information and the data change content. According to the invention, the data monitoring equipment configured in advance can monitor the data change logs generated by the database after the data processing interfaces in at least one background system perform data operation processing, so that the data monitoring equipment can monitor the data change logs corresponding to a plurality of data processing interfaces and analyze the data change logs to generate the operation records, and corresponding operation record codes do not need to be configured for each data processing interface in the background system, thereby simplifying the operation and reducing the development workload.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for generating an operation record according to an embodiment of the present invention;
fig. 2 is a flowchart of another method for generating an operation record according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for generating an operation record according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of an operation record generation apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Databases are usually relational databases, which refer to databases that use a relational model to organize data, storing data in rows and columns. Commonly used relational databases include MySQL, Oracle, SQL Server, PostgreSQL
Database tables typically contain the following fields:
TABLE 1
An item typically has one or more backend systems, which typically function to add, delete, modify some configuration or data, which is typically stored in the relational database described above. The background system generally needs to provide an operation recording function for solving problems brought by the use of the background system by a user, for example, when the system has problems due to configuration or data mismatching, important information such as configuration operation time and operators can be found through the operation recording function; and secondly, the operation records can effectively prevent the problem that unexpected personnel can modify the system at will and cannot track and locate the system.
At present, a background system usually adopts a front-end and back-end separation architecture, which means that a system page is completed by front-end codes, system functions are developed by back-end codes in an API form, and data formats such as a channel JSON are interacted between the front end and the back end. When a user fills data in a background page and performs addition, deletion and modification operations, the front-end code calls a data processing interface corresponding to the back end, such as an API (application program interface), and transmits the data filled by the user to the back-end API for processing by using formats such as JSON (java server application program) and the like, so that the whole operation process is completed.
And the back-end API interface executes data configuration operation codes, performs operation recording after the data configuration operation is finished, and records the data, the operator, the operation time and other information of the operation in the database for storage.
The operation record module also provides an inquiry interface for the operation record for inquiring and displaying the detail of the operation record.
Although the above method can satisfy the requirement of operation record, there are some disadvantages as follows:
1. each data processing interface needs to write operation record codes and needs a large amount of development work
The writing of the operation record is usually realized after the functional logic of the interface is completed, the code written in the operation record is called, each interface of the part of the code needs to be developed, a lot of development work is added, and secondly, if some interfaces omit the operation record writing code, the record can be lost, and the positioning cannot be realized when problems occur.
2. Different background systems need to develop the operation recording function respectively.
Different background system codes are independent, because the operation recording codes and the service codes are written together in the traditional mode, an operation recording module realized by one background system cannot be provided for other background systems to use, and other background systems can only be developed once, so that a plurality of repeated development amounts are increased.
3. The change data is inconsistent with the operation record.
Generally, based on performance considerations, a configuration data update code and an operation record write code in a backend interface are not placed in the same thing, and under some abnormal conditions (such as network abnormality), a situation that the configuration data update is successful but the operation record write fails may occur, so that the changed data and the operation record are inconsistent, and certain influences are caused on tracking of operations and problem location.
The problem that the operation record function needs to be independently developed for each data processing interface in different background systems, development workload is large, and the problem that changed data are inconsistent with the operation record is solved. The inventor finds that an independent service can be deployed, the service monitors the database, and when the change of data in the database table is detected, the service generates an operation record according to the data before the change and the data after the change, so that the consistency of the changed data and the operation record is ensured, and the service is unaware. The method and the system only need to develop the service, do not need to repeatedly develop each interface, have universality and can be quickly expanded into a plurality of background systems.
The interface only needs to keep the original data processing logic, and no longer has the function of writing operation records, the newly developed service is used for monitoring the change of the configuration database, and when the change of the database data is detected, the addition, deletion and modification records in the database are screened out and written into the operation record database.
The data monitoring device can communicate with at least one background system, the data monitoring device obtains a data change log corresponding to a database of the background system, extracts data change information in fields of the data change log, which include the data change information, extracts operation subject information from the data change information based on an operation subject extraction rule, determines data change content corresponding to preset data change fields in the data change information, and generates an operation record including the operation subject information and the data change content. According to the invention, the data monitoring equipment configured in advance can monitor the data change logs generated by the database after the data processing interfaces in at least one background system perform data operation processing, so that the data monitoring equipment can monitor the data change logs corresponding to a plurality of data processing interfaces and analyze the data change logs to generate the operation records, and corresponding operation record codes do not need to be configured for each data processing interface in the background system, thereby simplifying the operation and reducing the development workload.
On the basis of the above content, an embodiment of the present invention provides a method for generating an operation record, which is applied to a data monitoring device, where the data monitoring device is configured with the developed service.
In this embodiment, the data monitoring device is in communication with at least one background system, each background system is configured with one database, the data monitoring device can monitor changes of the databases configured in the background systems, and when detecting that data in the databases change, add, delete, and modify records in the databases can be screened out and written into the operation record database.
Referring to fig. 1, the method of generating an operation record may include:
s11, acquiring a data change log corresponding to the database of the background system, and extracting data change information in fields of the data change information included in the data change log.
The data change information comprises operation main body information and data change content which are determined after a data processing interface of the background system performs data processing operation and are added to the field by a database of the background system.
In practical application, the database change monitoring service needs to use the function and the bottom logic of the database, taking the mysql database as an example, and the database change monitoring service uses the binlog log of the mysql.
binlog is a binary log maintained by mysql, and records change information of data, such as SQL statements for mysql data update or potentially update, and its general purpose is to retrieve data or synchronize data among multiple databases when data of the databases themselves is lost. The invention analyzes the content of the binlog log of the database and is used for producing the user operation record. Mysql data updates recorded by binlog or SQL statements in which updates potentially occur are saved in disk in the form of "transactions". The main fields in the Binlog data refer to table 2.
TABLE 2
Field(s) | Meaning of a field | Description of the invention |
Log_name | Name of log file | E.g. binlog.000005 |
Pos | Position of | |
Event_type | Event type | |
Server_id | Server id | |
End_log_pos | End position | |
Info | Detailed information | Data change information |
The database change monitoring service needs to acquire the change information of the database from a binlog, wherein the binlog is a binary file, and the content of the binlog can be acquired by analyzing the binlog by using a mysql tool carried by mysql. The format of binlog content is also divided into three types, namely a Statement mode, a Row mode and a Mixed mode, which have small differences, in short, the Statement mode records the original SQL Statement, the Row mode records the data change of each Row of data, and the Mixed mode is the mixture of the two.
For the operation recording requirement, the change of each Row of data is actually required instead of the original SQL, the data before the change and the data after the change need to be acquired, and the information is recorded in the Row mode, so that the functional requirement can be well met, and therefore, the binlog _ format of the mysql database needs to be set as Row.
Some information is necessary for generating an operation record in a field (table 2) included in the binlog log in the present embodiment. In general, it mainly comprises:
a Pos field: the data position used for recording the final processing, namely the data id;
info field (corresponding to the above field including data change information): the method is used for analyzing data change information to generate an operation record, wherein the most critical field is Info, and the format of the Info is generally as follows:
###UPDATE`test`.`user`
###WHERE
###@1=1/*INT meta=0nullable=0is_null=0*/
###@2='zhangsan1'/*VARSTRING(765)meta=765nullable=0is_null=0*/
###SET
###@1=1/*INT meta=0nullable=0is_null=0*/
###@2='zhangsan2'/*VARSTRING(765)meta=765nullable=0is_null=0*/
the above binlog log is the data change log in this embodiment. For different background systems, the obtained data change log is the log used by the corresponding background system.
When the database of the background system changes, if a certain data processing interface performs data processing operation, if data is added or deleted, the data processing interface determines operation subject information and data change content, and then the data is added to the Info field by the database, at this time, the database generates a data change log, and when a plurality of pieces of data change, a plurality of data change logs are generated, and the data change logs form a data change log set. The Info field in the data change log includes operation subject information and data change content.
To mark which data change logs have been processed and which have not been processed. In this embodiment, Pos fields in the data change logs are used for distinguishing, and if one data change log is processed, the Pos fields in the data change log are marked as processed.
Therefore, in this embodiment, the obtaining of the data change log corresponding to the database of the background system specifically includes:
and acquiring a data change log set corresponding to the database of the background system, and screening unprocessed data change logs from the data change log set based on a position field (Pos field) in the data change logs.
Specifically, the Pos field that was last processed last time may be obtained, and then the next data change log located after the Pos field is obtained, that is, the data change log that needs to be processed in this embodiment.
And after a data change log corresponding to the database of the background system is acquired, extracting data change information from the data change log.
Specifically, the data change information in the Info field is extracted from the data change log.
In practical application, the data change information includes two kinds of SQL statements, which are a first SQL statement and a second SQL statement respectively.
The first SQL statement includes operation subject information of the current data change, such as operator information.
Before submitting the data operation SQL, the backend interface in the background system submits an SQL statement of SET @ operatorxx, which is the first SQL statement in this embodiment, and the first SQL statement is recorded in the Info field content.
The second SQL statement includes data alteration content, such as data before alteration and data after alteration.
S12, extracting operation subject information from the data change information based on the operation subject extraction rule.
The operation subject information in the present embodiment is mainly operator information, that is, which operator operates this piece of data.
Specifically, referring to fig. 2, step S12 may include:
s21, acquiring a first SQL statement including operation subject information in the data change information.
The first SQL statement in this embodiment is the above-mentioned SQL statement of SET @ operatorxx.
Wherein xxx in SET @ OPERATORxxx is the operation subject information.
S22, analyzing the first SQL statement to obtain operation subject information which is in the first SQL statement and behind a preset character.
Specifically, xxx is extracted from SET @ operatorxx, and the operation subject information is obtained.
The SET @ OPERATOR is a preset character in this embodiment, and xxx after the preset character is operation subject information.
After the operation main body information is obtained through analysis, the operation main body information is stored in a temporary variable and is used for being filled in operator information when an operation record is generated.
And S13, determining data change content corresponding to a preset data change field in the data change information.
In this embodiment, the second SQL statement needs to be parsed to obtain the data change content.
Specifically, referring to fig. 3, step S13 may include:
and S31, acquiring a second SQL statement including data change content in the data change information.
In this embodiment, the statements in the data change information except the first SQL statement are referred to as a second SQL statement, and the second SQL statement includes data change contents.
S32, judging whether a preset data change field exists in the second SQL statement; if yes, go to step S33.
In this embodiment, the default data change field may be UPDATE, INSERT, DELETE. If yes, one of the three fields is considered to be the preset data change field, namely the piece of data is changed.
And S33, determining a data change identifier corresponding to the preset data change field, and extracting data change content corresponding to the data change identifier from the second SQL statement.
Specifically, taking UPDATE as an example,
###UPDATE`test`.`user`
###WHERE
###@1=1/*INT meta=0nullable=0is_null=0*/
###@2='zhangsan1'/*VARSTRING(765)meta=765nullable=0is_null=0*/
###SET
###@1=1/*INT meta=0nullable=0is_null=0*/
###@2='zhangsan2'/*VARSTRING(765)meta=765nullable=0is_null=0*/
the data before modification is stored in the WHERE, the data after modification is stored in the SET, and at this time, the data can be used for generating the operation record only by extracting the data by using the code.
In this embodiment, the WHERE and the SET are data change identifiers corresponding to a preset data change field UPDATE, and the content in the WHERE and the SET is data change content.
It should be noted that different preset data change fields may have different corresponding data change identifiers, a corresponding relationship between the preset data change field and the data change identifier is pre-established, and then, for a certain preset data change field, the data change identifier corresponding to the preset data change field is obtained by querying from the corresponding relationship. And then querying the content in the data change identifier, wherein the content is the data change content.
And S14, generating an operation record comprising the operation subject information and the data change content.
In practical applications, the operation subject information and the data change content may be directly stored in a database as the content of the operation record.
In this embodiment, after the database change monitoring service is started, the service will keep running all the time, first, the service acquires Pos field information that was last processed one piece at the last time, then, through mysql brinlog, queries new binlog data after the Pos position was processed last time, parses the data pieces out, then processes each piece, and extracts Pos field information and Info data change information from the data pieces. Then judging whether the information contains SET @ OPERATOR characters or not, if so, extracting the subsequent OPERATOR and storing the subsequent OPERATOR in a temporary variable, then judging whether the information contains INSERT, DELETE and UPDATE information or not, if so, indicating that the information needs to be concerned, extracting the pre-change data, the post-change data and the OPERATOR information in the temporary variable as operation records and writing the operation records into a database, finally, storing Pos field information as latest processing information, and after one-time execution, returning the program to a mysqlbinllog reading stage and continuously repeating the process.
In this embodiment, the data monitoring device can communicate with at least one backend system, and the data monitoring device obtains a data change log corresponding to a database of the backend system, extracts data change information in a field of the data change log that includes the data change information, extracts operation subject information from the data change information based on an operation subject extraction rule, determines data change content corresponding to a preset data change field in the data change information, and generates an operation record that includes the operation subject information and the data change content. According to the invention, the data monitoring equipment configured in advance can monitor the data change logs generated by the database after the data processing interfaces in at least one background system perform data operation processing, so that the data monitoring equipment can monitor the data change logs corresponding to a plurality of data processing interfaces and analyze the data change logs to generate the operation records, and corresponding operation record codes do not need to be configured for each data processing interface in the background system, thereby simplifying the operation and reducing the development workload.
In addition, the data monitoring equipment in the invention is developed once, can monitor a plurality of background systems, has good universality, realizes the function of quickly adding operation records to the background systems under the condition that the background systems do not need to be modified, and effectively solves the problem that the traditional background is not universal enough in the process of realizing the operation records by repeated development.
Optionally, on the basis of the embodiment of the operation record generation method, another embodiment of the present invention provides an operation record generation apparatus, which is applied to a data monitoring device, where the data monitoring device is in communication with at least one backend system, and with reference to fig. 4, the generation apparatus includes:
the information extraction module 11 is configured to obtain a data change log corresponding to the database of the background system, and extract data change information in a field of the data change log that includes the data change information; the data change information comprises operation main body information and data change content which are determined after a data processing interface of the background system performs data processing operation and are added to the field by a database of the background system;
a main body determining module 12, configured to extract operation main body information from the data change information based on an operation main body extraction rule;
a change content determining module 13, configured to determine data change content corresponding to a preset data change field in the data change information;
and a record generating module 14, configured to generate an operation record including the operation subject information and the data change content.
Further, when the information extraction module is configured to obtain a data change log corresponding to the database of the background system, the information extraction module is specifically configured to:
and acquiring a data change log set corresponding to the database of the background system, and screening unprocessed data change logs from the data change log set based on the position field in the data change logs.
Further, the subject determination module is specifically configured to:
and acquiring a first SQL statement comprising operation subject information in the data change information, and analyzing the first SQL statement to obtain the operation subject information which is positioned behind a preset character in the first SQL statement.
Further, still include:
and the data storage module is used for storing the operation main body information into a temporary variable.
Further, the alteration content determining module 13 includes:
the statement acquisition submodule is used for acquiring a second SQL statement comprising data change content in the data change information;
the judging submodule is used for judging whether a preset data change field exists in the second SQL statement;
and the extraction submodule is used for determining a data change identifier corresponding to the preset data change field if the data change identifier exists, and extracting data change content corresponding to the data change identifier from the second SQL statement.
Further, when the extraction sub-module is configured to determine the data change identifier corresponding to the preset data change field, the extraction sub-module is specifically configured to:
and acquiring the corresponding relation between a preset data change field and a data change identifier, and inquiring the corresponding relation to obtain the data change identifier corresponding to the preset data change field.
In this embodiment, the data monitoring device may communicate with at least one backend system, and the data monitoring device obtains a data change log corresponding to a database of the backend system, extracts data change information in a field of the data change log that includes data change information, extracts operation subject information from the data change information based on an operation subject extraction rule, determines data change content corresponding to a preset data change field in the data change information, and generates an operation record that includes the operation subject information and the data change content. According to the invention, the data monitoring equipment configured in advance can monitor the data change logs generated by the database after the data processing interfaces in at least one background system perform data operation processing, so that the data monitoring equipment can monitor the data change logs corresponding to a plurality of data processing interfaces and analyze the data change logs to generate the operation records, and corresponding operation record codes do not need to be configured for each data processing interface in the background system, thereby simplifying the operation and reducing the development workload.
In addition, the data monitoring equipment in the invention is developed once, can monitor a plurality of background systems, has good universality, realizes the function of quickly adding operation records to the background systems under the condition that the background systems do not need to be modified, and effectively solves the problem that the traditional background is not universal enough in the process of realizing the operation records by repeated development.
It should be noted that, for the working processes of each module and each sub-module in this embodiment, please refer to the corresponding description in the above embodiments, which is not described herein again.
Optionally, on the basis of the above embodiment of the method and apparatus for generating an operation record, another embodiment of the present invention provides an electronic device, including: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to execute the above-described operation record generation method.
In this embodiment, the data monitoring device may communicate with at least one backend system, and the data monitoring device obtains a data change log corresponding to a database of the backend system, extracts data change information in a field of the data change log that includes data change information, extracts operation subject information from the data change information based on an operation subject extraction rule, determines data change content corresponding to a preset data change field in the data change information, and generates an operation record that includes the operation subject information and the data change content. According to the invention, the data monitoring equipment configured in advance can monitor the data change logs generated by the database after the data processing interfaces in at least one background system perform data operation processing, so that the data monitoring equipment can monitor the data change logs corresponding to a plurality of data processing interfaces and analyze the data change logs to generate the operation records, and corresponding operation record codes do not need to be configured for each data processing interface in the background system, thereby simplifying the operation and reducing the development workload.
In addition, the data monitoring equipment in the invention is developed once, can monitor a plurality of background systems, has good universality, realizes the function of quickly adding operation records to the background systems under the condition that the background systems do not need to be modified, and effectively solves the problem that the traditional background is not universal enough in the process of realizing the operation records by repeated development.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. A method for generating an operation record is applied to a data monitoring device, wherein the data monitoring device is in communication with at least one background system, and the method for generating the operation record comprises the following steps:
acquiring a data change log corresponding to a database of the background system, and extracting data change information in a field of the data change log, wherein the field comprises the data change information; the data change information comprises operation main body information and data change content which are determined after a data processing interface of the background system performs data processing operation and are added to the field by a database of the background system;
extracting operation subject information from the data change information based on an operation subject extraction rule;
determining data change content corresponding to a preset data change field in the data change information;
and generating an operation record comprising the operation subject information and the data change content.
2. The method according to claim 1, wherein obtaining the data change log corresponding to the database of the backend system comprises:
acquiring a data change log set corresponding to a database of the background system;
and screening unprocessed data change logs from the data change log set based on the position field in the data change logs.
3. The generation method according to claim 1, wherein extracting the operation subject information from the data change information based on an operation subject extraction rule includes:
acquiring a first SQL statement comprising operation subject information in the data change information;
and analyzing the first SQL statement to obtain operation subject information which is positioned behind a preset character in the first SQL statement.
4. The generation method according to claim 1, further comprising, after extracting the operation subject information from the data change information based on an operation subject extraction rule:
the operation subject information is saved to a temporary variable.
5. The generation method according to claim 1, wherein determining data change contents corresponding to a preset data change field in the data change information includes:
acquiring a second SQL statement comprising data change content in the data change information;
judging whether a preset data change field exists in the second SQL statement;
if the data change content exists, determining a data change identifier corresponding to the preset data change field, and extracting the data change content corresponding to the data change identifier from the second SQL statement.
6. The generation method according to claim 5, wherein determining the data change identifier corresponding to the preset data change field includes:
acquiring a corresponding relation between a preset data change field and a data change identifier;
and querying to obtain a data change identifier corresponding to the preset data change field from the corresponding relation.
7. An apparatus for generating an operation record, applied to a data monitoring device, the data monitoring device being in communication with at least one background system, the apparatus comprising:
the information extraction module is used for acquiring a data change log corresponding to a database of the background system and extracting data change information in a field of the data change log, wherein the field of the data change information is included in the data change log; the data change information comprises operation main body information and data change content which are determined after a data processing interface of the background system performs data processing operation and are added to the field by a database of the background system;
the main body determining module is used for extracting operation main body information from the data change information based on an operation main body extraction rule;
the change content determining module is used for determining data change content corresponding to a preset data change field in the data change information;
and the record generating module is used for generating an operation record comprising the operation subject information and the data change content.
8. The generation apparatus according to claim 7, wherein the information extraction module, when acquiring the data change log corresponding to the database of the backend system, is specifically configured to:
and acquiring a data change log set corresponding to the database of the background system, and screening unprocessed data change logs from the data change log set based on the position fields in the data change logs.
9. The generation apparatus according to claim 7, wherein the subject determination module is specifically configured to:
and acquiring a first SQL statement comprising operation subject information in the data change information, and analyzing the first SQL statement to obtain the operation subject information which is positioned behind a preset character in the first SQL statement.
10. An electronic device, comprising: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is adapted to perform the method of generating an operation record according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210241825.7A CN114637762A (en) | 2022-03-11 | 2022-03-11 | Method and device for generating operation record and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210241825.7A CN114637762A (en) | 2022-03-11 | 2022-03-11 | Method and device for generating operation record and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114637762A true CN114637762A (en) | 2022-06-17 |
Family
ID=81948677
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210241825.7A Pending CN114637762A (en) | 2022-03-11 | 2022-03-11 | Method and device for generating operation record and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114637762A (en) |
-
2022
- 2022-03-11 CN CN202210241825.7A patent/CN114637762A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102073640B (en) | Method, system and server for testing structured query language (SQL) statements | |
EP3343411A1 (en) | Sql auditing method and apparatus, server and storage device | |
US20100280990A1 (en) | Etl for process data warehouse | |
CN111259004B (en) | Method for indexing data in storage engine and related device | |
CN111563041B (en) | Test case on-demand accurate execution method | |
CN111339171B (en) | Data query method, device and equipment | |
US6708185B2 (en) | SQL execution analysis | |
CN111414362B (en) | Data reading method, device, equipment and storage medium | |
CN111831755B (en) | Cross-database data synchronization method, system, medium and device | |
CN110096419A (en) | Acquisition methods, interface log management server and the service server of interface log | |
CN110674161A (en) | Method, system, storage medium and SQL operation platform for online SQL | |
WO2020155651A1 (en) | Method and device for storing and querying log information | |
CN111737148A (en) | Automatic regression testing method and device, computer equipment and storage medium | |
CN112925757A (en) | Method, equipment and storage medium for tracking operation log of intelligent equipment | |
CN114116764A (en) | Index query method, device, medium and electronic equipment based on syntax tree | |
CN107193736B (en) | Test method, test device, electronic device, and storage medium | |
CN111046382B (en) | Database auditing method, equipment, storage medium and device | |
CN111125045B (en) | Lightweight ETL processing platform | |
CN111125226B (en) | Configuration data acquisition method and device | |
CN110309206B (en) | Order information acquisition method and system | |
CN114637762A (en) | Method and device for generating operation record and electronic equipment | |
CN110727565B (en) | Network equipment platform information collection method and system | |
CN113778795B (en) | Cross-version Oracle monitoring system based on Python language | |
CN111143406A (en) | Database data comparison method and database data comparison system | |
CN114356454A (en) | Account checking data processing method, account checking data processing device, account checking data storage medium and program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |