CN113742300A - Log management method, device, server and system - Google Patents

Log management method, device, server and system Download PDF

Info

Publication number
CN113742300A
CN113742300A CN202010801524.6A CN202010801524A CN113742300A CN 113742300 A CN113742300 A CN 113742300A CN 202010801524 A CN202010801524 A CN 202010801524A CN 113742300 A CN113742300 A CN 113742300A
Authority
CN
China
Prior art keywords
log
log management
template
information
configuration information
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.)
Granted
Application number
CN202010801524.6A
Other languages
Chinese (zh)
Other versions
CN113742300B (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 Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information 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 Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010801524.6A priority Critical patent/CN113742300B/en
Publication of CN113742300A publication Critical patent/CN113742300A/en
Application granted granted Critical
Publication of CN113742300B publication Critical patent/CN113742300B/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/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
    • 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/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a log management method, a log management device, a server side and a log management system, and relates to the technical field of computers. One embodiment of the method comprises: responding to the received log configuration information, and selecting at least one target log management template from a plurality of preset log management templates according to the log configuration information, wherein the log configuration information comprises configuration parameters; adding the configuration parameters to a target log management template, and packaging into a log management strategy; and generating a corresponding log file for the execution service of the micro service according to the log management strategy. The embodiment can effectively improve the log management efficiency of the microservice.

Description

Log management method, device, server and system
Technical Field
The invention relates to the technical field of computers, in particular to a log management method, a log management device, a log management server and a log management system.
Background
In the distributed system, various micro services such as user information service, authority service, data service and the like are directly communicated with each other through interfaces. Among them, managing the log of the micro service is one of the ways to realize managing the micro service. At present, micro service logs are mainly managed in a hard coding mode.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the existing hard coding mode needs to perform corresponding hard coding on each micro-service device, so that the log management efficiency is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a log management method, an apparatus, a server, and a system, which can effectively improve log management efficiency of a microservice.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a log management method applied to a microservice application device, including:
responding to the received log configuration information, and selecting at least one target log management template from a plurality of preset log management templates, wherein the log configuration information comprises configuration parameters;
adding the configuration parameters to the target log management template, and packaging into a log management strategy;
and generating a corresponding log file for the execution service of the micro service according to the log management strategy.
Preferably, the first and second electrodes are formed of a metal,
the log management method further comprises the following steps: each log management template is configured with a corresponding first template identifier;
the configuration parameters correspond to at least one second template identifier;
the log configuration information includes configuration parameters for selecting at least one target log management template, including:
searching a target first template identifier matched with each second template identifier;
and determining the log management template corresponding to the target first template identifier as the target log management template.
Preferably, the first and second electrodes are formed of a metal,
the log configuration information further includes: executing the logic information;
when the number of the target log management templates is plural,
the step of encapsulating into a log management policy comprises:
and according to the execution logic information, performing logic call encapsulation on the target log management templates to form a log management strategy.
Preferably, the log management method further includes:
responding to a received log printing instruction, judging whether the log management strategy comprises characteristic information corresponding to log printing, and if so, printing the log file; otherwise, printing is rejected.
Preferably, the first and second electrodes are formed of a metal,
the configuration parameters include: the level of the print log;
responding to the log management strategy comprising characteristic information corresponding to log printing, and controlling information in the log file to be printed and the amount of the log to be printed according to the level of the print log;
the printing the log file includes: and printing the information in the log file to be printed according to the log quantity to be printed.
Preferably, the log management method further comprises,
updating the log management policy in response to receiving new log configuration information.
Preferably, the log management method further comprises,
the log configuration information includes: user characteristic information;
adding the user characteristic information to the log file;
in response to receiving a query request for the log file, searching the log file matched with the user characteristic information included in the query request;
and outputting the searched log file to a user corresponding to the user characteristic information.
In a second aspect, an embodiment of the present invention provides a log management method, which is interconnected with multiple micro-service application devices, and includes:
obtaining log configuration information, wherein the log configuration information comprises: device characteristic information corresponding to the microservice application device;
and responding to a received sending instruction, and sending the log configuration information to the micro service application equipment corresponding to the equipment characteristic information.
Preferably, the first and second electrodes are formed of a metal,
the log configuration information includes: a plurality of configuration parameters, template identifications corresponding to the configuration parameters, execution logic information, and user characteristic information.
Preferably, the log management method further comprises,
storing the log configuration information;
in response to receiving an update request, searching for log configuration information matched with the feature information included in the update request;
and the updating request comprises modification information or updating information of the log configuration information, and the modification or updating of the log configuration information matched with the characteristic information in the updating request is received according to the modification information or the updating information.
In a third aspect, an embodiment of the present invention provides a micro service log management apparatus, which is applied to a micro service application device, and includes:
the system comprises a strategy construction unit, a log configuration unit and a log management unit, wherein the strategy construction unit is used for responding to the received log configuration information and selecting at least one target log management template from a plurality of preset log management templates, and the log configuration information comprises configuration parameters; adding the configuration parameters to the target log management template, and packaging into a log management strategy;
and the log generating unit is used for generating a corresponding log file for the execution service of the micro service according to the log management strategy obtained by the strategy constructing unit.
Preferably, the first and second electrodes are formed of a metal,
the log configuration information includes: at least one second template identifier corresponding to the configuration parameter;
the policy construction unit is further configured to configure a corresponding first template identifier for each log management template; searching a target first template identifier matched with each second template identifier; and determining the log management template corresponding to the target first template identifier as the target log management template.
In a fourth aspect, an embodiment of the present invention provides a microservice log management server, where the microservice log management server is interconnected with multiple microservice application devices, and includes:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring log configuration information input by a user, and the log configuration information comprises: device characteristic information corresponding to the microservice application device;
and the sending unit is used for responding to a received sending instruction and sending the log configuration information acquired by the acquiring unit to the micro-service application equipment corresponding to the equipment characteristic information.
In a fifth aspect, an embodiment of the present invention provides a micro service log management system, including: the micro-service log management server side comprises a plurality of micro-service application devices provided with the micro-service log management devices.
One embodiment of the above invention has the following advantages or benefits: constructing a corresponding log management strategy for the log configuration information by using a preset log management template; and generating a corresponding log file for the execution service of the micro service according to the log management strategy. The log configuration information can comprise configuration parameters and other information, the log configuration information comprises configuration parameters and other information which are different due to difference of execution business of the micro-services, different log configuration information can be configured according to different micro-services, different configuration parameters and other information can be configured according to different micro-services, then the log management strategy is constructed through the configuration parameters and the log management template which are included by the log configuration information, compared with manual hard coding, the time for configuring the log configuration information and constructing the log management strategy is effectively shortened, and therefore the log management efficiency of the micro-services is effectively improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a log management method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a main flow of a log management method according to another embodiment of the present invention;
FIG. 3 is a schematic diagram of a main flow of printing a log according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a main flow of a log management method according to yet another embodiment of the present invention;
FIG. 5 is a schematic diagram of a main flow of a log management method implemented by a server according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a main flow of interaction between a server and a microservice application device according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of the main elements of a microservice log management apparatus according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of the main elements of a server according to an embodiment of the invention;
FIG. 9 is a schematic diagram of the primary devices of a microservice log management system according to an embodiment of the present invention;
FIG. 10 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 11 is a schematic diagram of a computer system suitable for use in implementing a microservice application device or server of an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a diagram illustrating a log management method applied to a microservice application device according to an embodiment of the present invention. As shown in fig. 1, the log management method may include the steps of:
s101: responding to the received log configuration information, and selecting at least one target log management template from a plurality of preset log management templates according to the log configuration information, wherein the log configuration information comprises configuration parameters;
s102: adding the configuration parameters to a target log management template, and packaging into a log management strategy;
s103: and generating a corresponding log file for the execution service of the micro service according to the log management strategy.
The log configuration information can be received through an operation interface provided for a user, namely the user fills the log configuration information on the operation interface; the received log configuration information can also be a file containing the log configuration information, such as an excel table, a word, a PDF and other files in various formats; the received log configuration information may also be received from a server.
The log management policy is mainly a log management code or an electronic scheme or a log management electronic or code flow for a specific execution service in the microservice.
In addition, configuration parameters generally refer to parameters related to generating log files, such as: parameters corresponding to the performance log, parameters corresponding to the entry log and the exit log of the interface, parameters corresponding to the abnormal log and the like. The flexible configuration of the log management strategy is realized through the process, and different log management strategies can be configured according to different user requirements or different execution services. In addition, because the log management template is pre-existing, the log management strategy can be quickly obtained.
In the embodiment shown in fig. 1, a preset log management template is used to construct a corresponding log management policy for log configuration information; and generating a corresponding log file for the execution service of the micro service according to the log management strategy. The log configuration information comprises configuration parameters and other information which are different due to difference of execution services of the micro-services, namely the information comprising the configuration parameters and the like of different log configuration information can be configured according to different micro-services, and then the log management strategy is constructed through the configuration parameters and the log management template which are included by the log configuration information.
In an embodiment of the present invention, the log management method further includes: configuring a corresponding first template identifier for each log management template; at least one second template identifier corresponding to the configuration parameter (the at least one second template identifier is included in the log configuration information); accordingly, the log configuration information including the configuration parameter selection target log management template may include: searching a target first template identifier matched with each second template identifier; and determining the log management template corresponding to the target first template identifier as a target log management template.
The source of the at least one second template identifier corresponding to the configuration parameter may be two types:
configuring a first source of at least one second template identifier corresponding to the parameter: the first template identifier corresponding to each log management template can be provided for the user through the interface, and the user can select at least one first template identifier for the configuration parameters from the plurality of first template identifiers, namely, the at least one second template identifier corresponding to the configuration parameters refers to the at least one first template identifier selected by the user.
Configuring a second source of at least one second template identifier corresponding to the parameter: a corresponding log management template is configured in advance for each type of configuration parameter, for example, a log management template 1 is configured for a parameter corresponding to a performance log, a log management template 2 is configured for a parameter corresponding to an entry log of an interface, a log management template 3 is configured for a parameter corresponding to an exit log, a log management template 4 is configured for a parameter corresponding to an abnormal log, and the like. Then, when the configuration parameters include parameters corresponding to the performance log and parameters corresponding to the entry log of the interface, the first template identifier corresponding to the log management template 1 and the first template identifier corresponding to the log management template 2 are at least one second template identifier corresponding to the configuration parameters.
Therefore, the template identifier refers to feature information capable of uniquely characterizing the log management template, for example, a unique code corresponding to each log management template, and for example, unique summary information corresponding to each log management template. Accordingly, the first template identification may refer to different codes or symbols or summary information, etc. that can characterize the differences between different log management templates. The second template identifier is the first template identifier corresponding to the log management template selected or configured for the configuration parameters.
The configuration parameter may also be some parameters required for generating a log, for example, a logging parameter is enabled for an execution service, and logging is performed in a certain state, and then the state parameter may be one of the configuration parameters, a log size, a log level, and the like.
The log management template refers to a script or a program or an execution code for managing logs, and the script or the program or the code can run after being configured with configuration parameters so as to generate corresponding logs for corresponding execution services.
The plurality of log management templates and the template identifier corresponding to each log management template can be stored in a management library, and any log management template can provide scripts and the like required for generating logs.
In one embodiment of the present invention, the log configuration information includes: executing the logic information; when the number of the target log management templates is multiple, the step of encapsulating the target log management templates into the log management policy may include: and performing logic call packaging on the plurality of target log management templates according to the execution logic information to form a log management strategy. The execution logic of a plurality of templates can be realized by executing the logic information so as to meet the requirements, so that the log file can better meet different requirements.
The execution logic information is information expression used for representing an execution sequence or execution logic of a plurality of target log management templates, for example, the target log management templates are a target log management template 1, a target log management template 2, and a target log management template 3, respectively, and the execution logic information may be: a target log management template 1 → a target log management template 2 → a target log management template 3 (namely, after the execution of the target log management template 1 is completed, the target log management template 2 is executed, and after the execution of the target log management template 2 is completed, the target log management template 3 is executed); the execution logic information may also be: 1. 2 → 3 (i.e., the target log management template 1 and the target log management template 2 are executed simultaneously, and the target log management template 3 is executed after the execution of the target log management template 1 and the target log management template 2 is completed). The foregoing only shows the expression manner of the execution logic information by way of example, and other manners of expressing the execution logic information may be used, which are not described herein again.
In an embodiment of the present invention, as shown in fig. 2, the log management method may further include the following steps:
s201: responding to the received log printing instruction, judging whether the log management strategy comprises characteristic information corresponding to log printing, if so, executing S202; otherwise, executing S203;
s202: printing the log file and ending the current process;
s203: printing is denied.
The characteristic information corresponding to the journal printing may be a characteristic symbol or a characteristic identifier characterizing the journal printing.
Through the process, only the log file with the characteristic information corresponding to the printing can be printed, and the safety of the log file is ensured.
In one embodiment of the invention, the configuration parameters include: the level of the print log; accordingly, as shown in fig. 3, the step of printing the log may include:
s301: responding to the log management strategy comprising characteristic information corresponding to log printing, and controlling information in a log file to be printed and the amount of the log to be printed according to the level of the log to be printed;
s302: and printing the information in the log file to be printed according to the log quantity to be printed.
Such as: the levels of the print logs can include three levels from low to high, namely ERROR, warning and INFO, wherein the amount of the logs to be printed corresponding to the low-level ERROR is high, the amount of the logs to be printed corresponding to the high-level INFO is low, the amount of the logs to be printed corresponding to the medium-level warning is between the low-level ERROR and the high-level INFO, and the amount of the logs to be printed of each level can be set by a user.
In an embodiment of the present invention, the log management method may further include: in response to receiving the new log configuration information, the log management policy is updated. Through the process, the log management strategy can be modified, so that the user requirements can be better met, and the flexible configuration of the log management strategy is further realized.
In one embodiment of the present invention, the log configuration information includes: user characteristic information; accordingly, as shown in fig. 4, the log management method may further include:
s401: adding the user characteristic information into a log file;
s402: in response to receiving a query request for log files, searching the log files matched with the user characteristic information included in the query request;
s403: and outputting the searched log file to a user corresponding to the user characteristic information.
The user characteristic information can be a user name, a user code and the like so as to ensure that the log file is only provided for users with authority, thereby ensuring the safety of the log file.
As shown in fig. 5, an embodiment of the present invention provides a log management method, applied to a server, and interconnected with multiple micro-service application devices, where the log management method includes the following steps:
s501: obtaining log configuration information, wherein the log configuration information comprises: device characteristic information corresponding to the microservice application device;
the log configuration information may be input by a user through an interactive interface, or may be a file containing the log configuration information and the like sent by a receiving client.
S502: and responding to the received sending instruction, and sending the log configuration information to the micro service application equipment corresponding to the equipment characteristic information.
In one embodiment of the present invention, the log configuration information includes: configuration parameters, template identifications corresponding to the configuration parameters, execution logic information and user characteristic information.
In an embodiment of the present invention, the log management method may further include: storing log configuration information; in response to receiving the update request, searching for log configuration information matched with the update request including the feature information; and receiving the modification or update of the log configuration information matched with the characteristic information included in the update request according to the modification information or the update information.
The update request including the feature information may mean that the feature identifier corresponding to the log configuration information and the log configuration information include the feature identifier or the feature symbol or the feature number corresponding to the log parameter, where the feature identifier corresponding to the log configuration information may be used to distinguish different log configuration information or log configuration information configured by different users. For example, the feature identifier corresponding to each log configuration information is C1, C2, C3, etc., the feature identifier corresponding to the parameter "log size" is SI, and the feature identifier corresponding to the parameter "log level" is LE. And if the updating request comprises modification information or updating information corresponding to the characteristic information C3 and SI, updating the SI (record log size) in the log configuration information C3 after modification according to the modification information or updating information corresponding to the SI.
In an embodiment of the present invention, as shown in fig. 6, taking an interaction between a server and a micro-service application device as an example, a log management method is further described, where the log management method may include the following steps:
s601: the server side obtains log configuration information and stores the log configuration information, wherein the log configuration information comprises: device characteristic information corresponding to the microservice application device;
the acquired log configuration information can provide an input interface for a user by a server, the user can input the log configuration information through the input interface, and can also send an excel table, a word file or a pdf file for the user, and in the files, the log configuration information is listed in a specific format, wherein in the log configuration information, besides device characteristic information corresponding to micro service application devices, such as the number of the micro service application devices, the log configuration information also includes an execution service characteristic identifier, configuration parameters, template identifiers corresponding to the configuration parameters, execution logic information, the level of a print log, user characteristic information and the like.
The log configuration information may be log configuration information for an in-out parameter log, an exception log, a performance log, and the like.
S602: the server side responds to the received sending instruction and sends the log configuration information to the micro service application equipment corresponding to the equipment characteristic information;
s603: the method comprises the steps that micro-service application equipment provided with a micro-service log management device selects a target log management template for configuration parameters in log configuration information;
the microservice log management device is provided with a plurality of log management templates, such as a plurality of log management templates corresponding to the input and output participation logs, a plurality of log management templates corresponding to the abnormal logs and a plurality of log management templates corresponding to the performance logs.
S604: the micro-service application equipment provided with the micro-service log management device adds the configuration parameters to a target log management template;
for example, if the configuration parameters are parameters for B types of exceptions corresponding to the performance a, the parameters corresponding to the performance a are configured in the log management template a corresponding to the performance log, and the parameters for B types of exceptions are configured in the log management template B corresponding to the exception log.
S605: the micro-service application equipment provided with the micro-service log management device carries out logic calling and packaging on a plurality of target log management templates according to the execution logic information included in the log configuration information so as to form a log management strategy;
for example, if the execution logic information is that the log management template b in which the parameters are arranged is executed in the log management template a in which the parameters are arranged, the log management template a in which the parameters are arranged and the log management template b in which the parameters are arranged are executed according to the execution logic information.
S606: the method comprises the following steps that micro-service application equipment provided with a micro-service log management device generates a corresponding log file for an execution service of the micro-service according to a log management strategy, and adds user characteristic information included in log configuration information into the log file;
the user characteristic information may be a user name, a user characteristic code, etc.
S607: when the micro-service application equipment provided with the micro-service log management device responds to a received query request for the log file, searching the log file matched with the user characteristic information included in the query request;
s608: the micro-service application equipment provided with the micro-service log management device outputs the searched log file to a user corresponding to the user characteristic information;
s609: the micro-service application equipment provided with the micro-service log management device responds to the received log printing instruction, judges whether the log management strategy comprises the characteristic information corresponding to the log printing, and if so, executes S610; otherwise, executing S612;
s610: the micro-service application equipment provided with the micro-service log management device controls the information in the log file to be printed and the amount of the log to be printed according to the level of the print log configured by the log configuration information;
such as: the levels of the print logs can include three levels from low to high, namely ERROR, warning and INFO, wherein the amount of the logs to be printed corresponding to the low-level ERROR is high, the amount of the logs to be printed corresponding to the high-level INFO is low, the amount of the logs to be printed corresponding to the medium-level warning is between the low-level ERROR and the high-level INFO, and the amount of the logs to be printed of each level can be set by a user.
S611: printing information in a log file to be printed according to the log quantity to be printed;
s612: refusing to print;
s613: the server side searches log configuration information matched with the characteristic information included in the updating request in response to receiving the updating request;
modification information or update information of the received log configuration information.
S614: the server receives modification or update of the log configuration information matched with the characteristic information included in the update request according to the modification information or the update information;
s615: the server side sends the updated log configuration information to the micro-service application equipment provided with the micro-service log management device;
s616: and updating the log management strategy by the microservice application equipment provided with the microservice log management device.
Wherein, the execution sequence of S607-S608 and S609-S612 is not necessary, that is; S613-S616 may be performed after or before any one step between S607 and S612.
As shown in fig. 7, an embodiment of the present invention provides a microservice log management apparatus 700, which is applied to microservice application devices, where the microservice log management apparatus 700 includes:
a policy constructing unit 701, configured to, in response to receiving log configuration information, select at least one target log management template for configuration parameters included in the log configuration information from a plurality of preset log management templates; adding the configuration parameters to the target log management template, and packaging into a log management strategy;
the log generating unit 702 is configured to generate a corresponding log file for executing the service according to the log management policy obtained by the policy constructing unit 701.
In one embodiment of the present invention, the log configuration information further includes: configuring at least one second template identifier corresponding to the parameter;
a policy constructing unit 701, configured to configure a corresponding first template identifier for each log management template; searching a target first template identifier matched with each second template identifier; and determining the log management template corresponding to the target first template identifier as a target log management template.
In an embodiment of the present invention, the log configuration information further includes: executing the logic information;
a policy constructing unit 701, configured to, when the number of the target log management templates is multiple, perform logic call encapsulation on the multiple target log management templates according to the execution logic information, so as to form a log management policy.
In an embodiment of the present invention, the microservice log management apparatus as shown in fig. 7 further includes: a log printing unit 703;
a log printing unit 703, configured to determine, in response to receiving a log printing instruction, whether the log management policy constructed by the policy construction unit 701 includes feature information corresponding to log printing, and if so, print the log file generated by the log generation unit 702; otherwise, printing is rejected.
In one embodiment of the invention, the configuration parameters include: the level of the print log; the log printing unit 703 is configured to control information in a log file to be printed and a log amount to be printed according to a level of a print log in response to that the log management policy includes feature information corresponding to log printing; the step of printing the log file includes: and printing the information in the log file to be printed according to the log quantity to be printed.
In an embodiment of the present invention, the policy building unit 701 is configured to update the log management policy in response to receiving new log configuration information.
In one embodiment of the present invention, the log configuration information further includes: user characteristic information; as shown in fig. 7, the microservice log management apparatus 700 further includes:
a log query unit 704, which adds the user feature information to a log file; in response to receiving a query request for log files, searching the log files matched with the user characteristic information included in the query request; and outputting the searched log file to a user corresponding to the user characteristic information.
As shown in fig. 8, an embodiment of the present invention provides a micro service log management server 800, which is interconnected with a plurality of micro service application devices, where the micro service log management server 800 includes:
an obtaining unit 801, configured to obtain log configuration information input by a user, where the log configuration information includes: device characteristic information corresponding to the microservice application device;
the sending unit 802 is configured to send, in response to receiving the sending instruction, the log configuration information obtained by the obtaining unit 801 to the micro service application device corresponding to the device feature information.
In one embodiment of the present invention, the log configuration information further includes: configuration parameters, template identifications corresponding to the configuration parameters, execution logic information and user characteristic information.
In an embodiment of the present invention, as shown in fig. 8, the microservice log management server 800 further includes: a storage unit 803, and an update unit 804, wherein,
a storage unit 803 configured to store the log configuration information acquired by the acquisition unit 801;
an updating unit 804, configured to, in response to receiving the update request, search the log configuration information stored in the storage unit 803 and matched with the update request including the feature information; and receiving modification or update of the log configuration information of which the update request comprises the characteristic information matching according to the modification information or the update information of the log configuration information of which the update request comprises.
As shown in fig. 9, an embodiment of the present invention provides a microservice log management system 900, including: a plurality of micro service application devices 901 installed with the micro service log management apparatus 700 provided by the above embodiment and the micro service log management server 800 provided by the above embodiment.
Fig. 10 shows an exemplary system architecture 1000 to which the log management method or the micro service log management apparatus or the micro service log management server according to an embodiment of the present invention may be applied.
As shown in fig. 10, the system architecture 1000 may include microservice application devices 1001, 1002, 1003, a network 1004, and a server 1005. Network 1004 is the medium used to provide communication links between microservice application devices 1001, 1002, 1003 and server 1005. Network 1004 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few. Among them, the microservice application 1001, 1002, and 1003 have a microservice log management apparatus installed.
The microservice application devices 1001, 1002, 1003 interact with a server 1005 over a network 1004 to receive or transmit log configuration messages and the like. Various micro-service applications such as user information services, rights services, data services, etc. (by way of example only) may be installed on the micro-service application devices 1001, 1002, 1003.
The microservice log management apparatus installed in the microservice application 1001, 1002, 1003 can analyze and process the received data such as log management information, and manage the log of the execution task of the microservice in the microservice application 1001, 1002, 1003 according to the processing result (for example, a log management policy, which is only an example).
The server 1005 may be a server providing a micro-service log management service, such as a background management server (for example only) providing log configuration information management for micro-services possessed by the micro-service application devices 1001, 1002, 1003. The background management server can analyze and process the received data such as the log management information.
It should be noted that the log management method provided by the embodiment of the present invention is generally completed by the micro-service log management apparatus installed in the micro-service application devices 1001, 1002, and 1003 and the server 1005 in an interactive manner.
It should be understood that the number of microserver applications, networks, and servers in fig. 10 are illustrative only. There may be any number of microservice applications, networks, and servers, as desired for implementation.
Referring now to FIG. 11, there is illustrated a schematic block diagram of a computer system 1100 suitable for use in implementing a microservice application device or server of an embodiment of the present invention. The microservice application device or server shown in fig. 11 is only an example and should not impose any limitations on the functionality and scope of use of embodiments of the present invention.
As shown in fig. 11, the computer system 1100 includes a Central Processing Unit (CPU)1101, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. In the RAM 1103, various programs and data necessary for the operation of the system 1100 are also stored. The CPU 1101, ROM 1102, and RAM 1103 are connected to each other by a bus 1104. An input/output (I/O) interface 1105 is also connected to bus 1104.
The following components are connected to the I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output portion 1107 including a signal output unit such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a network interface card such as a LAN card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, 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 such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the removable medium 1111. The above-described functions defined in the system of the present invention are executed when the computer program is executed by a Central Processing Unit (CPU) 1101.
It should be noted that the computer readable medium shown in the present invention can 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 the present invention, 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 the present invention, 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: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 invention. 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 or flowchart illustration, and combinations of blocks in the block diagrams 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 the embodiments of the present invention 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 policy construction unit and a log generation unit. The names of these units do not in some cases form a limitation on the unit itself, and for example, the log generation unit may also be described as a "unit that generates a corresponding log file for executing a service".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: in response to receiving the log configuration information, selecting at least one target log management template for configuration parameters included in the log configuration information from a plurality of preset log management templates; adding the configuration parameters to a target log management template, and packaging into a log management strategy; and generating a corresponding log file for the execution service of the micro service according to the log management strategy.
The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: configuring a corresponding first template identifier for each log management template; the log configuration information further includes: configuring at least one second template identifier corresponding to the parameter; selecting a target log management template for configuration parameters included in the log configuration information, including: searching a target first template identifier matched with each second template identifier; and determining the log management template corresponding to the target first template identifier as a target log management template.
The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: the log configuration information further includes: executing the logic information; the number of the target log management templates is multiple, and the step of packaging the target log management templates into the log management strategy comprises the following steps: and performing logic call packaging on the plurality of target log management templates according to the execution logic information to form a log management strategy.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: obtaining log configuration information, wherein the log configuration information comprises: device characteristic information corresponding to the microservice application device; and responding to the received sending instruction, and sending the log configuration information to the micro service application equipment corresponding to the equipment characteristic information.
According to the technical scheme of the embodiment of the invention, a preset log management template is utilized to construct a corresponding log management strategy for log configuration information; and generating a corresponding log file for the execution service of the micro service according to the log management strategy. The log configuration information can be different due to the difference of the execution business of the micro-service, different log configuration information can be configured according to different micro-services, then the log management strategy is constructed through the log configuration information and the log management template, compared with manual hard coding, the time for configuring the log configuration information and constructing the log management strategy is effectively shortened, and therefore the log management efficiency of the micro-service is effectively improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (16)

1. A log management method is applied to microservice application equipment and comprises the following steps:
responding to the received log configuration information, and selecting at least one target log management template from a plurality of preset log management templates, wherein the log configuration information comprises configuration parameters;
adding the configuration parameters to the target log management template, and packaging into a log management strategy;
and generating a corresponding log file for the execution service of the micro service according to the log management strategy.
2. The log management method of claim 1, further comprising,
each log management template is configured with a corresponding first template identifier;
the configuration parameters correspond to at least one second template identifier;
the log configuration information comprises configuration parameters for selecting at least one target log management template, and comprises the following steps:
searching a target first template identifier matched with each second template identifier;
and determining the log management template corresponding to the target first template identifier as the target log management template.
3. The log management method of claim 1,
the log configuration information includes: executing the logic information;
the number of the target log management templates is multiple,
the step of encapsulating into a log management policy comprises:
and according to the execution logic information, performing logic call encapsulation on the target log management templates to form a log management strategy.
4. A log management method according to claim 1 or 3, comprising:
responding to a received log printing instruction, judging whether the log management strategy comprises characteristic information corresponding to log printing, and if so, printing the log file; otherwise, printing is rejected.
5. The log management method of claim 4,
the configuration parameters include: the level of the print log;
responding to the log management strategy comprising characteristic information corresponding to log printing, and controlling information in the log file to be printed and the amount of the log to be printed according to the level of the print log;
the printing the log file includes: and printing the information in the log file to be printed according to the log quantity to be printed.
6. The log management method according to any one of claims 1, 3 and 5, further comprising,
updating the log management policy in response to receiving new log configuration information.
7. The log management method of claim 4, further comprising,
the log configuration information includes: user characteristic information;
adding the user characteristic information to the log file;
in response to receiving a query request for the log file, searching the log file matched with the user characteristic information included in the query request;
and outputting the searched log file to a user corresponding to the user characteristic information.
8. A log management method, in communication with a plurality of microservice application devices, comprising:
obtaining log configuration information, wherein the log configuration information comprises: device characteristic information corresponding to the microservice application device;
and responding to a received sending instruction, and sending the log configuration information to the micro service application equipment corresponding to the equipment characteristic information.
9. The log management method of claim 8,
the log configuration information includes: a plurality of configuration parameters, template identifications corresponding to the configuration parameters, execution logic information, and user characteristic information.
10. The log management method of claim 8, further comprising,
storing the log configuration information;
in response to receiving an update request, searching for log configuration information matched with the update request including characteristic information;
and the updating request comprises modification information or updating information of the log configuration information, and the modification or updating of the log configuration information matched with the characteristic information in the updating request is received according to the modification information or the updating information.
11. The micro-service log management device is applied to micro-service application equipment and comprises the following components:
the system comprises a strategy construction unit, a log configuration unit and a log management unit, wherein the strategy construction unit is used for responding to received log configuration information and selecting at least one target log management template from a plurality of preset log management templates; adding the configuration parameters to the target log management template, and packaging into a log management strategy;
and the log generating unit is used for generating a corresponding log file for the execution service of the micro service according to the log management strategy obtained by the strategy constructing unit.
12. The microservice log management device of claim 11, wherein,
the log configuration information includes: at least one second template identifier corresponding to the configuration parameter;
the policy construction unit is further configured to configure a corresponding first template identifier for each log management template; searching a target first template identifier matched with each second template identifier; and determining the log management template corresponding to the target first template identifier as the target log management template.
13. A micro-service log management server side is characterized by being communicated with a plurality of micro-service application devices, and comprising:
an obtaining unit, configured to obtain log configuration information, where the log configuration information includes: device characteristic information corresponding to the microservice application device;
and the sending unit is used for responding to a received sending instruction and sending the log configuration information acquired by the acquiring unit to the micro-service application equipment corresponding to the equipment characteristic information.
14. A microservice log management system, comprising: the micro-service log management server side of the right 13 and a plurality of micro-service application devices provided with the micro-service log management device of the right 11 or the right 12.
15. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-10.
16. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-10.
CN202010801524.6A 2020-08-11 2020-08-11 Log management method, device, server side and system Active CN113742300B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010801524.6A CN113742300B (en) 2020-08-11 2020-08-11 Log management method, device, server side and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010801524.6A CN113742300B (en) 2020-08-11 2020-08-11 Log management method, device, server side and system

Publications (2)

Publication Number Publication Date
CN113742300A true CN113742300A (en) 2021-12-03
CN113742300B CN113742300B (en) 2024-06-18

Family

ID=78728016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010801524.6A Active CN113742300B (en) 2020-08-11 2020-08-11 Log management method, device, server side and system

Country Status (1)

Country Link
CN (1) CN113742300B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055304A (en) * 2022-12-15 2023-05-02 南方电网数字平台科技(广东)有限公司 Micro service log level configuration method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8554741B1 (en) * 2010-06-16 2013-10-08 Western Digital Technologies, Inc. Timeline application for log structured storage devices
CN105893016A (en) * 2015-12-11 2016-08-24 乐视网信息技术(北京)股份有限公司 Log recording system and method based on MVC (Model View Controller) framework
CN107491382A (en) * 2017-07-21 2017-12-19 北京京东尚科信息技术有限公司 Log-output method and device
WO2018201978A1 (en) * 2017-05-04 2018-11-08 平安科技(深圳)有限公司 Interface call data processing method, apparatus, computer device and storage medium
CN111143286A (en) * 2019-12-13 2020-05-12 无锡华云数据技术服务有限公司 Cloud platform log management method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8554741B1 (en) * 2010-06-16 2013-10-08 Western Digital Technologies, Inc. Timeline application for log structured storage devices
CN105893016A (en) * 2015-12-11 2016-08-24 乐视网信息技术(北京)股份有限公司 Log recording system and method based on MVC (Model View Controller) framework
WO2018201978A1 (en) * 2017-05-04 2018-11-08 平安科技(深圳)有限公司 Interface call data processing method, apparatus, computer device and storage medium
CN107491382A (en) * 2017-07-21 2017-12-19 北京京东尚科信息技术有限公司 Log-output method and device
CN111143286A (en) * 2019-12-13 2020-05-12 无锡华云数据技术服务有限公司 Cloud platform log management method and system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
MANMOHAN SINGH; NAVDEEP KAUR: "Log management based on three dimensional spatial database and log management techniques", IEEE, 24 May 2012 (2012-05-24) *
王立, 李增智, 闫焱, 屈科文: "主动节点和策略机制下的业务管理模型与实现", 西安交通大学学报, no. 06, 10 June 2004 (2004-06-10) *
金鑫;朱默宁;: "一种流量动态可控的异步日志系统设计", 合肥工业大学学报(自然科学版), no. 11, 28 November 2016 (2016-11-28) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055304A (en) * 2022-12-15 2023-05-02 南方电网数字平台科技(广东)有限公司 Micro service log level configuration method and device

Also Published As

Publication number Publication date
CN113742300B (en) 2024-06-18

Similar Documents

Publication Publication Date Title
CN109710236B (en) Service development and implementation method, device, platform and medium based on shared service
CN110377440B (en) Information processing method and device
CN111460129A (en) Method and device for generating identification, electronic equipment and storage medium
CN109284198A (en) A kind of method and apparatus verifying data
CN113760697B (en) Interface testing method, device, electronic equipment and storage medium
CN111522617B (en) Method and device for maintaining system and electronic equipment
CN114648012A (en) Bill processing method and device, electronic equipment and computer readable medium
CN113742300B (en) Log management method, device, server side and system
CN115442129A (en) Method, device and system for managing cluster access authority
CN113283891A (en) Information processing method and device and electronic equipment
CN113312900A (en) Data verification method and device
CN111949472A (en) Method and device for recording application logs
CN115309612B (en) Method and device for monitoring data
CN115827392B (en) Monitoring method, device and system of distributed system
CN118426933A (en) Method, device, electronic equipment and storage medium for processing business data
CN113986661A (en) Log output method and device, electronic equipment and storage medium
CN117111898A (en) Construction method and device of business model
CN118626305A (en) Data verification method and device
CN117932641A (en) Data processing method, device, electronic equipment and storage medium
CN115910251A (en) Method and device for processing medical data
CN118626290A (en) Service calling method and device
CN118331970A (en) Icon data processing method and device, electronic equipment and storage medium
CN116627674A (en) Message queue processing method and device, electronic equipment and storage medium
CN113778350A (en) Log printing method and device
CN116112987A (en) Service level agreement SLA index decomposition method, device, system, equipment and 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
GR01 Patent grant
GR01 Patent grant