CN110908967B - Method, device, equipment and computer readable medium for storing log - Google Patents

Method, device, equipment and computer readable medium for storing log Download PDF

Info

Publication number
CN110908967B
CN110908967B CN201911106047.5A CN201911106047A CN110908967B CN 110908967 B CN110908967 B CN 110908967B CN 201911106047 A CN201911106047 A CN 201911106047A CN 110908967 B CN110908967 B CN 110908967B
Authority
CN
China
Prior art keywords
log
information
matching
output
label
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.)
Active
Application number
CN201911106047.5A
Other languages
Chinese (zh)
Other versions
CN110908967A (en
Inventor
赵瑾阳
林冰
王洪旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Yuntuteng Technology Co ltd
Original Assignee
Beijing Baidu Yuntuteng Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Yuntuteng Technology Co ltd filed Critical Beijing Baidu Yuntuteng Technology Co ltd
Priority to CN201911106047.5A priority Critical patent/CN110908967B/en
Publication of CN110908967A publication Critical patent/CN110908967A/en
Application granted granted Critical
Publication of CN110908967B publication Critical patent/CN110908967B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Abstract

Embodiments of the present disclosure disclose methods, apparatuses, devices and computer readable media for storing logs. One embodiment of the method comprises: generating at least one piece of matching pattern information based on the configuration file; in response to detecting a target log, determining related information of the target log, wherein the related information comprises tag information; determining whether the tag information is successfully matched with each piece of matching pattern information in the at least one piece of matching pattern information; and responding to the matching success, and storing the target log to a corresponding position. According to the implementation mode, different modules of the log use different levels of storage, and therefore the software running efficiency is improved.

Description

Method, device, equipment and computer readable medium for storing log
Technical Field
Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer-readable medium for storing a log.
Background
Network devices, systems, and service programs, etc., all generate a log record during operation. Each row of the log records the description of the date, time, user and action. At present, the recording of large software logs cannot be met by adopting technologies such as single log files, single log grades and the like on the log records of software.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose methods, apparatuses, devices and computer readable media for storing logs.
In a first aspect, some embodiments of the present disclosure provide a method for storing a log, the method comprising: generating at least one piece of matching pattern information based on the configuration file; in response to detecting a target log, determining related information of the target log, wherein the related information comprises tag information; determining whether the tag information is successfully matched with each piece of matching pattern information in the at least one piece of matching pattern information; and responding to the matching success, and storing the target log to a corresponding position.
In some embodiments, the above method further comprises: and responding to the unmatched matching pattern information, and continuously matching the tag information with the unmatched matching pattern information in the at least one piece of matching pattern information.
In some embodiments, the generating at least one matching pattern based on the configuration file includes: analyzing the configuration file to obtain an output rule of the log; and generating at least one matching mode and opening the file and the network interface corresponding to the output rule according to the output rule.
In some embodiments, the related information further includes at least one of: content information, rating information.
In some embodiments, the storing the target log in a corresponding location in response to a successful matching includes: formatting the content information of the target log to obtain formatted content information; and outputting the formatted content information to a file or a network interface corresponding to the formatted content information.
In some embodiments, the storing the target log to a corresponding location includes: according to the content information of the target log, acquiring a label type corresponding to the content information from a log database, wherein the log database is used for storing log contents and log label types corresponding to the log contents; acquiring an output position of a target log corresponding to the label type from a label database according to the label type, wherein the label database is used for storing the output positions of the log corresponding to the label type and the label type of the log; and storing the target log corresponding to the content information of the target log in the output position.
In some embodiments, the configuration file includes: a file of rules for logging.
In a second aspect, some embodiments of the present disclosure provide an apparatus for storing a log, the apparatus comprising: a generating unit configured to generate at least one piece of matching pattern information based on the configuration file; a determining unit configured to determine, in response to detection of a target log, related information of the target log, the related information including tag information; a matching unit configured to determine whether the tag information is successfully matched with each piece of the at least one piece of matching pattern information; and the storage unit is configured to respond to the fact that the matching is determined to be successful, and store the target log to the corresponding position.
In a third aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by the one or more processors, cause the one or more processors to implement the method as in any one of the first aspects.
In a fourth aspect, some embodiments of the disclosure provide a computer readable medium having a computer program stored thereon, wherein the program when executed by a processor implements the method as in any one of the first aspect.
One of the above-described various embodiments of the present disclosure has the following advantageous effects: based on the configuration file, at least one piece of matching pattern information may be obtained. And in response to detecting the target log, determining relevant information of the target log, thereby obtaining label information of the target log. And determining whether the label information of the target log is matched with each piece of matching information in the at least one piece of matching pattern information, and storing the target log to a corresponding position in response to successful matching determination. Therefore, the storage of logs by different modules by using different levels of technologies can be better realized. And further improve the efficiency of software operation. While also reducing the time required to analyze software behavior. By utilizing the technology of controlling the log grade by different modules in a grading way, the software can be directly distributed to a plurality of log output positions when generating logs, and the service life of a magnetic disk is further prolonged.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
FIG. 1 is a schematic diagram of one application scenario of a method for storing logs, in accordance with some embodiments of the present disclosure;
FIG. 2 is a flow diagram of some embodiments of a method for storing logs according to the present disclosure;
FIG. 3 is a schematic block diagram of some embodiments of an apparatus for storing logs according to the present disclosure;
FIG. 4 is a schematic block diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of one application scenario of a method for storing logs according to some embodiments of the present disclosure.
As shown in fig. 1, running the software, the server 101 parses the configuration file 102 to generate at least one matching pattern 103. For example, an a matching pattern shown by reference numeral 1031, a B matching pattern shown by reference numeral 1032, and a C matching pattern shown by reference numeral 1033.
The server 101 detects the target log 104, determines the tag information 105 of the target log, and determines whether the tag information 105 of the target log matches the a matching pattern shown by reference numeral 1031.
In response to determining that the match was successful, the server 101 stores the contents of the target log 104 to the corresponding location 106.
It is understood that the method for storing the log may be executed by the server 101 or may be executed by the terminal device, and the execution main body of the method may further include a device formed by integrating the server 101 and the terminal device through a network, or may also be executed by various software programs. The server 101 may be a server providing various services, such as a background application server providing support for applications displayed on the terminal device. Further, the execution main body may also be embodied as a terminal device, software, or the like. When the execution subject is software, the software can be installed in the electronic device listed above. It may be implemented, for example, as multiple software or software modules to provide distributed services, or as a single software or software module. And is not particularly limited herein.
It should be understood that the number of servers in fig. 1 is merely illustrative. There may be any number of servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a method for storing logs in accordance with the present disclosure is shown. The method for storing the log comprises the following steps:
step 201, generating at least one piece of matching pattern information based on the configuration file.
In some embodiments, the executing agent of the method for storing a log (e.g., the server shown in FIG. 1) may first analyze the configuration file and then convert the portion of the log tag therein from a string to a Category that can resolve the "!in the log tag! Is it a question of Plus ", and check if the rule is met when the log is output. Each row of output rules generates a Category, and each Category corresponds to a matching pattern. And then at least one piece of matching pattern information is obtained. The matching pattern information may be information of a matching method for the log label. The matching pattern may include a perfect match and a pattern match. The configuration files comprise files with upper limit of the size of the log file, files of each grade of the log and the corresponding numerical value of the log, files with various log output formats and files with log output rules corresponding to different log labels. The log output rules include rules supporting complete matching and pattern matching of log tags, rules supporting definition of output levels of logs corresponding to each log tag, rules supporting definition of output formats of logs corresponding to each log tag, and rules supporting definition of output positions of logs corresponding to each log tag.
The above-mentioned rule of complete matching may refer to complete matching between the labels of the log. For example, a log export rule is that logs with a log label of "cat" with a log level greater than or equal to "ERROR" are exported to a file named "aa. For example, at "aa.log" of the log output, the tag of the log output must be "cat", and logs tagged as "acat", "cats", etc. will not be output to the file named "aa.log" pointed to by the log output rule. The output format of the log may refer to the content of the log in addition to the content specified by the application. For example, "% D% V [% F:% L ]% m% n", where "% D" represents the time of log output, "% V" represents the level of log output, "[% F:% L ]" represents the code file location and row number, "% m" represents the content of log output, and "% n" represents a line break. The patterns in the pattern matching described above may include "! "not matching pattern. For example, "! The cat "matching journal tag is not a journal of" cat ". The pattern in the pattern matching may include any 0 or more character (×) matching pattern. For example, a "cat" matching journal tag is a journal beginning with "cat," such as "catabc," "cat," and the like. The "cat × dog" matching log label is the beginning of "cat", and the "dog end" has a log with any number of characters in the middle, such as "cataabclog", "catdog", and the like. The pattern in the above-described pattern matching may include a matching pattern of any of a plurality of characters (+). For example, a "cat +" matching log tag is a log that begins with "cat" and is followed by at least one character, such as "catabc," "cata," and so on. The "cat + dog" matching log label is the "cat" beginning, and the "dog end" has a log with multiple characters in the middle, such as "cataabclog", "cat-dog", etc. The patterns in the pattern matching described above may include matching patterns of any single character (. For example, "cat? "will match log labels" cat "," cat1 ", etc. logs.
Optionally, the configuration file may include a file of rules for logging.
In some optional implementation manners of some embodiments, the execution subject may parse the configuration file to obtain an output rule of the log. The execution body may generate at least one matching pattern for the log output rule.
Step 202, in response to detecting the target log, determining related information of the target log.
In some embodiments, in response to detecting the target log, the execution subject (e.g., the server shown in fig. 1) may determine relevant information of the target log by detecting. Wherein the related information includes tag information. The target log may be logs generated by different modules of the software.
In some optional implementation manners of some embodiments, the related information may further include: content information, rating information.
Step 203, determining whether the matching between the tag information and each piece of matching pattern information in the at least one piece of matching pattern information is successful.
In some embodiments, based on the at least one matching pattern information obtained in step 201 and the related information of the target log obtained in step 202, the executing entity may match the tag information with the at least one matching pattern information, so as to determine whether the matching is successful.
And step 204, in response to the fact that the matching is determined to be successful, storing the target log to a corresponding position.
In some embodiments, in response to determining that the matching is successful, the execution main body may obtain, through an output rule corresponding to a matching pattern in which the matching of the tag information is successful, an output level and an output position of a target log corresponding to the tag information, and further store the target log in the corresponding position.
In some optional implementation manners of some embodiments, first, the execution main body performs a formatting operation on the content information of the target log to obtain formatted content information. Then, the execution body outputs the formatted contents information to a file or a network interface corresponding to the formatted contents information.
In some optional implementation manners of some embodiments, in response to the mismatch being successful, the executing entity may continue to match the tag information with unmatched matching pattern information in the at least one matching pattern information until the unmatched matching pattern information and the tag information are respectively matched once.
In some optional implementations of some embodiments, the executing body may perform the following steps: firstly, according to the content information of the target log, acquiring a label type corresponding to the content information from a log database, wherein the log database is used for storing log contents and log label types corresponding to the log contents; the log database may be user created. Then, according to the label type, acquiring an output position of a target log corresponding to the label type from a label database, wherein the label database is used for storing the output positions of the log corresponding to the label type and the label type of the log; the tag database may be user created. And finally, storing the target log corresponding to the target log content information to the output position.
Some embodiments of the present disclosure disclose a method for storing a log, which may obtain at least one piece of matching pattern information based on a configuration file. And in response to detecting the target log, determining relevant information of the target log, thereby obtaining label information of the target log. And determining whether the label information of the target log is matched with each piece of matching information in the at least one piece of matching pattern information, and storing the target log to a corresponding position in response to successful matching determination. Therefore, the storage of logs by different modules by using different levels of technologies can be better realized. And further improve the efficiency of software operation. While also reducing the time required to analyze software behavior. By utilizing the technology of controlling the log grade by different modules in a grading way, the software can be directly distributed to a plurality of log output positions when generating logs, and the service life of a magnetic disk is further prolonged.
With further reference to fig. 3, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of an apparatus for storing logs, which correspond to those of the method embodiments shown in fig. 2, and which may be applied in various electronic devices in particular.
As shown in fig. 3, an apparatus 300 for storing logs of some embodiments includes: a generating unit 301, a determining unit 302, a matching unit 303 and a storing unit 304. Wherein the generating unit 301 is configured to generate at least one piece of matching pattern information based on the configuration file; the determining unit 302 is configured to determine, in response to detecting a target log, related information of the target log, where the related information includes tag information; the matching unit 303 is configured to determine whether the tag information is successfully matched with each piece of matching pattern information in the at least one piece of matching pattern information; and the storage unit 304 is configured to store the target log to a corresponding location in response to determining that the matching is successful.
In an alternative implementation of some embodiments, the generating unit 301 of the apparatus 300 for storing a log may obtain at least one matching pattern by analyzing a configuration file.
In an optional implementation manner of some embodiments, the generating unit 301 of the apparatus 300 for storing a log is further configured to parse the configuration file to obtain an output rule of the log; and generating at least one matching mode and opening the file and the network interface corresponding to the output rule according to the output rule.
In an optional implementation manner of some embodiments, the determining unit 302 may further determine the target file related information according to the detected target log, where the related information may include tag information.
In an optional implementation manner of some embodiments, the determining unit 302 of the apparatus 300 for storing a log is further configured to further include the following at least one item of related information: content information, rating information.
In an optional implementation manner of some embodiments, the storage unit 304 of the apparatus 300 for storing a log is further configured to perform a formatting operation on the content information of the target log, so as to obtain formatted content information; and outputting the formatted content information to a file or a network interface corresponding to the formatted content information.
In an optional implementation manner of some embodiments, the apparatus 300 for storing a log is further configured to configure the configuration file to include: a file of rules for logging.
In an optional implementation manner of some embodiments, the apparatus 300 for storing a log is further configured to, in response to a successful mismatch, continue to match the tag information with unmatched matching pattern information of the at least one piece of matching pattern information.
Referring now to fig. 4, a schematic diagram of an electronic device (e.g., the server of fig. 1) 400 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, electronic device 400 may include a processing device (e.g., central processing unit, graphics processor, etc.) 401 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage device 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the electronic apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM403 are connected to each other through a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 408 including, for example, magnetic tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate wirelessly or by wire with other devices to exchange data. While fig. 4 illustrates an electronic device 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 4 may represent one device or may represent multiple devices as desired.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network through the communication device 409, or from the storage device 408, or from the ROM 402. The computer program, when executed by the processing apparatus 401, performs the above-described functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described above in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: generating at least one piece of matching pattern information based on the configuration file; in response to detecting a target log, determining related information of the target log, wherein the related information comprises tag information; determining whether the tag information is successfully matched with each piece of matching pattern information in the at least one piece of matching pattern information; and responding to the matching success, and storing the target log to a corresponding position.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a generation unit, a determination unit, a matching unit, and a storage unit. Where the names of the units do not in some cases constitute a limitation on the units themselves, for example, the generating unit may also be described as a "unit that generates at least one piece of matching pattern information based on a configuration file".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (9)

1. A method for storing logs, comprising:
generating at least one piece of matching mode information based on a configuration file, wherein the matching mode information is information of a matching mode of log labels, the configuration file comprises files of various levels and corresponding numerical values of logs and files of log output rules corresponding to different log labels, and the log output rules comprise rules for supporting definition of output levels of logs corresponding to each log label, rules for supporting definition of output formats of logs corresponding to each log label and rules for supporting definition of output positions of logs corresponding to each log label;
in response to detecting a target log, determining relevant information of the target log, wherein the relevant information comprises target log tag information;
determining whether the tag information is successfully matched with each piece of matching pattern information in the at least one piece of matching pattern information;
in response to determining that the matching is successful, storing the target log to a corresponding location;
and responding to the unmatched information, and continuously matching the tag information with unmatched matching pattern information in the at least one piece of matching pattern information.
2. The method of claim 1, wherein the generating at least one matching pattern based on a profile comprises:
analyzing the configuration file to obtain an output rule of the log;
and generating at least one matching mode and opening a file and a network interface corresponding to the output rule according to the output rule.
3. The method of claim 2, wherein the related information further comprises at least one of: content information, rating information.
4. The method of claim 3, wherein the storing the target log to a corresponding location in response to a successful match comprises:
formatting the content information of the target log to obtain formatted content information;
and outputting the formatted content information to a file or a network interface corresponding to the formatted content information.
5. The method of claim 3, wherein the storing the target log to a corresponding location comprises:
according to the content information of the target log, acquiring a label category corresponding to the content information from a log database, wherein the log database is used for storing the log content and the label category corresponding to the log content;
According to the label type, obtaining the output position of a target log corresponding to the label type from a label database, wherein the label database is used for storing the label type of the log and the output position of the log corresponding to the label type of the log;
and storing the target log corresponding to the content information of the target log to the output position.
6. The method of any of claims 1-5, wherein the configuration file comprises: a file of rules for logging.
7. An apparatus for storing logs, comprising:
the generating unit is configured to generate at least one piece of matching mode information based on a configuration file, wherein the matching mode information is information of a matching mode of the log labels, the configuration file comprises files of various levels and corresponding numerical values of the log and files of log output rules corresponding to different log labels, and the log output rules comprise rules supporting definition of output levels of the log corresponding to each log label, rules supporting definition of output formats of the log corresponding to each log label and rules supporting definition of output positions of the log corresponding to each log label;
A determining unit configured to determine relevant information of a target log in response to detection of the target log, wherein the relevant information includes target log tag information;
a matching unit configured to determine whether the tag information is successfully matched with each piece of the at least one piece of matching pattern information;
a storage unit configured to store the target log to a corresponding location in response to determining that the matching is successful;
and the continuous matching unit is configured to continuously match the tag information with the unmatched matching pattern information in the at least one piece of matching pattern information in response to the unmatched matching.
8. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
9. A computer-readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1-6.
CN201911106047.5A 2019-11-13 2019-11-13 Method, device, equipment and computer readable medium for storing log Active CN110908967B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911106047.5A CN110908967B (en) 2019-11-13 2019-11-13 Method, device, equipment and computer readable medium for storing log

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911106047.5A CN110908967B (en) 2019-11-13 2019-11-13 Method, device, equipment and computer readable medium for storing log

Publications (2)

Publication Number Publication Date
CN110908967A CN110908967A (en) 2020-03-24
CN110908967B true CN110908967B (en) 2022-08-12

Family

ID=69817383

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911106047.5A Active CN110908967B (en) 2019-11-13 2019-11-13 Method, device, equipment and computer readable medium for storing log

Country Status (1)

Country Link
CN (1) CN110908967B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400322B (en) * 2020-03-25 2023-10-03 抖音视界有限公司 Method, apparatus, electronic device and medium for storing data
CN111884752B (en) * 2020-07-29 2022-09-30 中国工商银行股份有限公司 Method, apparatus, system, and medium for determining clock detection object
CN113172620A (en) * 2021-03-29 2021-07-27 北京京东乾石科技有限公司 Robot control method, device, electronic equipment and computer readable medium
CN115408344B (en) * 2022-09-29 2023-12-08 建信金融科技有限责任公司 Log formatting method, device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868340A (en) * 2016-03-28 2016-08-17 乐视控股(北京)有限公司 Log storage method and device
EP3401791A1 (en) * 2017-05-12 2018-11-14 Fujitsu Limited Log output control apparatus, log output control method, and database server
CN109299042A (en) * 2018-11-12 2019-02-01 郑州云海信息技术有限公司 A kind of log processing method and system
CN109684290A (en) * 2018-12-20 2019-04-26 东软集团股份有限公司 Log storing method, device, equipment and computer readable storage medium
CN109840188A (en) * 2017-11-24 2019-06-04 深圳市优必选科技有限公司 A kind of acquisition methods and its terminal of log

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868340A (en) * 2016-03-28 2016-08-17 乐视控股(北京)有限公司 Log storage method and device
EP3401791A1 (en) * 2017-05-12 2018-11-14 Fujitsu Limited Log output control apparatus, log output control method, and database server
CN109840188A (en) * 2017-11-24 2019-06-04 深圳市优必选科技有限公司 A kind of acquisition methods and its terminal of log
CN109299042A (en) * 2018-11-12 2019-02-01 郑州云海信息技术有限公司 A kind of log processing method and system
CN109684290A (en) * 2018-12-20 2019-04-26 东软集团股份有限公司 Log storing method, device, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN110908967A (en) 2020-03-24

Similar Documents

Publication Publication Date Title
CN110908967B (en) Method, device, equipment and computer readable medium for storing log
CN113987074A (en) Distributed service full-link monitoring method and device, electronic equipment and storage medium
CN111291103B (en) Interface data analysis method and device, electronic equipment and storage medium
CN112684968A (en) Page display method and device, electronic equipment and computer readable medium
CN113760674A (en) Information generation method and device, electronic equipment and computer readable medium
CN117156012B (en) Exception request data processing method, device, equipment and computer readable medium
CN113721910A (en) Interface code generation method and device, electronic equipment and computer readable medium
CN110110032B (en) Method and device for updating index file
CN111787041A (en) Method and apparatus for processing data
CN113807056B (en) Document name sequence error correction method, device and equipment
CN113393288B (en) Order processing information generation method, device, equipment and computer readable medium
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
US20170093951A1 (en) Systems and methods for enhancing performance of resource state polling
CN113760695A (en) Method and device for positioning problem code
CN112084114A (en) Method and apparatus for testing an interface
CN112948341B (en) Method and apparatus for identifying anomalous network device logs
CN111930704B (en) Service alarm equipment control method, device, equipment and computer readable medium
CN116467178B (en) Database detection method, apparatus, electronic device and computer readable medium
CN116880899B (en) Task information association method, device, electronic equipment and computer readable medium
CN111338621B (en) Method, apparatus, electronic device and computer readable medium for displaying data
CN115309612B (en) Method and device for monitoring data
CN112668194B (en) Automatic driving scene library information display method, device and equipment based on page
CN109376023B (en) Method and equipment for generating calling information and issuing return code group
CN113986959A (en) Logistics information acquisition method and device, electronic equipment and computer readable medium
CN117909396A (en) API (application program interface) generation method and device, electronic equipment and computer readable medium

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
CB02 Change of applicant information

Address after: 100142 201, 2nd floor, block a, building 15, Enji West Industrial Park, No.1 liangjiadian, Fuwai, Haidian District, Beijing

Applicant after: Beijing Baidu yuntuteng Technology Co.,Ltd.

Address before: 100142 2nd floor, block a, building 15, Enji West Industrial Park, No.1 liangjiadian, Fuwai, Haidian District, Beijing

Applicant before: Beijing Yun Tu Teng Technology Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant