CN111930625A - Log obtaining method, device and system based on cloud service platform - Google Patents

Log obtaining method, device and system based on cloud service platform Download PDF

Info

Publication number
CN111930625A
CN111930625A CN202010805207.1A CN202010805207A CN111930625A CN 111930625 A CN111930625 A CN 111930625A CN 202010805207 A CN202010805207 A CN 202010805207A CN 111930625 A CN111930625 A CN 111930625A
Authority
CN
China
Prior art keywords
log
service
information
test
return code
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
CN202010805207.1A
Other languages
Chinese (zh)
Other versions
CN111930625B (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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202010805207.1A priority Critical patent/CN111930625B/en
Publication of CN111930625A publication Critical patent/CN111930625A/en
Application granted granted Critical
Publication of CN111930625B publication Critical patent/CN111930625B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • 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

Abstract

The invention discloses a log obtaining method, a log obtaining device and a log obtaining system based on a cloud service platform, and relates to the field of cloud computing, wherein the method comprises the following steps: acquiring a scheduling service test result return code based on a cloud service platform, and judging whether a log related to service test needs to be analyzed according to the return code; responding to the judgment result as required, and sending a login request to the cloud service platform according to pre-stored service configuration data, wherein the service configuration data comprises: cloud service platform address, login information and test information; responding to the success of the login request, and acquiring a log compressed file according to test information, wherein the test information comprises: an application name, a container node name and log path information corresponding to the service; and acquiring the log from the log compressed file, and establishing an association relation between the service and the log so as to analyze and process the log subsequently. By the method and the device, the cloud log can be automatically and quickly acquired, and the testing efficiency is improved.

Description

Log obtaining method, device and system based on cloud service platform
Technical Field
The invention relates to the field of cloud computing, in particular to a log obtaining method, device and system based on a cloud service platform.
Background
When performing an automation test of a PaaS (Platform as a Service) cloud Service, after the automation scheduling execution is completed, a tester needs to analyze and judge a case with an execution failure to determine whether the automated script test fails due to a program problem. Generally speaking, the return code and the prompt information of a service are not enough to analyze the true reason of failure, the reason can be more accurately positioned by matching with a log, and meanwhile, specific error reporting information in the log is provided for developers to analyze, so that the problem of program positioning can be quickly solved, but the difference between the acquisition of the cloud-entering log and the acquisition of the traditional server log is large after the test is carried out in the PaaS cloud, and the following difficulties exist:
(1) the cloud log obtaining step is complicated, a PaaS management platform needs to be logged in, the log is downloaded after a container is found, and a tester needs to master the operation and maintenance operation and technical capacity of the basic PaaS platform. If the container has multiple copies, it is also necessary to download back the logs of the multiple copies of the container and find the log of the existence of the transaction.
(2) After the cloud log is subjected to operations such as container restart, version installation upgrade and version rollback, the log can be emptied, if the transaction fails when a certain script is automatically scheduled and operated, the transaction related log is not timely retrieved, and a subsequent tester needs to manually operate the script which fails in the transaction again during analysis, so that the workload is repeated. In addition, if the script case data is dynamically acquired, the failed scene cannot be restored well, and the running transaction may be successful at the moment.
(3) The cloud service of the bank adopts a layered component research and development design, namely one service may be composed of an application transaction service, an application component service, a business object service and the like, so that a complete log record of one transaction exists in logs of a plurality of different containers, and the acquisition and analysis of the log are more complex compared with the acquisition and analysis of the log of a single container.
In summary, in the automatic test process of PaaS cloud service, when a transaction fails, there is no automatic and assorted method for quickly acquiring a cloud entry log, and how to provide a new scheme is a technical problem to be solved urgently.
Disclosure of Invention
In view of the above, the present invention provides a log obtaining method, device and system based on a cloud service platform to solve at least one of the above mentioned problems.
According to a first aspect of the present invention, a log obtaining method based on a cloud service platform is provided, where the method includes:
acquiring a scheduling service test result return code based on a cloud service platform, and judging whether a log related to the service test needs to be analyzed according to the return code;
responding to the judgment result as required, and sending a login request to the cloud service platform according to pre-stored service configuration data, wherein the service configuration data comprises: cloud service platform address, login information and test information;
responding to the success of the login request, and acquiring a log compressed file according to the test information, wherein the test information comprises: an application name, a container node name and log path information corresponding to the service;
and acquiring the log from the log compressed file, and establishing an association relation between the service and the log so as to analyze and process the log subsequently.
According to a second aspect of the present invention, there is provided a log obtaining apparatus based on a cloud service platform, the apparatus including:
the return code acquisition unit is used for acquiring a scheduling service test result return code based on the cloud service platform;
the judging unit is used for judging whether the log related to the service test needs to be analyzed or not according to the return code;
a login request sending unit, configured to send a login request to the cloud service platform according to pre-stored service configuration data in response to a determination result that the determination result is required, where the service configuration data includes: cloud service platform address, login information and test information;
a log compressed file obtaining unit, configured to respond to a successful login request, and obtain a log compressed file according to the test information, where the test information includes: an application name, a container node name and log path information corresponding to the service;
and the log processing unit is used for acquiring the log from the log compressed file and establishing the association relationship between the service and the log so as to analyze and process the log subsequently.
According to a third aspect of the present invention, there is provided a log obtaining system based on a cloud service platform, the system including: cloud service platform and above-mentioned log acquisition device based on cloud service platform.
According to a fourth aspect of the present invention, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the program.
According to a fifth aspect of the invention, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method.
According to the technical scheme, whether the logs related to the service test need to be analyzed is judged according to the obtained service test result return code, when the logs are needed, the login request is sent to the cloud service platform according to the pre-stored service configuration data, when the login request is successful, the log compression file is obtained on the cloud service platform, then the needed logs are obtained from the log compression file, the association relation between the service and the logs is established, the logs can be conveniently analyzed and processed subsequently, the reason of the service test failure can be analyzed, and through the technical scheme, the cloud logs can be automatically and quickly obtained, so that the reason of the service test failure can be timely and effectively analyzed, and the test efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart of a log obtaining method based on a cloud service platform according to an embodiment of the present invention;
FIG. 2 is a detailed flowchart of service testing and log acquisition based on a cloud service platform according to an embodiment of the present invention;
fig. 3 is a block diagram of a cloud service platform-based log acquisition system according to an embodiment of the present invention;
fig. 4 is a block diagram illustrating a configuration of a log obtaining apparatus based on a cloud service platform according to an embodiment of the present invention;
FIG. 5 is a block diagram of an example structure of an automated testing system based on a cloud entry log according to an embodiment of the invention;
fig. 6 is a block diagram of the structure of the user-defined apparatus 1 according to the embodiment of the present invention;
FIG. 7 is a service example interface screenshot in accordance with an embodiment of the present invention;
FIG. 8 is an exemplary interface screenshot of a service versus log acquisition contrast relationship according to an embodiment of the present invention;
FIG. 9 is an exemplary interface screenshot of a service and log one-to-many relationship, according to an embodiment of the invention;
fig. 10 is a block diagram of the structure of the log downloading device 2 according to the embodiment of the present invention;
fig. 11 is a block diagram of the structure of the log parsing apparatus 3 according to the embodiment of the present invention;
fig. 12 is a schematic block diagram of a system configuration of an electronic apparatus 600 according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the existing cloud service automatic testing process, when the service test fails, no automatic matching method for quickly acquiring the cloud log exists, so that the reason of the test failure cannot be timely and effectively analyzed, and the testing efficiency is influenced. Based on this, the embodiment of the invention provides a log obtaining scheme based on a cloud service platform, and through the scheme, the log entering the cloud can be automatically and quickly obtained, so that the reason of test failure can be timely and effectively analyzed, and the test efficiency is improved.
The cloud service platform related in the embodiment of the present invention may be a PaaS, or a TaaS (Test as a service, Test platform), and the present invention does not limit a specific cloud service platform. The following takes PaaS as an example, and the embodiments of the present invention are described in detail with reference to the accompanying drawings.
Fig. 1 is a flowchart of a log obtaining method based on a cloud service platform according to an embodiment of the present invention, and as shown in fig. 1, the method includes:
step 101, obtaining a return code of a scheduling service test result based on a cloud service platform, and judging whether a log related to the service test needs to be analyzed according to the return code.
In actual operation, failure return code information indicating a failure return code and a corresponding test failure reason may be configured in advance. Therefore, whether the obtained return code needs to obtain the log or not can be judged according to the failure return code information, when the return code is not in the failure return code information, the return code is possibly caused by program problems, and at the moment, the judgment result is that the log needs to be analyzed, so that the reason of the service test failure can be known conveniently.
For example, the return code 5399 exists in the failure return code information, and the 5399 return code indicates that the communication area check failed, that is, some return codes (which do not belong to the program problem) are configured in the failure return code information, so that the reason of the service test failure can be known without pulling and analyzing the log.
Step 102, responding to the judgment result as required, and sending a login request to the cloud service platform according to pre-stored service configuration data, wherein the service configuration data comprises: cloud service platform address, login information (e.g., username, password), test information.
In one embodiment, the test information specifically includes: an application name, a container node name, and log path information corresponding to the service.
And 103, responding to the success of the login request, and acquiring a log compressed file according to the test information.
Specifically, container information is obtained according to an application name and a container node name in the test information, and the container information includes: container Identification (ID), host IP address and log download port; and then, acquiring a log compressed file according to the container information and the log path information.
And 104, acquiring the log from the log compressed file, and establishing an association relation between the service and the log so as to analyze and process the log subsequently.
In a specific implementation process, the obtained log compressed file may be stored in a local folder, where the local folder uses a service name as a primary directory and a container node name as a secondary directory. The directory is established according to the names of the container nodes, so that the problem that log names are covered if the log names are the same when the nodes of multiple containers exist is solved. When a single container node, if there are multiple copies, the compressed file is renamed to avoid overwriting.
After the log compressed file is stored, decompressing the log compressed file to obtain a log file; and searching the service start time and the service end time from the log file according to the regular expression based on the service class name in the log file, thereby obtaining the log.
And then, establishing an association relationship between the service and the log, wherein the service can be associated with the link of the log, and when the link is clicked, the log can be directly returned so as to be conveniently analyzed and processed.
Whether the logs related to the service test need to be analyzed is judged according to the obtained service test result return code, when the logs are needed, a login request is sent to the cloud service platform according to the pre-stored service configuration data, when the login request is successful, a log compression file is obtained on the cloud service platform, then the needed logs are obtained from the log compression file, and the association relationship between the service and the logs is established, so that the logs can be conveniently analyzed and processed subsequently, the reason of the service test failure can be analyzed, and through the embodiment of the invention, the cloud logs can be automatically and quickly obtained, so that the reason of the service test failure can be timely and effectively analyzed, and the test efficiency is improved.
For a better understanding of the embodiments of the present invention, a detailed flow of service testing and log acquisition is given below in conjunction with fig. 2. As shown in fig. 2, the process includes:
step 201: the application starts to boot.
Step 202: the system starts to start the automation framework and starts successfully.
Step 203: an automated script runs test cases, and generally, a service designs one or more cases to cover different branches in the service, calls the cases according to service dimensions, and automatically schedules the service to run the test cases.
If the error is reported, whether the log needs to be acquired is judged according to the return code, if the return code is not in the failure return code information, namely the actual error is reported, the log needs to be acquired and analyzed, and the step 204 is performed, otherwise, the step 207 is performed.
Step 204: after a request authorization is sent by using a PaaS address, a user name and a password, container basic information is inquired and obtained according to an application name and a container node name to obtain specific information such as a container ID, a host machine IP and a port, a log path request is uploaded, a log compression packet (namely, a cloud log compression packet) is obtained, a directory is established according to a service name and the container node name, and the log compression packet is stored. In the embodiment of the invention, the log downloading of a single-container multi-copy multi-container node is supported.
Step 205: and decompressing the log compression packets, wherein when a plurality of log compression packets exist, the decompressed files need to be renamed to avoid coverage.
Step 206: and performing log search by using the service name, intercepting related job (also called transaction) sections in the log, and saving the sections to a final log result file. And meanwhile, generating a report file, and establishing a corresponding relation between the failed service of the test case and the final log result file.
And according to the contrast relation between the service and the log, after the service reports an error, performing the series of processing to obtain the log. The log records the class name of the service, and can search the start and end of the job according to the regular expression after intercepting the class name of the service, and store the start and end of the job. Because the logs in the container not only have the services which are automatically operated currently, but also have many other services which are manually executed and automatically operated by the system. The log file has a lot of information, and the interested logs need to be extracted, so the logs need to be intercepted and stored according to the service, and the final log result file is opened to be the specific log of the service.
Step 207: and continuing to schedule and run the automatic test script, and if the test case is in error, repeating the step 203 and 206.
Step 208: and completing the operation of the automatic framework.
Step 209: and (5) other processing of the system.
As can be seen from the above description, by configuring the failure return code information, the cloud entry log of the case execution failure service can be automatically downloaded, which is beneficial for the testers to perform preliminary problem screening and the developers to analyze and locate the program problems. By the embodiment of the invention, the problem of high difficulty in obtaining the cloud log is solved, and a series of complex operation and maintenance technical operations do not need to be carried out by a tester.
Based on similar inventive concepts, an embodiment of the present invention further provides a log obtaining system based on a cloud service platform, as shown in fig. 3, the system includes: the log acquisition device is used for acquiring cloud logs in the cloud service platform. Preferably, the log obtaining apparatus may implement the process of the log obtaining method based on the cloud service platform.
Fig. 4 is a block diagram showing the configuration of a log obtaining apparatus, which includes, as shown in fig. 4: a return code obtaining unit 10, a judging unit 20, a login request sending unit 30, a log compressed file obtaining unit 40 and a log processing unit 50, wherein:
and the return code acquiring unit 10 is configured to acquire a scheduling service test result return code based on the cloud service platform.
And a judging unit 20, configured to judge whether a log related to the service test needs to be analyzed according to the return code.
Specifically, the determining unit may determine whether the obtained return code needs to parse the log based on preconfigured failure return code information, where the failure return code information is used to indicate the failure return code and a corresponding test failure reason.
A login request sending unit 30, configured to send, in response to the determination result being a need, a login request to the cloud service platform according to pre-stored service configuration data, where the service configuration data includes: cloud service platform address, login information, test information, this test information includes: an application name, a container node name, and log path information corresponding to the service.
And the log compressed file acquiring unit 40 is used for responding to the success of the login request and acquiring the log compressed file according to the test information.
In one embodiment, the log compressed file obtaining unit includes: the device comprises a container information acquisition module and a log compressed file acquisition module, wherein: a container information obtaining module, configured to obtain container information according to an application name and a container node name in the test information, where the container information includes: container identification, host machine IP address and log downloading port; and the log compressed file acquisition module is used for acquiring the log compressed file according to the container information and the log path information.
And the log processing unit 50 is configured to obtain the log from the log compressed file, and establish an association relationship between the service and the log, so as to perform analysis processing on the log subsequently.
In one embodiment, the log processing unit includes: decompression module and log acquisition module, wherein: the decompression module is used for decompressing the log compressed file to obtain a log file; and the log obtaining module is used for obtaining the log from the log file according to the regular expression based on the service class name in the log file.
The log processing unit is further configured to establish an association relationship between the service and the log, and in one example, may establish a correspondence relationship between the service and the log link, and when the log link is clicked, the log may be directly returned, so that a tester may analyze and process the log.
Whether the logs related to the service test need to be analyzed is judged by the judging unit 20 according to the service test result return code acquired by the return code acquiring unit 10, when the logs are required, the log request transmitting unit 30 transmits a log request to the cloud service platform according to the pre-stored service configuration data, when the log request is successful, the log compressed file acquiring unit 40 acquires a log compressed file on the cloud service platform, then the log processing unit 50 acquires the required logs from the log compressed file, establishes the association relationship between the service and the logs, and facilitates the subsequent analysis and processing of the logs so as to analyze the reason of the service test failure.
In a specific implementation process, the apparatus may further include: and the storage unit is used for storing the acquired log compressed file in a local folder, wherein the local folder takes the service name as a primary directory and the container node name as a secondary directory. Therefore, the problem that log names are the same and can be covered when the nodes with multiple containers exist can be solved.
For specific execution processes of the units and the modules, reference may be made to the description in the foregoing method embodiments, and details are not described here again.
In practical operation, the units and the modules may be combined or may be singly arranged, and the present invention is not limited thereto.
For further understanding of the embodiment of the present invention, the following description is made in detail with reference to the automated testing system based on the cloud entry log shown in fig. 5, and the testing system corresponds to the log obtaining apparatus described above.
As shown in fig. 5, the system includes: a user definition device 1, a log downloading device 2 and a log parsing device 3, wherein:
and the user definition device 1 judges whether to perform log acquisition and analysis according to the return code called by the automation script. The device needs to configure the PaaS environment, the name of the container node corresponding to the service and the log path at the same time. The user-defined device 1 has the functions of the return code acquisition unit 10 and the judgment unit 20.
The log downloading device 2 sends a login request according to the PaaS environment, the name of the container node and the log path, inquires the basic information of the container after authorization, acquires a log compression packet file, builds a primary directory according to the service name after decompressing to the local path, builds a secondary directory according to the name of the container node, and stores the corresponding log file. The log downloading device 2 has the functions of the log request transmitting unit 30 and the log compressed file acquiring unit 40.
The log analysis device 3 analyzes the log file, and intercepts and stores the related log paragraphs in the log according to the service class name. And generating a summary report, establishing a corresponding relation between the failure service and the log, and clicking the link to open the corresponding log quickly, so that a tester can analyze and confirm the failure reason of the service test conveniently. The log analysis device 3 has the function of the log processing unit 50.
The three devices are described in detail below with reference to the accompanying drawings.
Fig. 6 is a block diagram showing the structure of the user definition apparatus 1, which includes, as shown in fig. 6: an environment configuration unit 11, a log association unit 12, and a judgment execution unit 13, wherein:
the environment configuration unit 11: the PaaS container environment information is saved to a project configuration file (corresponding to the service configuration data described above) that includes: the PaaS management platform address, the application login user name and the application login password of the current version function test environment.
The log associating unit 12: and storing the service corresponding log relation into a project configuration file, and establishing a comparison relation between the service and an application name, a container node name and a log path. The method supports single service association to establish the contrast relation between the names of a plurality of container nodes and a plurality of log paths, and solves the problem of service layering componentization multi-log acquisition.
FIG. 7 is a service example interface screen shot, as shown in FIG. 7, illustrating the services of an ECIS customer information application and the services of an IPVS customer value added service application.
In an embodiment, each service is automatically scheduled, and when an error is reported, a log corresponding to the service can be obtained according to an application + container node + log path, so that a log obtaining comparison relationship of each service needs to be established, as shown in fig. 8, so that an automation component can realize log pulling.
In actual operation, the service and the log may be one-to-one or one-to-many. One-to-many referring to the ECIS container shown in FIG. 9, one SVC service may call several SVC, PERS, and COMM service components, so to obtain the log of the one SVC service, 3 containers are associated, and the configuration log of each container is also different.
The judgment execution unit 13: and if the case reports an error after the automatic script runs and the return code is not in the configuration range, subsequent log acquisition and analysis operations are carried out.
It should be noted that, the return code is returned after the service is automatically invoked and the service logic process is completed, and the reason why the service is successfully or unsuccessfully returned is what reason the service is failed (according to different error-reported return codes). For example, service return 5399: the communication zone check fails, which is an error report caused by data problems and not caused by real procedure problems. That is, some error reporting codes (e.g., 5399) may be configured without pulling and parsing the log.
Fig. 10 is a block diagram showing the configuration of the log downloading apparatus 2, which, as shown in fig. 10, includes: a login execution unit 21, an inquiry execution unit 22, a download execution unit 23, and a decompression execution unit 24, wherein:
the login execution unit 21: and sending a login request by using the user name, the password and the PaaS platform address in the configuration file, and performing subsequent operation after successfully returning.
The query execution unit 22: according to the application name and the container node name corresponding to the service in the service contrast relationship, firstly, the container basic information is inquired, and the container ID, the host IP and the log downloading port are obtained.
The download execution unit 23: according to the container ID, the host machine IP, the log downloading port and the log path, sending a request to obtain a log compression file, establishing a primary directory in a local folder according to a service name, establishing a secondary directory in a container node name, and storing a log compression packet to the corresponding local path. The directory is established according to the names of the container nodes, so that the problem that the log names are covered if the log names are the same when the nodes of multiple containers are used is solved. When a single container node, if there are multiple copies, the compressed file is renamed to avoid file overwriting.
The decompression execution unit 24: and decompressing the compressed packets in each secondary directory, and renaming the log files if a plurality of compressed packets exist to avoid same-name coverage.
Fig. 11 is a block diagram showing the configuration of the log analysis device 3, and as shown in fig. 11, the log analysis device includes: a log search unit 31, a log interception unit 32, a report generation unit 33, wherein:
the log search unit 31: and searching the log files according to the service class names, and determining which log files have the transaction record according to the service names when a plurality of log files exist.
The log intercepting unit 32: because the log has more recorded contents, in order to enable a tester to quickly find the reason of positioning error reporting in the transaction process in the log, log paragraphs related to service transaction are intercepted and stored in a final result file.
Report generation unit 33: and generating a report file, establishing a corresponding relation between the service and the log result file, and conveniently opening the log result in the report by one key by a tester without searching in each directory in a link mode.
The present embodiment also provides an electronic device, which may be a desktop computer, a tablet computer, a mobile terminal, and the like, but is not limited thereto. In this embodiment, the electronic device may be implemented with reference to the above method embodiment and the log obtaining apparatus/system embodiment, and the contents thereof are incorporated herein, and repeated descriptions are omitted here.
Fig. 12 is a schematic block diagram of a system configuration of an electronic apparatus 600 according to an embodiment of the present invention. As shown in fig. 12, the electronic device 600 may include a central processor 100 and a memory 140; the memory 140 is coupled to the central processor 100. Notably, this diagram is exemplary; other types of structures may also be used in addition to or in place of the structure to implement telecommunications or other functions.
In one embodiment, the log acquisition function may be integrated into the central processor 100. The central processor 100 may be configured to control as follows:
acquiring a scheduling service test result return code based on a cloud service platform, and judging whether a log related to the service test needs to be analyzed according to the return code;
responding to the judgment result as required, and sending a login request to the cloud service platform according to pre-stored service configuration data, wherein the service configuration data comprises: cloud service platform address, login information and test information;
responding to the success of the login request, and acquiring a log compressed file according to the test information, wherein the test information comprises: an application name, a container node name and log path information corresponding to the service;
and acquiring the log from the log compressed file, and establishing an association relation between the service and the log so as to analyze and process the log subsequently.
As can be seen from the above description, according to the electronic device provided in the embodiment of the present invention, whether a log related to a service test needs to be analyzed is determined according to an obtained service test result return code, when the log is required, a login request is sent to a cloud service platform according to pre-stored service configuration data, when the login request is successful, a log compression file is obtained on the cloud service platform, then a required log is obtained from the log compression file, and an association relationship between a service and the log is established, so that the log can be analyzed and processed subsequently, so as to analyze a reason of a service test failure.
In another embodiment, the log obtaining apparatus/system may be configured separately from the central processor 100, for example, the log obtaining apparatus/system may be configured as a chip connected to the central processor 100, and the log obtaining function is realized by the control of the central processor.
As shown in fig. 12, the electronic device 600 may further include: communication module 110, input unit 120, audio processing unit 130, display 160, power supply 170. It is noted that the electronic device 600 does not necessarily include all of the components shown in fig. 12; furthermore, the electronic device 600 may also comprise components not shown in fig. 12, which may be referred to in the prior art.
As shown in fig. 12, the central processor 100, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, the central processor 100 receiving input and controlling the operation of the various components of the electronic device 600.
The memory 140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 100 may execute the program stored in the memory 140 to realize information storage or processing, etc.
The input unit 120 provides input to the cpu 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display an object to be displayed, such as an image or a character. The display may be, for example, an LCD display, but is not limited thereto.
The memory 140 may be a solid state memory such as Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 140 may also be some other type of device. Memory 140 includes buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application/function storage section 142, and the application/function storage section 142 is used to store application programs and function programs or a flow for executing the operation of the electronic device 600 by the central processing unit 100.
The memory 140 may also include a data store 143, the data store 143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by the electronic device. The driver storage portion 144 of the memory 140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging application, address book application, etc.).
The communication module 110 is a transmitter/receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter/receiver) 110 is coupled to the central processor 100 to provide an input signal and receive an output signal, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide audio output via the speaker 131 and receive audio input from the microphone 132 to implement general telecommunications functions. Audio processor 130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, an audio processor 130 is also coupled to the central processor 100, so that recording on the local can be enabled through a microphone 132, and so that sound stored on the local can be played through a speaker 131.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the steps of the log obtaining method.
In summary, the embodiment of the present invention provides a log obtaining scheme based on a cloud service platform, which can automatically and quickly obtain and analyze a cloud entry log when an automated scheduling execution test case fails in an automated test process of a cloud entry service, so that a failure reason can be timely and effectively analyzed, and test efficiency is improved. Specific advantages of this approach include:
(1) according to the return code information configured by the user, the cloud log of the service with case execution failure can be automatically downloaded, and the method is beneficial for testers to primarily screen problems and developers to analyze and position program problems.
(2) The problem of the cloud log that the degree of difficulty is big is obtained to the income cloud log is solved, need not the tester and carries out a series of complicated fortune dimension technical operation.
(3) The problem that logs are lost when the container is restarted and the version is updated in the cloud log entering process can be solved, and the situation that the same case is still needed to be used for repeatedly running scripts when the reason of the problems is analyzed and positioned after the automatic running is finished is avoided.
(4) The method relates to transaction of service hierarchical structure, can download and analyze the cloud log of multi-container nodes at the same time, generates a report to quickly search the corresponding log of the failed service, and can solve the problem of complicated log search caused by the fact that the transaction and the log are not in one-to-one relationship.
The preferred embodiments of the present invention have been described above with reference to the accompanying drawings. The many features and advantages of the embodiments are apparent from the detailed specification, and thus, it is intended by the appended claims to cover all such features and advantages of the embodiments which fall within the true spirit and scope thereof. Further, since numerous modifications and changes will readily occur to those skilled in the art, it is not desired to limit the embodiments of the invention to the exact construction and operation illustrated and described, and accordingly, all suitable modifications and equivalents may be resorted to, falling within the scope thereof.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (13)

1. A log obtaining method based on a cloud service platform is characterized by comprising the following steps:
acquiring a scheduling service test result return code based on a cloud service platform, and judging whether a log related to the service test needs to be analyzed according to the return code;
responding to the judgment result as required, and sending a login request to the cloud service platform according to pre-stored service configuration data, wherein the service configuration data comprises: cloud service platform address, login information and test information;
responding to the success of the login request, and acquiring a log compressed file according to the test information, wherein the test information comprises: an application name, a container node name and log path information corresponding to the service;
and acquiring the log from the log compressed file, and establishing an association relation between the service and the log so as to analyze and process the log subsequently.
2. The method of claim 1, wherein determining whether a log associated with the service test needs to be parsed based on the return code comprises:
and judging whether the acquired return code needs to analyze the log or not based on preconfigured failure return code information, wherein the failure return code information is used for indicating the failure return code and the corresponding test failure reason.
3. The method of claim 1, wherein obtaining a log compression file from the test information comprises:
acquiring container information according to the application name and the container node name in the test information, wherein the container information comprises: container identification, host machine IP address and log downloading port;
and acquiring the log compressed file according to the container information and the log path information.
4. The method of claim 3, further comprising:
and storing the acquired log compressed file in a local folder, wherein the local folder takes the service name as a primary directory and the container node name as a secondary directory.
5. The method of claim 1, wherein obtaining the log from the log compression file comprises:
decompressing the log compressed file to obtain a log file;
and acquiring the log from the log file according to a regular expression based on the service class name in the log file.
6. A log obtaining device based on a cloud service platform is characterized in that the device comprises:
the return code acquisition unit is used for acquiring a scheduling service test result return code based on the cloud service platform;
the judging unit is used for judging whether the log related to the service test needs to be analyzed or not according to the return code;
a login request sending unit, configured to send a login request to the cloud service platform according to pre-stored service configuration data in response to a determination result that the determination result is required, where the service configuration data includes: cloud service platform address, login information and test information;
a log compressed file obtaining unit, configured to respond to a successful login request, and obtain a log compressed file according to the test information, where the test information includes: an application name, a container node name and log path information corresponding to the service;
and the log processing unit is used for acquiring the log from the log compressed file and establishing the association relationship between the service and the log so as to analyze and process the log subsequently.
7. The apparatus according to claim 6, wherein the determining unit is specifically configured to:
and judging whether the acquired return code needs to analyze the log or not based on preconfigured failure return code information, wherein the failure return code information is used for indicating the failure return code and the corresponding test failure reason.
8. The apparatus according to claim 6, wherein the log compressed file obtaining unit includes:
a container information obtaining module, configured to obtain container information according to an application name and a container node name in the test information, where the container information includes: container identification, host machine IP address and log downloading port;
and the log compressed file acquisition module is used for acquiring the log compressed file according to the container information and the log path information.
9. The apparatus of claim 8, further comprising:
and the storage unit is used for storing the acquired log compressed file in a local folder, wherein the local folder takes the service name as a primary directory and the container node name as a secondary directory.
10. The apparatus of claim 6, wherein the log processing unit comprises:
the decompression module is used for decompressing the log compressed file to obtain a log file;
and the log obtaining module is used for obtaining the log from the log file according to the regular expression based on the service class name in the log file.
11. A log obtaining system based on a cloud service platform is characterized by comprising: cloud service platform and the cloud service platform based log retrieval device of any of claims 6 to 10.
12. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 5 are implemented when the processor executes the program.
13. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
CN202010805207.1A 2020-08-12 2020-08-12 Log acquisition method, device and system based on cloud service platform Active CN111930625B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010805207.1A CN111930625B (en) 2020-08-12 2020-08-12 Log acquisition method, device and system based on cloud service platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010805207.1A CN111930625B (en) 2020-08-12 2020-08-12 Log acquisition method, device and system based on cloud service platform

Publications (2)

Publication Number Publication Date
CN111930625A true CN111930625A (en) 2020-11-13
CN111930625B CN111930625B (en) 2024-01-30

Family

ID=73311160

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010805207.1A Active CN111930625B (en) 2020-08-12 2020-08-12 Log acquisition method, device and system based on cloud service platform

Country Status (1)

Country Link
CN (1) CN111930625B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051176A (en) * 2021-04-20 2021-06-29 中国工商银行股份有限公司 Method and device for processing automatic test data, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106980627A (en) * 2016-01-18 2017-07-25 中兴通讯股份有限公司 The display methods and device of log content
CN112732587A (en) * 2021-01-21 2021-04-30 腾讯科技(深圳)有限公司 Method and device for acquiring automatic test log, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107819616A (en) * 2017-10-30 2018-03-20 杭州安恒信息技术有限公司 Automatically extract the method, apparatus and system of daily record

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106980627A (en) * 2016-01-18 2017-07-25 中兴通讯股份有限公司 The display methods and device of log content
CN112732587A (en) * 2021-01-21 2021-04-30 腾讯科技(深圳)有限公司 Method and device for acquiring automatic test log, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051176A (en) * 2021-04-20 2021-06-29 中国工商银行股份有限公司 Method and device for processing automatic test data, electronic equipment and storage medium
CN113051176B (en) * 2021-04-20 2024-03-26 中国工商银行股份有限公司 Automatic test data processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111930625B (en) 2024-01-30

Similar Documents

Publication Publication Date Title
CN109302522B (en) Test method, test device, computer system, and computer medium
CN107688530B (en) Software testing method and device
US10067863B1 (en) Feature targeting of test automation lab machines
US8655336B1 (en) Remote issue logging and reporting of mobile station issues and diagnostic information to manufacturer
US20180322037A1 (en) Impersonation in test automation
CN111897724B (en) Automatic testing method and device suitable for cloud platform
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN110543428B (en) Application system testing method and device
CN111930625B (en) Log acquisition method, device and system based on cloud service platform
CN112463511B (en) Automatic test system and test method for serial port equipment of Internet of things
KR20070104202A (en) Automation test service system for view software of portable telephone and method thereof
CN113238935A (en) Application testing method, system, device, medium, and computer program product
CN111158987B (en) Health check method and device for micro-service architecture
CN112181784A (en) Code fault analysis method and system based on bytecode injection
CN112905460A (en) Device and method for simulating three-party receipt by automatic interface test
CN112650689A (en) Test method, test device, electronic equipment and storage medium
CN111274325A (en) Platform automation test method and system
CN114500348B (en) CDN gateway testing method and system
CN103019927B (en) A kind of performance test methods and system
CN116521251A (en) Service management method, device, computer equipment and storage medium
CN113934552A (en) Method and device for determining function code, storage medium and electronic device
CN110618943B (en) Security service test method and device, electronic equipment and readable storage medium
CN115914055A (en) Distributed network testing method, device, medium and equipment
CN112214407A (en) Data verification control and execution method and corresponding device, equipment and medium
CN110266762A (en) A kind of data uploading method, system, device and storage 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