Nothing Special   »   [go: up one dir, main page]

CN116225823A - Method and device for collecting server logs - Google Patents

Method and device for collecting server logs Download PDF

Info

Publication number
CN116225823A
CN116225823A CN202211557932.7A CN202211557932A CN116225823A CN 116225823 A CN116225823 A CN 116225823A CN 202211557932 A CN202211557932 A CN 202211557932A CN 116225823 A CN116225823 A CN 116225823A
Authority
CN
China
Prior art keywords
test
log
target
log information
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211557932.7A
Other languages
Chinese (zh)
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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202211557932.7A priority Critical patent/CN116225823A/en
Publication of CN116225823A publication Critical patent/CN116225823A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • G06F11/3072Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • G06F11/3086Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves the use of self describing data formats, i.e. metadata, markup languages, human readable formats
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Library & Information Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a method and a device for collecting server logs, wherein the method comprises the following steps: responding to a test request for a target component in a target server, and determining test task information corresponding to the test request; determining candidate log information to be collected according to the test task; determining a test tool corresponding to the candidate log information, and constructing a test environment of the target component according to the test tool; in the test environment, testing the target component according to the test task information to generate a test log, wherein the test log comprises test results; and when the test result is that the test fails, determining target log information in the candidate log information according to the test log, and collecting the log according to the target log information. According to the embodiment of the invention, when the test fails, the log to be collected can be determined according to the test log in the test process, so that the log collection efficiency is improved.

Description

Method and device for collecting server logs
Technical Field
The present invention relates to the field of server testing technologies, and in particular, to a method and an apparatus for collecting server logs.
Background
At present, in the test and maintenance work of a server, the automatic test is commonly applied, and for testing single components, a plurality of components, an overall system, firmware, software and the like of the server, the automation of the test process can be realized by constructing software and hardware environments required by the test under the assistance of a series of developed automatic test scripts.
The automatic test is still imperfect in collecting test logs, the PASS or FAIL condition is tested for the same test task, or the collected log types of the automatic test are the same for different test tasks, so that the positioning and analysis of the test FAIL item are not facilitated, the environment reproduction and retest are still required to be carried out on the test task of the FAIL by a tester after the test is finished, so that the log information appointed by part of research and development personnel is collected, and the log collecting process wastes manpower and material resources and is unfavorable for the efficient performance of the automatic test.
Disclosure of Invention
In view of the above, a method and apparatus for server log collection is presented to overcome or at least partially address the above, including:
a method of server log collection, the method comprising:
Responding to a test request for a target component in a target server, and determining test task information corresponding to the test request;
determining candidate log information to be collected according to the test task;
determining a test tool corresponding to the candidate log information, and constructing a test environment of the target component according to the test tool;
in the test environment, testing the target component according to the test task information to generate a test log, wherein the test log comprises test results;
and when the test result is that the test fails, determining target log information in the candidate log information according to the test log, and collecting the log according to the target log information.
Optionally, the determining candidate log information to be collected according to the test task includes:
acquiring test configuration information aiming at the target server;
and determining candidate log information to be collected when testing the target component from the test configuration information according to the test task.
Optionally, the determining the test tool corresponding to the candidate log information includes:
determining an associated component of the target component;
And determining a testing tool corresponding to the candidate log information according to the target component and the association component.
Optionally, the candidate log information includes first-class log information and second-class log information, and when the test result is a test failure, determining target log information in the candidate log information according to the test log includes:
when the test result is that the test fails, respectively determining target log information in the first type log and the second type log information according to the test log;
and when the test result is that the test is successful, determining target information in the first type of log information.
Optionally, after the building of the test environment of the target component according to the test tool, the method further comprises:
and checking the test environment, and executing the test on the target component according to the test task information in the test environment under the condition that the test environment is checked successfully, so as to generate a test log.
Optionally, the determining, according to the target component and the association component, a test tool corresponding to the candidate log information includes:
Determining vendor information of the target component and the associated component;
and determining a testing tool corresponding to the candidate log information according to the manufacturer information.
Optionally, the method further comprises:
determining a fault processing scheme of the target server according to the collected target log information;
and carrying out fault processing on the target server according to the fault processing scheme.
An apparatus for server log collection, the apparatus comprising:
the test task information determining module is used for responding to a test request aiming at a target component in a target server and determining test task information corresponding to the test request;
the candidate log information determining module is used for determining candidate log information to be collected according to the test task;
the test environment construction module is used for determining a test tool corresponding to the candidate log information and constructing a test environment of the target component according to the test tool;
the test module is used for testing the target component according to the test task information in the test environment to generate a test log, and the test log comprises test results;
and the log collection module is used for determining target log information in the candidate log information according to the test log when the test result is test failure, and carrying out log collection according to the target log information.
A server comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor implements a method of server log collection as described above.
A computer readable storage medium having stored thereon a computer program which when executed by a processor implements a method of server log collection as described above.
The embodiment of the invention has the following advantages:
according to the embodiment of the invention, the test task information corresponding to the test request is determined in response to the test request for the target component in the target server, and further the candidate log information to be collected can be determined according to the test task, so that the test tool corresponding to the candidate log information is determined, the test environment of the target component is constructed according to the test tool, the target component is tested according to the test task information in the test environment, the test log is generated, the test log comprises a test result, when the test result is a test failure, the target log information is determined in the candidate log information according to the test log, and the log collection is carried out according to the target log information, so that the log collection efficiency in the case of test failure is improved.
Drawings
In order to more clearly illustrate the technical solutions of the present invention, the drawings that are needed in the description of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flowchart illustrating a method for collecting logs of a server according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of another method for server log collection according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of another method for server log collection according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating steps of another method for server log collection according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus for collecting server logs according to an embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description. It will be apparent that the described embodiments are some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flowchart illustrating steps of a method for collecting logs of a server according to an embodiment of the present invention may specifically include the following steps:
step 101, responding to a test request for a target component in a target server, and determining test task information corresponding to the test request;
the normal operation of the server depends on the cooperation of the components of the server, and in practical application, to avoid server faults, tests can be performed on single components, multiple components, an overall system, firmware, software and the like of the server.
Wherein the test task may be a necessary test item for the target component.
In the process of testing the components by the server, when the test system receives a test request for a target component in the target server, the test request can be responded, and the information such as the target server, the target component and the test task aimed in the test request can be determined.
In an example, the test request may be a request sent by a user when the test system selects the target server and the target component to perform a test, or may be a request preset in the test system and automatically generated when the test is performed on the target server and the target component periodically, or may be based on other preset events that may trigger the test on the target server and the target component.
Step 102, determining candidate log information to be collected according to the test task;
after determining the test task, candidate log information corresponding to the test task can be determined based on the corresponding relation between the test task and the log.
The candidate log information may be divided into first-type log information and second-type log information. The first type of log information bit is conventional log information that must be collected after the test is completed, such as baseboard management controller (Baseboard Management Controller, BMC) log, system log, and test procedure log; the second type of log information is special log information that needs to be collected when the test fails, and is log information that can be used for performing fault location for the test task, for example, a sosreport log of an Operating System (OS), a raid card log, a hard disk log, and the like.
Step 103, determining a test tool corresponding to the candidate log information, and constructing a test environment of the target component according to the test tool;
the test tool may include, among other things, a test script, a test command, or a test method.
When different candidate log information is collected, corresponding test environments are required to be built in a test system, so that test tools corresponding to each type of candidate log information to be collected can be determined according to the candidate log information, and then the test tools are installed in the test system to build the test environments of target components in the test system, wherein the test environments can realize automatic test on the target components.
104, in the test environment, testing the target component according to the test task information to generate a test log, wherein the test log comprises test results;
after the test environment is built in the test system, the target component can be tested in the test environment, specific test items are determined by test tasks, after the test is completed, a test log can be generated according to the whole test process, and the test log can also comprise the test result of each specific test item.
When the test results of all the test items in the test task are successful, determining that the test of the target component is successful; and when the test item with the test result being the test failure exists in the test task, determining that the test of the target component fails.
And 105, determining target log information in the candidate log information according to the test log when the test result is test failure, and collecting the log according to the target log information.
When the test result of the target component fails, candidate log information can be screened according to the test log, target log information to be collected can be further determined, the target log information can be used for rapidly positioning the reason of the test failure, further log collection can be carried out according to the target log information, the test scene does not need to be repeated or retested, and the efficiency of log collection is improved. A step of
After the automatic test task is completed, a tester can analyze and position the root cause of the test fail or submit the log to a research and development personnel for analysis and solution through the log collected by using an intelligent log collection method in the automatic test process.
According to the embodiment of the invention, the test task information corresponding to the test request is determined in response to the test request for the target component in the target server, and further the candidate log information to be collected can be determined according to the test task, so that the test tool corresponding to the candidate log information is determined, the test environment of the target component is constructed according to the test tool, the target component is tested according to the test task information in the test environment, the test log is generated, the test log comprises a test result, when the test result is a test failure, the target log information is determined in the candidate log information according to the test log, and the log collection is carried out according to the target log information, so that the log collection efficiency in the case of test failure is improved.
Referring to fig. 2, a flowchart illustrating steps of another method for collecting logs of a server according to an embodiment of the present invention may specifically include the following steps:
Step 201, responding to a test request for a target component in a target server, and determining test task information corresponding to the test request;
the normal operation of the server depends on the cooperation of the components of the server, and in practical application, to avoid server faults, tests can be performed on single components, multiple components, an overall system, firmware, software and the like of the server.
Wherein the test task may be a necessary test item for the target component.
In the process of testing the components by the server, when the test system receives a test request for a target component in the target server, the test request can be responded, and the information such as the target server, the target component and the test task aimed in the test request can be determined.
In an example, the test request may be a request sent by a user when the test system selects the target server and the target component to perform a test, or may be a request preset in the test system and automatically generated when the test is performed on the target server and the target component periodically, or may be based on other preset events that may trigger the test on the target server and the target component.
Step 202, obtaining test configuration information for the target server;
In the test process of the server on the component, test configuration information for testing the target server can be configured in the test system in advance.
The test configuration information may include log information to be collected corresponding to different test tasks for different components, vendor information of the target component and the associated component, a test tool, and the like.
And 203, determining candidate log information to be collected when testing the target component from the test configuration information according to the test task.
The corresponding relation between the test task and the log is stored in the test configuration information, so that the test task can be matched in the test configuration information according to the test task, and candidate log information corresponding to the test task can be determined.
The candidate log information may be divided into first-type log information and second-type log information. The first type of log information bit is conventional log information that must be collected after the test is completed, such as baseboard management controller (Baseboard Management Controller, BMC) log, system log, and test procedure log; the second type of log information is special log information that needs to be collected when the test fails, and is log information that can be used for performing fault location for the test task, for example, a sosreport log of an Operating System (OS), a raid card log, a hard disk log, and the like.
Step 204, determining a test tool corresponding to the candidate log information, and constructing a test environment of the target component according to the test tool;
the test tool may include, among other things, a test script, a test command, or a test method.
When different candidate log information is collected, corresponding test environments are required to be built in a test system, so that test tools corresponding to each type of candidate log information to be collected can be determined according to the candidate log information, and then the test tools are installed in the test system to build the test environments of target components in the test system, wherein the test environments can realize automatic test on the target components.
Step 205, in the test environment, testing the target component according to the test task information, and generating a test log, wherein the test log comprises a test result;
after the test environment is built in the test system, the target component can be tested in the test environment, specific test items are determined by test tasks, after the test is completed, a test log can be generated according to the whole test process, and the test log can also comprise the test result of each specific test item.
When the test results of all the test items in the test task are successful, determining that the test of the target component is successful; and when the test item with the test result being the test failure exists in the test task, determining that the test of the target component fails.
And 206, determining target log information in the candidate log information according to the test log when the test result is test failure, and collecting the log according to the target log information.
When the test result of the target component fails, candidate log information can be screened according to the test log, target log information to be collected can be further determined, the target log information can be used for rapidly positioning the reason of the test failure, further log collection can be carried out according to the target log information, the test scene does not need to be repeated or retested, and the efficiency of log collection is improved.
According to the embodiment of the invention, the test task information corresponding to the test request is determined in response to the test request for the target component in the target server, so that the test configuration information for the target server can be obtained, the candidate log information to be collected when the target component is tested is determined from the test configuration information according to the test task, so that the test tool corresponding to the candidate log information is determined, the test environment of the target component is constructed according to the test tool, the target component is tested according to the test task information in the test environment, the test log is generated, the test log comprises a test result, when the test result is test failure, the target log information is determined in the candidate log information according to the test log, and log collection is carried out according to the target log information, so that the log collection efficiency when the test failure is improved is realized.
Referring to fig. 3, a flowchart illustrating steps of another method for collecting logs of a server according to an embodiment of the present invention may specifically include the following steps:
step 301, responding to a test request for a target component in a target server, and determining test task information corresponding to the test request;
the normal operation of the server depends on the cooperation of the components of the server, and in practical application, to avoid server faults, tests can be performed on single components, multiple components, an overall system, firmware, software and the like of the server.
Wherein the test task may be a necessary test item for the target component.
In the process of testing the components by the server, when the test system receives a test request for a target component in the target server, the test request can be responded, and the information such as the target server, the target component and the test task aimed in the test request can be determined.
In an example, the test request may be a request sent by a user when the test system selects the target server and the target component to perform a test, or may be a request preset in the test system and automatically generated when the test is performed on the target server and the target component periodically, or may be based on other preset events that may trigger the test on the target server and the target component.
Step 302, obtaining test configuration information for the target server;
in the test process of the server on the component, test configuration information for testing the target server can be configured in the test system in advance.
The test configuration information may include log information to be collected corresponding to different test tasks for different components, vendor information of the target component and the associated component, a test tool, and the like.
And step 303, determining candidate log information to be collected when testing the target component from the test configuration information according to the test task.
The corresponding relation between the test task and the log is stored in the test configuration information, so that the test task can be matched in the test configuration information according to the test task, and candidate log information corresponding to the test task can be determined.
The candidate log information may be divided into first-type log information and second-type log information. The first type of log information bit is conventional log information that must be collected after the test is completed, such as baseboard management controller (Baseboard Management Controller, BMC) log, system log, and test procedure log; the second type of log information is special log information that needs to be collected when the test fails, and is log information that can be used for performing fault location for the test task, for example, a sosreport log of an Operating System (OS), a raid card log, a hard disk log, and the like.
Step 304, determining an associated component of the target component;
in the target server, the parts and the cooperation of the parts can enable the server to normally operate, so that the parts and the parts of the target server do not exist independently, a test item for the target part is included in the test process, a test item for the target part and the part to be disassociated are included in the test process, and in the test process, the associated part of the target part can be determined according to test configuration information stored in the test system in advance.
Step 305, determining a test tool corresponding to the candidate log information according to the target component and the associated component, and constructing a test environment of the target component according to the test tool;
the test tool may include, among other things, a test script, a test command, or a test method.
When the candidate log information to be collected is provided with a plurality of test tools, the test tools corresponding to each candidate log information can be determined by combining the target part to be tested and the associated part, and then the test tools are installed in the test system to construct the test environment of the target part in the test system, wherein the test environment can realize automatic test of the target part.
Step 306, in the test environment, testing the target component according to the test task information, and generating a test log, wherein the test log comprises test results;
after the test environment is built in the test system, the target component can be tested in the test environment, specific test items are determined by test tasks, after the test is completed, a test log can be generated according to the whole test process, and the test log can also comprise the test result of each specific test item.
When the test results of all the test items in the test task are successful, determining that the test of the target component is successful; and when the test item with the test result being the test failure exists in the test task, determining that the test of the target component fails.
Step 307, when the test result is that the test fails, determining target log information in the candidate log information according to the test log, and collecting the log according to the target log information.
When the test result of the target component fails, candidate log information can be screened according to the test log, target log information to be collected can be further determined, the target log information can be used for rapidly positioning the reason of the test failure, further log collection can be carried out according to the target log information, the test scene does not need to be repeated or retested, and the efficiency of log collection is improved.
According to the embodiment of the invention, the test task information corresponding to the test request is determined in response to the test request for the target component in the target server, so that the test configuration information for the target server can be obtained, the candidate log information to be collected for the target component in the test is determined from the test configuration information according to the test task, the associated component of the target component is determined, the test tool corresponding to the candidate log information is determined according to the target component and the associated component, the test environment of the target component is constructed according to the test tool, the target component is tested according to the test task information in the test environment, the test log is generated, the test log comprises a test result, and when the test result is a test failure, the target log information is determined in the candidate log information according to the test log, and the log is collected according to the target log information, so that the log collection efficiency in the test failure is improved.
When the test result of the target component fails, candidate log information can be screened according to the test log, target log information to be collected can be further determined, the target log information can be used for rapidly positioning the reason of the test failure, further log collection can be carried out according to the target log information, the test scene does not need to be repeated or retested, and the efficiency of log collection is improved.
Referring to fig. 4, a flowchart illustrating steps of another method for collecting logs of a server according to an embodiment of the present invention may specifically include the following steps:
step 401, responding to a test request for a target component in a target server, and determining test task information corresponding to the test request;
the normal operation of the server depends on the cooperation of the components of the server, and in practical application, to avoid server faults, tests can be performed on single components, multiple components, an overall system, firmware, software and the like of the server.
Wherein the test task may be a necessary test item for the target component.
In the process of testing the components by the server, when the test system receives a test request for a target component in the target server, the test request can be responded, and the information such as the target server, the target component and the test task aimed in the test request can be determined.
In an example, the test request may be a request sent by a user when the test system selects the target server and the target component to perform a test, or may be a request preset in the test system and automatically generated when the test is performed on the target server and the target component periodically, or may be based on other preset events that may trigger the test on the target server and the target component.
Step 402, obtaining test configuration information for the target server;
in the test process of the server on the component, test configuration information for testing the target server can be configured in the test system in advance.
The test configuration information may include log information to be collected corresponding to different test tasks for different components, vendor information of the target component and the associated component, a test tool, and the like.
Step 403, determining candidate log information to be collected when testing the target component from the test configuration information according to the test task, wherein the candidate log information comprises first-type log information and second-type log information.
The corresponding relation between the test task and the log is stored in the test configuration information, so that the test task can be matched in the test configuration information according to the test task, and candidate log information corresponding to the test task can be determined.
The candidate log information may be divided into first-type log information and second-type log information. The first type of log information bit is conventional log information that must be collected after the test is completed, such as baseboard management controller (Baseboard Management Controller, BMC) log, system log, and test procedure log; the second type of log information is special log information that needs to be collected when the test fails, and is log information that can be used for performing fault location for the test task, for example, a sosreport log of an Operating System (OS), a raid card log, a hard disk log, and the like.
Step 404, determining an association part of the target component, and determining vendor information of the target component and the association component;
in the target server, the parts and the cooperation of the parts can enable the server to normally operate, so that the parts and the parts of the target server do not exist independently, a test item for the target part is included in the test process, a test item for the target part and the part to be disassociated are included in the test process, and in the test process, the associated part of the target part can be determined according to test configuration information stored in the test system in advance.
The different components can be generated by different manufacturers, and the components generated by different manufacturers have differences in test, and the adaptive test environments can also have differences, so that after the target component and the associated component are determined, vendor information corresponding to the target component and the associated component can be further determined in test configuration information stored in the test system in advance.
Step 405, determining a test tool corresponding to the candidate log information according to the vendor information, and constructing a test environment of the target component according to the test tool;
The test tool may include, among other things, a test script, a test command, or a test method.
According to the method, corresponding test environments are required to be built in a test system when different candidate log information is collected, and test tools for collecting the candidate log information by different target components and associated components are also different, so that when a plurality of test tools exist in the candidate log information to be collected, the test tools corresponding to each candidate log information can be determined by combining the target components to be tested and the associated components, and specifically, the test tools corresponding to each candidate log information can be determined according to manufacturer information corresponding to the target components and the associated components.
And installing a test tool in the test system to construct a test environment of the target component in the test system, wherein the test environment can realize automatic test of the target component and collect log information of the response.
Step 406, checking the test environment;
after the test environment is built in the test system, to ensure that the target component is tested normally, a check can be performed against the test environment to determine that the test environment is available and valid.
Step 407 is executed when the test environment check is successful, and the test environment is adjusted until the test environment check is successful when the test environment check is failed.
Step 407, testing the target component according to the test task information in the test environment under the condition that the test environment is successfully verified, and generating a test log, wherein the test log comprises test results;
under the condition that the test environment is successfully checked, the test is executed on the target component according to the test task, the specific test items are determined by the test task, after the test is completed, a test log can be generated according to the whole test process, and the test result of each specific test item can be also included in the test log.
When the test results of all the test items in the test task are successful, determining that the test of the target component is successful; and when the test item with the test result being the test failure exists in the test task, determining that the test of the target component fails.
Step 408, when the test result is that the test fails, determining target log information in the first type log and the second type log information according to the test log;
when the test result of the target component fails, the first type of log information and the second type of log information can be screened according to the test log, the target log information to be collected can be further determined, the target log information can be used for rapidly positioning the reason of the test failure, further log collection can be carried out according to the target log information, the test scene does not need to be repeated or retested, and the efficiency of log collection is improved.
Specifically, the second type log information may be screened, the target second type log information is determined, and the target second type log information and the first type log information are determined as target log information, so as to perform log collection according to the target log information.
And 409, determining target log information in the first type of log information when the test result is that the test is successful.
And under the condition of successful test, determining that the target component has no fault, further determining the first type of log information into target log information, performing conventional collection, and ending the automatic test after log collection is completed.
Step 410, determining a fault handling scheme of the target server according to the collected target log information;
in the event of a test failure, the target component may fail, so that the collected target log information for the event of a test failure may be further subjected to fault analysis to determine a fault handling scheme of the server.
Specifically, a fault database can be established in the test system, historical fault processing data, a fault processing scheme preset by an expert and the like are stored in the fault database, keywords can be extracted according to target log information, matching is performed in the fault database according to the keywords, and the fault processing scheme of the target server is determined.
And 411, performing fault processing on the target server according to the fault processing scheme.
After determining the failure handling scheme, the failure handling may be performed according to the failure handling scheme to eliminate the failure of the target server, so that the target server may operate normally.
According to the embodiment of the invention, the test task information corresponding to the test request is determined in response to the test request for the target component in the target server, so that the test configuration information for the target server can be obtained, the candidate log information to be collected when the target component is tested is determined from the test configuration information according to the test task, the relevant component of the target component and the manufacturer information of the relevant component are determined, so that the test tool corresponding to the candidate log information can be determined according to the manufacturer information, the test environment of the target component is constructed according to the test tool, the test environment is verified, under the condition that the test environment is verified successfully, the target component is tested according to the test task information in the test environment, a test log is generated, the test log comprises a test result, and when the test result is test failure, the target log information is respectively determined in the first type log information and the second type log information according to the test log; when the test result is that the test is successful, determining target information in the first type of log information, collecting logs according to the target log information, determining a fault processing scheme of the target server according to the collected target log information, and performing fault processing on the target server according to the fault processing scheme, so that the collection efficiency of the logs in the test process of the server component is improved, and meanwhile, under the condition that the test fails, the fault processing can be automatically performed, and the processing efficiency is improved.
It should be noted that, for simplicity of description, the method embodiments are depicted as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 5, a schematic structural diagram of a server log collection apparatus according to an embodiment of the present invention may specifically include the following modules:
a test task information determining module 501, configured to determine test task information corresponding to a test request for a target component in a target server in response to the test request;
a candidate log information determining module 502, configured to determine candidate log information to be collected according to the test task;
a test environment construction module 503, configured to determine a test tool corresponding to the candidate log information, and construct a test environment of the target component according to the test tool;
The test module 504 is configured to test the target component according to the test task information in the test environment, and generate a test log, where the test log includes a test result;
and the log collection module 505 is configured to determine target log information from the candidate log information according to the test log when the test result is a test failure, and perform log collection according to the target log information.
In an embodiment of the present invention, the candidate log information determining module 502 may include:
the test configuration information acquisition sub-module is used for acquiring test configuration information aiming at the target server;
and the candidate log information determining submodule is used for determining candidate log information to be collected when the target component is tested according to the test task from the test configuration information.
In an embodiment of the present invention, the test environment construction module 503 may include:
an associated component determination sub-module for determining an associated component of the target component;
and the test tool determination submodule is used for determining the test tool corresponding to the candidate log information according to the target component and the association component.
In an embodiment of the present invention, the candidate log information includes a first type of log information and a second type of log information, and the log collecting module 505 includes:
the test failure sub-module is used for respectively determining target log information in the first type log and the second type log information according to the test log when the test result is test failure;
and the test success sub-module is used for determining target information in the first type of log information when the test result is that the test is successful.
In an embodiment of the invention, the apparatus further comprises:
and the test environment verification module is used for verifying the test environment, and executing the test on the target component according to the test task information in the test environment under the condition that the test environment is successfully verified, so as to generate a test log.
In one embodiment of the present invention, the test tool determination sub-module may include:
a vendor information determining unit configured to determine vendor information of the target component and the associated component;
and the test tool determining unit is used for determining the test tool corresponding to the candidate log information according to the manufacturer information.
In an embodiment of the invention, the apparatus further comprises:
the fault processing scheme determining module is used for determining a fault processing scheme of the target server according to the collected target log information;
and the fault processing module is used for carrying out fault processing on the target server according to the fault processing scheme.
An embodiment of the present invention also provides a server, which may include a processor, a memory, and a computer program stored on the memory and capable of running on the processor, where the computer program when executed by the processor implements a method for collecting logs from the server as above.
An embodiment of the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for server log collection as above.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of 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, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, 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.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The foregoing has outlined rather broadly the more detailed description of a method and apparatus for server log collection that uses specific examples to illustrate the principles and embodiments of the present invention, the description of the examples above being provided solely to facilitate the understanding of the method and core concepts of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (10)

1. A method of server log collection, the method comprising:
responding to a test request for a target component in a target server, and determining test task information corresponding to the test request;
determining candidate log information to be collected according to the test task;
determining a test tool corresponding to the candidate log information, and constructing a test environment of the target component according to the test tool;
in the test environment, testing the target component according to the test task information to generate a test log, wherein the test log comprises test results;
and when the test result is that the test fails, determining target log information in the candidate log information according to the test log, and collecting the log according to the target log information.
2. The method of claim 1, wherein the determining candidate log information to be collected from the test task comprises:
acquiring test configuration information aiming at the target server;
and determining candidate log information to be collected when testing the target component from the test configuration information according to the test task.
3. The method of claim 1, wherein the determining the test tool to which the candidate log information corresponds comprises:
determining an associated component of the target component;
and determining a testing tool corresponding to the candidate log information according to the target component and the association component.
4. The method according to claim 1, wherein the candidate log information includes a first type of log information and a second type of log information, and the determining target log information in the candidate log information according to the test log when the test result is a test failure includes:
when the test result is that the test fails, respectively determining target log information in the first type log and the second type log information according to the test log;
and when the test result is that the test is successful, determining target log information in the first type of log information.
5. The method of claim 1, wherein after said building a test environment for said target component according to said test tool, said method further comprises:
and checking the test environment, and executing the test on the target component according to the test task information in the test environment under the condition that the test environment is checked successfully, so as to generate a test log.
6. A method according to claim 3, wherein said determining a test tool corresponding to said candidate log information from said target component and said associated component comprises:
determining vendor information of the target component and the associated component;
and determining a testing tool corresponding to the candidate log information according to the manufacturer information.
7. The method as recited in claim 1, further comprising:
determining a fault processing scheme of the target server according to the collected target log information;
and carrying out fault processing on the target server according to the fault processing scheme.
8. An apparatus for server log collection, the apparatus comprising:
the test task information determining module is used for responding to a test request aiming at a target component in a target server and determining test task information corresponding to the test request;
the candidate log information determining module is used for determining candidate log information to be collected according to the test task;
the test environment construction module is used for determining a test tool corresponding to the candidate log information and constructing a test environment of the target component according to the test tool;
The test module is used for testing the target component according to the test task information in the test environment to generate a test log, and the test log comprises test results;
and the log collection module is used for determining target log information in the candidate log information according to the test log when the test result is test failure, and carrying out log collection according to the target log information.
9. A server comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program when executed by the processor implementing a method of server log collection as claimed in any one of claims 1 to 7.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements a method of server log collection according to any of claims 1 to 7.
CN202211557932.7A 2022-12-06 2022-12-06 Method and device for collecting server logs Pending CN116225823A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211557932.7A CN116225823A (en) 2022-12-06 2022-12-06 Method and device for collecting server logs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211557932.7A CN116225823A (en) 2022-12-06 2022-12-06 Method and device for collecting server logs

Publications (1)

Publication Number Publication Date
CN116225823A true CN116225823A (en) 2023-06-06

Family

ID=86581294

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211557932.7A Pending CN116225823A (en) 2022-12-06 2022-12-06 Method and device for collecting server logs

Country Status (1)

Country Link
CN (1) CN116225823A (en)

Similar Documents

Publication Publication Date Title
US20140372989A1 (en) Identification of a failed code change
CN110058998B (en) Software testing method and device
CN106970880A (en) A kind of distributed automatization method for testing software and system
EP2113874A1 (en) Method and system for monitoring computer-implemented processes
US8327189B1 (en) Diagnosing an incident on a computer system using a diagnostics analyzer database
CN112631841A (en) Method, system and medium for cyclic aging test and data collection
US20100251029A1 (en) Implementing self-optimizing ipl diagnostic mode
CN115114064B (en) Micro-service fault analysis method, system, equipment and storage medium
KR20110025171A (en) Method system and computer program for identifying software problems
CN116383090B (en) Automatic testing method and platform for kylin system migration tool
US10826764B2 (en) Dynamic server allocation for automated server builds
CN116225823A (en) Method and device for collecting server logs
CN114937316B (en) Software fault detection method, device, equipment and medium
CN113282496B (en) Automatic interface testing method, device, equipment and storage medium
CN115269443A (en) Software defect automatic positioning test method and system
CN112214409B (en) Operation and maintenance method and device used in test environment
CN112231202A (en) Automatic Bug lifting method based on log monitoring and monitored module monitoring
CN112597030B (en) Task release method and device, execution method and device and system
JPH09265415A (en) Abnormality diagnostic method and abnormality diagnostic device
CN118245385B (en) Test method, test platform, equipment, medium and product
CN113127884B (en) Vulnerability parallel verification method and device based on virtualization
CN112631868B (en) Performance monitoring method and device of CentOS system
CN117421202A (en) Code processing method, system, device and medium
CN115617644A (en) Test result collection and analysis method and device and log server
Tadano et al. Automatic synthesis of SRN models from system operation templates for availability analysis

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