Log processing method, log processing device, computer device, and storage medium

By filtering target environments and microservices during software development, obtaining and labeling log source information, and downloading log files using a file download mode, the problem of complex log file operations is solved, and software development efficiency is improved.

CN114880202BActive Publication Date: 2026-05-19CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA PING AN LIFE INSURANCE CO LTD
Filing Date
2022-05-26
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In the software development process, viewing log files in the test and production environments is complex and makes it difficult to quickly determine which instance is accessing the log files, thus impacting software development efficiency.

Method used

By obtaining query requests, the target environment and target microservice are filtered, the initial log file of the log instance is obtained, and the target log file is labeled according to the log source information, and then downloaded in combination with the file download mode.

Benefits of technology

The process of downloading log files has been simplified, improving software development efficiency. By clearly identifying the source of log files and providing various download methods, unnecessary time consumption has been reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114880202B_ABST
    Figure CN114880202B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a log processing method, a log processing device, equipment and a storage medium, and belongs to the technical field of artificial intelligence. The method comprises the following steps: obtaining a query request; screening a target environment from candidate service environments according to the query request; screening a target microservice from candidate microservices according to the target environment; wherein the target microservice is stored in a configuration file, and the configuration file also stores a log instance used for calling the target microservice; obtaining an initial log file of the log instance according to the target microservice; obtaining log source information of the initial log file; marking the log source information on the initial log file to obtain a target log file; obtaining a file download mode according to the log instance; and downloading the target log file according to the file download mode. The embodiment of the application can know which instance is called, enrich the file download mode, make the log file download simple, and thus improve the software development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a log processing method, log processing device, computer equipment, and storage medium. Background Technology

[0002] To improve software stability, it's necessary to view logs from both the test and production environments during software development. In current technologies, viewing these logs requires selecting a microservice on the system. If multiple instances of a microservice exist, each instance must be navigated to individually, its corresponding log file opened, and then the log file downloaded from the browser. This method of viewing logs is cumbersome because it doesn't reveal which instance accessed the log file, necessitating a return to the instance selection page to search for other instances, thus impacting software development efficiency. Summary of the Invention

[0003] The main objective of this application is to provide a log processing method, log processing apparatus, computer device, and storage medium, which aim to improve the efficiency of downloading log files.

[0004] To achieve the above objectives, a first aspect of this application provides a log processing method, the method comprising:

[0005] Get the query request;

[0006] Based on the query request, the target environment is selected from the candidate service environment;

[0007] The target microservice is selected from the candidate microservices based on the target environment; wherein the target microservice is stored in a configuration file, and the configuration file also stores log instances used to call the target microservice;

[0008] Obtain the initial log file of the log instance according to the target microservice;

[0009] Obtain the log source information of the initial log file;

[0010] The log source information is annotated onto the initial log file to obtain the target log file;

[0011] Obtain the file download mode based on the log instance;

[0012] Download the target log file according to the file download mode.

[0013] In some embodiments, the log source information includes the IP address information of the log instance, and the step of annotating the log source information onto the initial log file to obtain the target log file includes:

[0014] Obtain the number of characters in the IP address information to get the starting length;

[0015] Obtain the starting position; wherein, the beginning of the initial log file is taken as the starting position;

[0016] The annotation position is determined based on the starting position and the starting length;

[0017] The IP address information is annotated at the designated annotation location to obtain the target log file.

[0018] In some embodiments, the target log file includes an update time and updated content updated at the update time, and downloading the target log file according to the file download mode includes:

[0019] A storage folder is created according to the file download mode; wherein, the file download mode includes any one of the following: merge download mode, independent download mode, and append download mode;

[0020] The target log files are downloaded to the storage folder according to the file download mode; wherein, in the merged download mode, all target log files are merged and downloaded to the storage folder; in the independent download mode, any two target log files downloaded to the storage folder are isolated from each other; in the appended download mode, each update content is downloaded to one of the storage folders according to each update time, and any two target log files are isolated from each other.

[0021] In some embodiments, the file download mode is the merged download mode, and downloading the target log file to the storage folder according to the file download mode includes:

[0022] Obtain the log time of each target log file; wherein the log time is the last update time of each target log file;

[0023] The target log files are downloaded to the storage folder according to the chronological order of the log timestamps.

[0024] In some embodiments, the file download mode is the independent download mode, and the storage folder corresponding to the log source information is created; the step of downloading the target log file to the storage folder according to the file download mode includes:

[0025] Download the target log file to the storage folder based on the log source information.

[0026] In some embodiments, the file download mode is the append download mode, and downloading the target log file to the storage folder according to the file download mode includes:

[0027] Retrieve the original log files from the storage folder;

[0028] The target log file and the original log file are compared to obtain the updated content;

[0029] The updated content is written to the original log file in the storage folder.

[0030] In some embodiments, after downloading the target log file to the storage folder according to the file download mode, the method further includes:

[0031] Updating the target log file specifically includes:

[0032] The update information of the target log file is obtained according to a preset period;

[0033] Output an update prompt based on the updated information;

[0034] Receive update requests from the user based on the update prompts;

[0035] The target log file on the user terminal is updated according to the update request to obtain an update log file, and the update log file is displayed to the user terminal.

[0036] To achieve the above objectives, a second aspect of this application provides a log processing apparatus, the apparatus comprising:

[0037] The request retrieval module is used to retrieve query requests.

[0038] The environment filtering module is used to filter the target environment from the candidate service environment according to the query request;

[0039] The service filtering module is used to filter target microservices from candidate microservices based on the target environment; wherein, the target microservices are stored in a configuration file, and the configuration file also stores log instances used to call the target microservices;

[0040] The file acquisition module is used to obtain the initial log file of the log instance based on the target microservice;

[0041] The information acquisition module is used to acquire the log source information of the initial log file;

[0042] The annotation module is used to annotate the log source information onto the initial log file to obtain the target log file;

[0043] The pattern acquisition module is used to obtain the file download pattern based on the log instance;

[0044] The download module is used to download the target log file according to the file download mode.

[0045] To achieve the above objectives, a third aspect of this application provides a computer device, comprising:

[0046] At least one memory;

[0047] At least one processor;

[0048] At least one program;

[0049] The program is stored in the memory, and the processor executes the at least one program to achieve the following:

[0050] As described in the first aspect.

[0051] To achieve the above objectives, a fourth aspect of the present application provides a storage medium, which is a computer-readable storage medium for computer-readable storage, wherein the storage medium stores one or more programs that can be executed by one or more processors to implement the method described in the first aspect.

[0052] The log processing method, apparatus, device, and storage medium proposed in this application obtain the target log file by annotating the initial log file with log source information. This clearly indicates the source of the log file, i.e., which log instance invoked the target log file. When the target log file needs to be downloaded, it is downloaded according to a file download mode. The file download modes are set to enrich the download methods for the target log file, making the download process simpler and thus improving software development efficiency. Attached Figure Description

[0053] Figure 1 This is a flowchart of the log processing method provided in the embodiments of this application;

[0054] Figure 2 yes Figure 1 The flowchart of step S106 in the process;

[0055] Figure 3 yes Figure 1 The flowchart of step S108 in the process;

[0056] Figure 4 yes Figure 3 The flowchart of step S302 in the document;

[0057] Figure 5 yes Figure 3 The flowchart of step S302 in the document;

[0058] Figure 6 yes Figure 3 The flowchart of step S302 in the document;

[0059] Figure 7 This is a flowchart of a log processing method provided in another embodiment of this application;

[0060] Figure 8 This is a schematic diagram of the log processing device provided in the embodiments of this application;

[0061] Figure 9 This is a schematic diagram of the hardware structure of the computer device provided in the embodiments of this application. Detailed Implementation

[0062] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0063] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0064] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0065] First, let's analyze some of the terms used in this application:

[0066] Artificial intelligence (AI) is a new branch of computer science that studies, develops, and applies theories, methods, technologies, and systems to simulate, extend, and expand human intelligence. It aims to understand the essence of intelligence and produce intelligent machines that can react in a way similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thought. Furthermore, AI utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to achieve optimal results.

[0067] Natural Language Processing (NLP): NLP uses computers to process, understand, and utilize human language (such as Chinese and English). NLP is a branch of artificial intelligence and an interdisciplinary field of computer science and linguistics, often referred to as computational linguistics. NLP includes syntactic analysis, semantic analysis, and discourse understanding. It is commonly used in machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, intent recognition, information extraction and filtering, text classification and clustering, sentiment analysis, and opinion mining. It involves data mining, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computation.

[0068] Microservices: Microservices are an architectural and organizational approach to developing software where the software consists of small, independent services that communicate through well-defined APIs. Microservice architecture makes applications easier to scale and faster to develop. If one process of an application experiences a surge in demand, the entire architecture must be scaled. As the codebase grows, adding or improving functionality in a monolithic application becomes increasingly complex. Using a microservice architecture, applications are built as independent components, with each application process running as a service.

[0069] Sublime Text: Sublime Text is a text editor and also an advanced code editor. It boasts a beautiful user interface and powerful features such as code thumbnails, Python plugins, code snippets, and more. Key bindings, menus, and toolbars are also customizable. Key features of Sublime Text include: spell check, bookmarks, a complete Python API, Goto functionality, instant project switching, multi-selection, multi-window support, and more. Sublime Text is a cross-platform editor, supporting Windows, Linux, Mac OS X, and other operating systems.

[0070] STG environment: Test generally refers to the version submitted by developers, where there is some simulated data to ensure functional testing. STG environment is the follow-up to test, and can be understood as a pre-production environment, where real data is imported and then tested.

[0071] Test environment: Generally, a production environment configuration is cloned. If a program does not work properly in the test environment, then it certainly cannot be released to the production machine.

[0072] Production environment: This refers to the environment officially provided to external users. Error reporting is typically disabled, while error logging is enabled. The production environment is also a type of online environment used for deployment to external users; it is an environment officially provided to customers.

[0073] In software development, viewing logs in both test and production environments relies on dedicated automated application deployment platforms. When viewing logs of a specific program being called, the user must first select the corresponding system, then the microservice application within that system. If the microservice application exists on multiple instances, and these instances call the microservice, viewing the log file requires selecting the instance first, then opening the corresponding log file, and finally browsing a portion of the logs through a web browser. The log file itself also needs to be downloaded within the web browser interface. Because users often cannot determine which instance called the microservice application, they must return to the instance selection page, search for other instances, and then reopen the instance's interface to download the log file again. Therefore, the log file download operation is complex, resulting in unnecessary time consumption for development and testing, and impacting software development efficiency.

[0074] Based on this, embodiments of this application provide a log processing method, log processing apparatus, computer device, and storage medium. The method involves selecting a target microservice from candidate microservices based on the target environment, obtaining the initial log file of the log instance based on the target microservice, marking the log source information of the initial log file on the initial log file to obtain the target log file, and then downloading the target log file according to the file download mode.

[0075] The log processing method, log processing apparatus, computer equipment, and storage medium provided in this application are specifically described through the following embodiments. First, the log processing method in this application is described.

[0076] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0077] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0078] The log processing method provided in this application relates to the field of artificial intelligence technology. The log processing method provided in this application can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the log processing method, but is not limited to the above forms.

[0079] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer computer devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0080] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards of the relevant countries and regions. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirects to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data for the proper functioning of the embodiments of this application obtained.

[0081] Figure 1 This is an optional flowchart of the log processing method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S108.

[0082] Step S101: Obtain the query request;

[0083] Step S102: Filter the target environment from the candidate service environment according to the query request;

[0084] Step S103: Select the target microservice from the candidate microservices according to the target environment; wherein, the target microservice is stored in the configuration file, and the configuration file also stores log instances used to call the target microservice;

[0085] Step S104: Obtain the initial log file of the log instance based on the target microservice;

[0086] Step S105: Obtain the log source information of the initial log file;

[0087] Step S106: Mark the log source information on the initial log file to obtain the target log file;

[0088] Step S107: Obtain the file download mode based on the log instance;

[0089] Step S108: Download the target log file according to the file download mode.

[0090] Steps S101 to S108, as illustrated in this embodiment, involve filtering the target environment from candidate service environments based on a query request, and then filtering the target microservice from candidate microservices based on the target environment. The configuration file stores log instances that call the target microservice; therefore, the initial log file corresponding to the log instance can be determined based on the target microservice, eliminating the need to open each instance individually and select the corresponding initial log file, thus simplifying the acquisition of the initial log file. Simultaneously, the log source information of the initial log file is obtained and annotated on the initial log file to obtain the target log file. Therefore, the source of the log file is clearly understood through the target log file, i.e., it is clear which log instance called the target log file. When the target log file needs to be downloaded, it is downloaded according to the file download mode, enriching the download methods for the target log file and making the download process simpler, thereby improving software development efficiency.

[0091] In step S101 of some embodiments, the obtained query request is formed based on the query information entered by the user on the log query system interface, or based on the environment selected by the user in the environment option box of the log query system interface.

[0092] In step S102 of some embodiments, there are multiple candidate service environments, so as to filter the target environment from the candidate service environments according to the query request. For example, if a user needs to download a log file, an environment option box is first displayed, which prompts for stg1 environment, stg2 environment, and stg3 environment. The user selects stg2 environment to form a query request. Therefore, stg2 environment is filtered as the target environment from multiple candidate service environments according to the query request.

[0093] In step S103 of some embodiments, the candidate service environment corresponds to the corresponding candidate microservice. Therefore, determining the target environment also determines the target microservice among the candidate microservices, thus filtering out the target microservice from the candidate microservices. The target microservice is stored in a configuration file, which also stores log instances that call the target microservice. Since the target microservice will be called by multiple log instances, the log instances that call the target microservice are determined through the configuration file. The same microservice program may be deployed in multiple service environments, and each service environment will produce logs. Therefore, determining the target environment allows the determination of the target microservice. During software development, it is necessary to view the corresponding log files based on different service environments to understand the current development status of the software. Therefore, the log instance corresponding to the target microservice can be determined based on the configuration file, so the corresponding log instance can be viewed without viewing other log instances, simplifying the determination of the log instance. For example, if the determined target environment is a test environment, the log instance that calls the target microservice during testing is obtained based on the target microservice corresponding to the test environment, without having to search for each microservice individually and then enter the corresponding log instance for each, simplifying the acquisition of the log instance corresponding to the target microservice.

[0094] In step S104 of some embodiments, the log instance corresponding to the target microservice can be determined according to the configuration file, and the initial log file of the log instance can be obtained. A target microservice may be called by multiple log instances, and each log instance corresponds to one initial log file. If the target microservice is called by multiple log instances, multiple initial log files from multiple log instances are obtained, eliminating the need to open and download each log instance individually, thus improving the efficiency of initial log file download.

[0095] In step S105 of some embodiments, since the log source information of the initial log file is unknown, it is impossible to determine which log instance called the initial log file. Therefore, the log source information of the initial log file is obtained. The log source information is log instance information, which clearly indicates which log instance the initial log file originated from.

[0096] In step S106 of some embodiments, log source information is annotated on the initial log file to obtain the target log file. The log source information on the target log file indicates which log instance the target log file originates from. Therefore, each target log file can be distinguished by the log source information on the target log file.

[0097] In step S107 of some embodiments, after the user finds the target log file to be downloaded based on the target microservice, the file download mode is determined according to the user's selection in the download mode option box, that is, the file download mode of the log instance is determined, and the target log file of the log instance is downloaded according to different file download modes to enrich the ways of downloading the target log file.

[0098] In step S108 of some embodiments, after determining the file download mode of the target log file, the target log file is downloaded according to the file download mode, so as to realize the target log file being downloaded in different modes. Specifically, a download address for the target log file is preset, meaning that the target log file is packaged into a folder according to the corresponding integration method and then downloaded to the preset download address.

[0099] Please see Figure 2 In some embodiments, the log source information includes the IP address information of the log instance. Step S106 may include, but is not limited to, steps S201 to S204.

[0100] Step S201: Obtain the number of characters in the IP address information to get the starting length;

[0101] Step S202: Obtain the starting position; wherein, the beginning of the initial log file is used as the starting position;

[0102] Step S203: Determine the annotation position based on the starting position and starting length;

[0103] Step S204: Annotate the IP address information at the location to be annotated to obtain the target log file.

[0104] In step S201 of some embodiments, since the log source information includes the IP address information of the log instance, the source of each target log file is distinguished by the IP address information, and different IP address information corresponds to different number of characters, the starting length is determined according to the number of characters of the IP address information, and the starting length is the length of the IP address information marked at the position to be marked in the initial log file.

[0105] In step S202 of some embodiments, the beginning of the initial log file is obtained as the starting position, so that the IP address information can be annotated at the beginning of the initial log file, and the initial log file can be distinguished by IP address information.

[0106] In step S203 of some embodiments, the annotation position is determined according to the starting length and the starting position. Specifically, the same number of empty spaces as the number of characters of the IP address information are set at the beginning of the initial log file to obtain the annotation position. Therefore, the length of the annotation position is consistent with the starting length, so the complete IP address information can be filled in, making the annotation of IP address information simple.

[0107] In step S204 of some embodiments, after determining the annotation position that matches the starting length, the IP address information is annotated at the annotation position to obtain the target log file. Therefore, the IP address information on the target log file can be used to know which log instance the log file comes from, so as to distinguish the target log files and facilitate the user's software development.

[0108] It should be noted that the initial position is set at the beginning of the initial log file. The annotation locations are then determined based on the initial length and position, and are indicated by quotation marks "【】". The IP address information is then annotated within the quotation marks. Therefore, the IP address information allows identification of the target log file's origin from a specific log instance, eliminating the need to revisit the log instance interface during log file search and saving time, thus improving the efficiency of retrieving the target log file.

[0109] Please see Figure 3 In some embodiments, the target log file includes the update time and the updated content updated at the update time. Step S108 may include, but is not limited to, steps S301 to S302.

[0110] Step S301: Create a storage folder according to the file download mode; wherein, the file download mode includes any of the following: merge download mode, independent download mode, and append download mode.

[0111] Step S302: Download the target log files to the storage folder according to the file download mode; wherein, in the merge download mode, all target log files are merged and downloaded to the storage folder; in the independent download mode, any two target log files downloaded to the storage folder are isolated from each other; in the append download mode, each update content is downloaded to a storage folder according to each update time, and any two target log files are isolated from each other.

[0112] In step S301 of some embodiments, since there are multiple file download modes, and the file download modes include any of the following: merge download mode, independent download mode and append download mode, the target log files need to be integrated in a corresponding way according to different file download modes, so as to realize the integration of target log files in different file download modes. Therefore, a storage folder is created according to the file download mode.

[0113] It should be noted that only one storage folder is set for the merge download mode, the number of storage folders for the independent download mode is determined according to the number of target log files, and the storage folder for the append download mode is the already established storage folder, so that the updated content will be downloaded to the established storage folder according to the append download mode.

[0114] In step S302 of some embodiments, after creating a storage folder, the target log file is downloaded to the storage folder according to the file download mode. Since the merged download mode corresponds to one storage folder, multiple target log files are stored in the storage folder to achieve merged download. If the file download mode is the independent download mode, multiple storage folders are created according to the independent download mode, and the target log files are stored in the storage folders respectively, with any two target log files isolated from each other to achieve isolated download of target log files from different log instances. If the file download mode is the append download mode, the updated content is appended to the established storage folder according to each update time to achieve the latest content being appended to the storage folder, thus updating the target log file.

[0115] Please see Figure 4 In some embodiments, when the file download mode is a merged download mode, step S302 may include, but is not limited to, steps S401 to S402.

[0116] Step S401: Obtain the log time of each target log file; wherein, the log time is the last update time of each target log file;

[0117] Step S402: Download multiple target log files to the storage folder according to the log time sequence.

[0118] In step S401 of some embodiments, the last update time of the target log file is obtained as the log time, so as to clarify the latest time of the log instance based on the log time. For example, if the log instance is a bank list that was accessed, and the latest time when the bank list was accessed is 1:10, then 1:10 is determined to be the log time.

[0119] In step S402 of some embodiments, since there are multiple target log files corresponding to the merged download mode, these multiple target log files need to be stored in a storage folder. To facilitate users in finding the latest updated target log file, the multiple target log files are downloaded to the storage folder in chronological order of log time. Therefore, by downloading the target log files to the storage folder in chronological order of log time, users can obtain the latest updated target log file first, enabling them to quickly conduct development and testing.

[0120] It should be noted that since different log instances have corresponding timelines, target log files are consolidated into a storage folder based on their log timestamps. Furthermore, the IP address information in each target log file clearly indicates which instance it originates from. Users will then receive a storage folder containing multiple target log files. If an original log file exists in the storage folder, it will be overwritten by the target log file. For example, if the target log file for the bank list being accessed has a log time of 1:10 AM, and the target log file for the real-time transaction being initiated has a log time of 1:15 AM, according to the merged download mode, the target log file for the bank list accessed at 1:10 AM will be downloaded to the storage folder first, followed by the target log file for the real-time transaction initiated at 1:15 AM, ensuring that the target log files are downloaded in chronological order.

[0121] Please see Figure 5 The file download mode is an independent download mode, and a storage folder corresponding to the log source information is created; in some embodiments, step S302 may include, but is not limited to, step S501.

[0122] Step S501: Download the target log file to the storage folder according to the log source information.

[0123] In step S501 of some embodiments, if the file download mode is independent download mode, the log source information of the target log file is obtained, and a corresponding storage folder is created based on the log source information. Then, the target log file is downloaded to the corresponding storage folder according to the log source information, realizing the separate download of the target log files, and the storage folders of any two target log files are independent of each other. For example, if there are three target log files, and the log source information of the three target log files are a, b, and c respectively, then three storage folders A, B, and C are created. Then, the target log file with log source information a is downloaded to storage folder A, the target log file with log source information b is downloaded to storage folder B, and the target log file with log source information c is downloaded to storage folder C. Therefore, the target log files are stored separately according to the independent download mode to realize the individual download of the target log files.

[0124] It should be noted that if the original log file exists in the storage folder, the latest downloaded target log file will overwrite the original log file.

[0125] Please see Figure 6 The file download mode is the append download mode, and step S302 may include, but is not limited to, steps S601 to S603.

[0126] Step S601: Obtain the original log file in the storage folder;

[0127] Step S602: Compare the target log file and the original log file to obtain the updated content;

[0128] Step S603: Write the updated content to the original log file in the storage folder.

[0129] In step S601 of some embodiments, since the append download mode is set for cases where log files have already been downloaded, if an original log file exists in the storage folder, the append download mode is used to download the target log file to the storage folder to update the log file. Therefore, when the file download mode is append download mode, the original log file in the storage folder is obtained, which is the already downloaded log file.

[0130] In step S602 of some embodiments, a difference comparison is performed between the target log file and the original log file. Specifically, the difference comparison is performed between the target log content of the target log file and the original log content of the original log file to obtain updated content. The updated content is original log content that is not present in the original log file. By obtaining the updated content through a difference comparison between the target log file and the original log file, the updated content can be appended to the original log file without downloading the entire target log file, thus saving file download time.

[0131] In step S603 of some embodiments, the updated content is written to the original log file in the storage folder. Specifically, the update position of the updated content in the original log file is obtained, and the updated content is written to the update position in the original log file, so the original log file maintains an incremental state. Therefore, only the updated content is written to the original log file, without downloading the entire target log file or completely overwriting the original log file, which saves file download time and reduces the space occupied by the storage folder.

[0132] In some embodiments, after step S302, the log processing method further includes updating the target log file. After the target log file is downloaded, the user can open it in the editing software. However, the target log file in the storage folder is updated according to a preset period. If the user reads the target log file for too long, they will not be able to view the latest target log file. Therefore, in order for the user to view the latest target log file in real time, the currently read target log file is updated.

[0133] Please see Figure 7 In some embodiments, updating the target log file may include, but is not limited to, steps S701 to S704.

[0134] Step S701: Obtain update information of the target log file according to a preset cycle;

[0135] Step S702: Output update prompts based on the update information;

[0136] Step S703: Receive the update request from the user terminal based on the update prompt;

[0137] Step S704: Update the target log file on the user terminal according to the update request, obtain the update log file, and display the update log file to the user terminal.

[0138] Before updating the target log file, display the target log file on the user's device. Once the target log file is downloaded, display it on the user's device using editing software, allowing the user to view the target log file in real time. For example, if the editing software is Sublime Text, open the target log file using Sublime Text.

[0139] In step S701 of some embodiments, the update information of the target log file is cyclically detected according to a preset period. If update information exists, it means that the target log file has been updated; if no update information exists, it means that the target log file has not been updated. Therefore, the update information of the target log file is periodically detected to determine whether the target log file has been updated.

[0140] In step S702 of some embodiments, when the target log file has been updated, an update prompt is entered according to the update information, and the update prompt is displayed in front of the target log file currently viewed by the user, so as to prompt the user whether the target log file needs to be updated to the latest version.

[0141] In step S703 of some embodiments, if the user needs to update the target log file to the latest version according to the update prompt, an update request is received from the user terminal based on the update prompt. If the user does not need to update the target log file to the latest version, the update prompt is no longer displayed. Therefore, by outputting update prompts, users can determine whether to update the target log file based on the update prompts, and the update request is received from the user terminal. The update is then performed based on the user's selection, thereby improving the user's reading experience.

[0142] In step S704 of some embodiments, the target log file to be updated is obtained according to the update request, and the update log file is displayed on the user terminal so that the user can view the latest update log file through the user terminal, thereby improving the user's experience in viewing the target log file.

[0143] This application discloses a log processing method. It involves filtering a target environment from candidate service environments based on a query request, then filtering a target microservice from candidate microservices based on the target environment. The initial log file of the log instance calling the target microservice is then obtained. The IP address information of the log instance is obtained, and the number of characters in the IP address information is used to determine the initial length. The beginning of the initial log file is then used as the initial position. A position corresponding to the initial length is set at the initial position to obtain the annotation position, and the IP address information is marked at the annotation position to obtain the target log file. The target log file indicates which log instance called the log file. When the target log file needs to be downloaded, the file download mode of the log instance is received. The file download mode includes any one of merge download mode, independent download mode, and append download mode. Therefore, the target log file is downloaded to the storage folder according to different file download modes, allowing users to select the corresponding file download mode according to the actual situation. This enables multiple download schemes for the target log file of the log instance, making the target log file download simple and fast, thereby improving software development efficiency.

[0144] Please see Figure 8 This application also provides a log processing apparatus that can implement the above-described log processing method. The apparatus includes:

[0145] Request retrieval module 801 is used to retrieve query requests;

[0146] The environment filtering module 802 is used to filter the target environment from the candidate service environment according to the query request;

[0147] The service filtering module 803 is used to filter the target microservice from the candidate microservices according to the target environment; the target microservice is stored in the configuration file, and the configuration file also stores the log instance used to call the target microservice;

[0148] The file retrieval module 804 is used to retrieve the initial log file of the log instance based on the target microservice;

[0149] Information acquisition module 805 is used to acquire log source information of the initial log file;

[0150] The annotation module 806 is used to annotate the log source information onto the initial log file to obtain the target log file;

[0151] The pattern acquisition module 807 is used to obtain the file download pattern based on the log instance;

[0152] Download module 808 is used to download the target log file according to the file download mode.

[0153] The specific implementation of this log processing device is basically the same as the specific embodiment of the log processing method described above, and will not be repeated here.

[0154] This application also provides a computer device, which includes: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for communication between the processor and the memory. When the program is executed by the processor, it implements the aforementioned log processing method. This computer device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0155] Please see Figure 9 , Figure 9 The hardware structure of a computer device according to another embodiment is illustrated. The computer device includes:

[0156] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0157] The memory 902 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 using the log processing method of the embodiments of this application.

[0158] The input / output interface 903 is used to implement information input and output;

[0159] The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0160] Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904);

[0161] The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.

[0162] This application also provides a storage medium, which is a computer-readable storage medium for computer-readable storage. The storage medium stores one or more programs, which can be executed by one or more processors to implement the above-described log processing method.

[0163] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0164] The log processing method, log processing apparatus, computer equipment, and storage medium provided in this application's embodiments filter out a target environment from candidate service environments based on a query request, and then filter out a target microservice from candidate microservices based on the target environment. The log instance corresponding to the target microservice is determined according to a configuration file. The initial log file of the log instance is then obtained based on the target microservice, simplifying the initial log file query and eliminating the need to open the initial log file of each log instance individually. Simultaneously, the log source information is marked on the initial log file to obtain the target log file. Based on the target log file, it is clear which log instance the log file originated from. The target log file is then downloaded according to a file download mode. By enriching the file download modes, users can select the appropriate mode according to their actual situation to quickly download the corresponding target log file, making target log file download easier and improving software development efficiency.

[0165] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0166] It will be understood by those skilled in the art that Figure 1-7 The technical solutions shown do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0167] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0168] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0169] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0170] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0171] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0172] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0173] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0174] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0175] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A log processing method, characterized in that, The method includes: Get the query request; Based on the query request, the target environment is selected from the candidate service environment; The target microservice is selected from the candidate microservices based on the target environment; wherein the target microservice is stored in a configuration file, and the configuration file also stores log instances used to call the target microservice; Obtain the initial log file of the log instance according to the target microservice; Obtain the log source information of the initial log file; The log source information is annotated onto the initial log file to obtain the target log file; Obtain the file download mode based on the log instance; Download the target log file according to the file download mode; The file download mode includes an append download mode, and downloading the target log file according to the file download mode includes: Obtain the original log file in the storage folder; wherein the storage folder is created according to the file download mode, and the original log file is the log file that has been downloaded in the storage folder; The target log file and the original log file are compared to obtain the updated content; Write the updated content to the original log file in the storage folder; The file download mode further includes a merged download mode, and downloading the target log file according to the file download mode includes: Obtain the log time of each target log file; wherein the log time is the last update time of each target log file; Multiple target log files are downloaded to the storage folder according to the chronological order of the log times; if an original log file exists in the storage folder, the original log file is overwritten by the target log file.

2. The log processing method according to claim 1, characterized in that, The log source information includes the IP address information of the log instance. The step of annotating the initial log file with the log source information to obtain the target log file includes: Obtain the number of characters in the IP address information to get the starting length; Obtain the starting position; wherein, the beginning of the initial log file is taken as the starting position; The annotation position is determined based on the starting position and the starting length; The IP address information is annotated at the designated annotation location to obtain the target log file.

3. The log processing method according to claim 1, characterized in that, The target log file includes the update time and the updated content updated at the update time. Downloading the target log file according to the file download mode includes: A storage folder is created according to the file download mode; wherein, the file download mode includes any one of the following: merge download mode, independent download mode, and append download mode; The target log files are downloaded to the storage folder according to the file download mode; wherein, in the merged download mode, all target log files are merged and downloaded to the storage folder; in the independent download mode, any two target log files downloaded to the storage folder are isolated from each other; in the appended download mode, each update content is downloaded to one of the storage folders according to each update time, and any two target log files are isolated from each other.

4. The log processing method according to claim 3, characterized in that, The file download mode is the independent download mode, and a storage folder corresponding to the log source information is created; the step of downloading the target log file to the storage folder according to the file download mode includes: Download the target log file to the storage folder based on the log source information.

5. The log processing method according to any one of claims 3 to 4, characterized in that, After downloading the target log file to the storage folder according to the file download mode, the method further includes: Updating the target log file specifically includes: The update information of the target log file is obtained according to a preset period; Output an update prompt based on the updated information; Receive update requests from the user based on the update prompts; The target log file on the user terminal is updated according to the update request to obtain an update log file, and the update log file is displayed to the user terminal.

6. A log processing device, characterized in that, The device includes: The request retrieval module is used to retrieve query requests. The environment filtering module is used to filter the target environment from the candidate service environment according to the query request; The service filtering module is used to filter target microservices from candidate microservices based on the target environment; wherein, the target microservices are stored in a configuration file, and the configuration file also stores log instances used to call the target microservices; The file acquisition module is used to obtain the initial log file of the log instance based on the target microservice; The information acquisition module is used to acquire the log source information of the initial log file; The annotation module is used to annotate the log source information onto the initial log file to obtain the target log file; The pattern acquisition module is used to obtain the file download pattern based on the log instance; The download module is used to download the target log file according to the file download mode; The file download mode includes an append download mode, and downloading the target log file according to the file download mode includes: Obtain the original log file in the storage folder; wherein the storage folder is created according to the file download mode, and the original log file is the log file that has been downloaded in the storage folder; The target log file and the original log file are compared to obtain the updated content; Write the updated content to the original log file in the storage folder; The file download mode further includes a merged download mode, and downloading the target log file according to the file download mode includes: Obtain the log time of each target log file; wherein the log time is the last update time of each target log file; Multiple target log files are downloaded to the storage folder according to the chronological order of the log times; if an original log file exists in the storage folder, the original log file is overwritten by the target log file.

7. A computer device, characterized in that, include: At least one memory; At least one processor; At least one program; The program is stored in the memory, and the processor executes the at least one program to achieve the following: The method as described in any one of claims 1 to 5.

8. A storage medium, said storage medium being a computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform: The method as described in any one of claims 1 to 5.