CN112463742A - System log processing method, system, terminal and storage medium - Google Patents

System log processing method, system, terminal and storage medium Download PDF

Info

Publication number
CN112463742A
CN112463742A CN202011417720.XA CN202011417720A CN112463742A CN 112463742 A CN112463742 A CN 112463742A CN 202011417720 A CN202011417720 A CN 202011417720A CN 112463742 A CN112463742 A CN 112463742A
Authority
CN
China
Prior art keywords
script
log
current
path
type
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.)
Withdrawn
Application number
CN202011417720.XA
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 CN202011417720.XA priority Critical patent/CN112463742A/en
Publication of CN112463742A publication Critical patent/CN112463742A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Landscapes

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

Abstract

The invention provides a system log processing method, a system, a terminal and a storage medium, comprising the following steps: storing default storage paths of system logs corresponding to various operating systems in a script in advance; identifying a current operating system type using the script; the script queries a default storage path of a system log corresponding to the current operating system type, and takes the queried storage path as a target path; and calling the current system log according to the target path. The invention realizes the automatic collection of the system log of the current server and processes the collected system log by pre-configuring the default storage path of the system log of various operating systems and automatically identifying the current operating system. The invention can automatically collect the system logs and improve the collection efficiency of the system logs.

Description

System log processing method, system, terminal and storage medium
Technical Field
The invention relates to the technical field of servers, in particular to a system log processing method, a system, a terminal and a storage medium.
Background
The cloud storage trend has had an impact on the consumption of servers, as has the growth of so-called super-large-scale computing companies. Despite such changes, the global server market continues to exhibit a strong trend in its entirety, and server market layouts are becoming larger and larger.
The system log deleting and collecting work is often involved in a server production testing link and a client using link, and a system installed in a server is mainly based on a Linux or Linux-like system, for example, the system log storing forms of an Ubuntu system and a Linux system are greatly different, so that if the system logs of the Ubuntu system and the Linux system are to be collected, technicians need to know the type of the system in the first step and then can copy the system logs under corresponding system directories, and the process is complicated.
Disclosure of Invention
In view of the above-mentioned deficiencies of the prior art, the present invention provides a method, a system, a terminal and a storage medium for processing system logs, so as to solve the above-mentioned technical problems.
In a first aspect, the present invention provides a system log processing method, including:
storing default storage paths of system logs corresponding to various operating systems in a script in advance;
identifying a current operating system type using the script;
the script queries a default storage path of a system log corresponding to the current operating system type, and takes the queried storage path as a target path;
and calling the current system log according to the target path.
Further, the identifying the current operating system type by using the script includes:
storing a system identification storage path and system identifications of various operating systems in the script in advance;
executing the script to call an actual system identifier from the system identifier storage path;
and acquiring the type of the current operating system according to the actual system identifier.
Further, the invoking processing of the current system log according to the target path includes:
configuring a log saving address in the script in advance, wherein the script saves the current system log to the log saving address;
and deleting the current system log under the target path by the script according to the deleting instruction.
In a second aspect, the present invention provides a system log processing system, including:
the script configuration unit is used for storing default storage paths of system logs corresponding to various operating systems in a script in advance;
the system identification unit is configured to identify the type of the current operating system by using the script;
the path query unit is configured to query a default storage path of a system log corresponding to the current operating system type by the script and take the queried storage path as a target path;
and the log processing unit is configured to call and process the current system log according to the target path.
Further, the system identification unit includes:
the identification configuration module is used for storing a system identification storage path and system identifications of various operating systems in the script in advance;
the identification calling module is configured to execute the script and call the actual system identification from the system identification storage path;
and the type identification module is configured to acquire the type of the current operating system according to the actual system identifier.
Further, the log processing unit includes:
the log saving module is configured to pre-configure a log saving address in the script, and the script saves the current system log to the log saving address;
and the log deleting module is configured for deleting the current system log under the target path according to the deleting instruction by the script.
In a third aspect, a terminal is provided, including:
a processor, a memory, wherein,
the memory is used for storing a computer program which,
the processor is used for calling and running the computer program from the memory so as to make the terminal execute the method of the terminal.
In a fourth aspect, a computer storage medium is provided having stored therein instructions that, when executed on a computer, cause the computer to perform the method of the above aspects.
The beneficial effect of the invention is that,
the system log processing method, the system, the terminal and the storage medium provided by the invention realize automatic collection of the system log of the current server and process the collected system log by pre-configuring the default storage path of the system log of various operating systems and automatically identifying the current operating system. The invention can automatically collect the system logs and improve the collection efficiency of the system logs.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a schematic flow diagram of a method of one embodiment of the invention.
FIG. 2 is a schematic block diagram of a system of one embodiment of the present invention.
Fig. 3 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. 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.
FIG. 1 is a schematic flow diagram of a method of one embodiment of the invention. The execution subject in fig. 1 may be a system log processing system.
As shown in fig. 1, the method includes:
step 110, storing default storage paths of system logs corresponding to various operating systems in a script in advance;
step 120, identifying the type of the current operating system by using the script;
step 130, the script queries a default storage path of a system log corresponding to the current operating system type, and takes the queried storage path as a target path;
and step 140, calling the current system log according to the target path.
Specifically, the system log processing method includes:
s1, storing the default storage path of the system log corresponding to each operating system in the script in advance.
Default storage paths of system logs corresponding to various operating systems are configured in a script in advance, and the operating system types in this embodiment include Ubuntu, reddat, centros, and suse.
And S2, identifying the current operating system type by using the script.
The system-identified save path "/etc/os-release" directory is saved in the script in advance. The script collects the system identification of the current system in the directory, and the type of the current operating system can be identified according to the collected system identification.
And S3, the script queries the default storage path of the system log corresponding to the current operating system type, and takes the queried storage path as a target path.
According to the current os type obtained in step S2 and the default storage path of the system log corresponding to each os type configured in the script, the system log storage path of the current os can be obtained, and this path is used as the target path.
And S4, calling the current system log according to the target path.
The processing in this embodiment includes save as processing and purge processing:
and additionally, copying the system log under the target path to the specified path for processing.
The purge process includes:
for example: sh-cl/home/handlesyslog means that the system log file under copy to/home is cleared
For example: adding no path to express and remove the text in the system file under the system/var/log, and not deleting the file
The system log comprises:
ubuntu:syslog、self.log
redhat、centos、suse:dmesg、messages、mcelog、self.log
as shown in fig. 2, the system 200 includes:
a script configuration unit 210 configured to store default storage paths of system logs corresponding to various operating systems in a script in advance;
a system identification unit 220 configured to identify a current operating system type using the script;
a path query unit 230 configured to query a default storage path of a system log corresponding to the current operating system type by the script, and take the queried storage path as a target path;
and the log processing unit 240 is configured to perform call processing on the current system log according to the target path.
Optionally, as an embodiment of the present invention, the system identification unit includes:
the identification configuration module is used for storing a system identification storage path and system identifications of various operating systems in the script in advance;
the identification calling module is configured to execute the script and call the actual system identification from the system identification storage path;
and the type identification module is configured to acquire the type of the current operating system according to the actual system identifier.
Optionally, as an embodiment of the present invention, the log processing unit includes:
the log saving module is configured to pre-configure a log saving address in the script, and the script saves the current system log to the log saving address;
and the log deleting module is configured for deleting the current system log under the target path according to the deleting instruction by the script.
Fig. 3 is a schematic structural diagram of a terminal 300 according to an embodiment of the present invention, where the terminal 300 may be used to execute the method for processing the system log according to the embodiment of the present invention.
Among them, the terminal 300 may include: a processor 310, a memory 320, and a communication unit 330. The components communicate via one or more buses, and those skilled in the art will appreciate that the architecture of the servers shown in the figures is not intended to be limiting, and may be a bus architecture, a star architecture, a combination of more or less components than those shown, or a different arrangement of components.
The memory 320 may be used for storing instructions executed by the processor 310, and the memory 320 may be implemented by any type of volatile or non-volatile storage terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The executable instructions in memory 320, when executed by processor 310, enable terminal 300 to perform some or all of the steps in the method embodiments described below.
The processor 310 is a control center of the storage terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and performs various functions of the electronic terminal and/or processes data by operating or executing software programs and/or modules stored in the memory 320 and calling data stored in the memory. The processor may be composed of an Integrated Circuit (IC), for example, a single packaged IC, or a plurality of packaged ICs connected with the same or different functions. For example, the processor 310 may include only a Central Processing Unit (CPU). In the embodiment of the present invention, the CPU may be a single operation core, or may include multiple operation cores.
A communication unit 330, configured to establish a communication channel so that the storage terminal can communicate with other terminals. And receiving user data sent by other terminals or sending the user data to other terminals.
The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, and the program may include some or all of the steps in the embodiments provided by the present invention when executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Therefore, the invention realizes the automatic collection of the system log of the current server and processes the collected system log by pre-configuring the default storage path of the system log of various operating systems and automatically identifying the current operating system. The invention can automatically collect the system logs, and improves the system log collection efficiency, and the technical effects achieved by the embodiment can be seen in the description above, which is not repeated herein.
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be embodied in the form of a software product, where the computer software product is stored in a storage medium, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like, and the storage medium can store program codes, and includes instructions for enabling a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, and the like) to perform all or part of the steps of the method in the embodiments of the present invention.
The same and similar parts in the various embodiments in this specification may be referred to each other. Especially, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant points can be referred to the description in the method embodiment.
In the embodiments provided in the present invention, it should be understood that the disclosed system and method can be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the units is only one logical functional division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, systems or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
Although the present invention has been described in detail by referring to the drawings in connection with the preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made on the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and these modifications or substitutions are within the scope of the present invention/any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A system log processing method, comprising:
storing default storage paths of system logs corresponding to various operating systems in a script in advance;
identifying a current operating system type using the script;
the script queries a default storage path of a system log corresponding to the current operating system type, and takes the queried storage path as a target path;
and calling the current system log according to the target path.
2. The method of claim 1, wherein identifying a current operating system type using a script comprises:
storing a system identification storage path and system identifications of various operating systems in the script in advance;
executing the script to call an actual system identifier from the system identifier storage path;
and acquiring the type of the current operating system according to the actual system identifier.
3. The method of claim 1, wherein the calling the current system log according to the target path comprises:
configuring a log saving address in the script in advance, wherein the script saves the current system log to the log saving address;
and deleting the current system log under the target path by the script according to the deleting instruction.
4. A system log processing system, comprising:
the script configuration unit is used for storing default storage paths of system logs corresponding to various operating systems in a script in advance;
the system identification unit is configured to identify the type of the current operating system by using the script;
the path query unit is configured to query a default storage path of a system log corresponding to the current operating system type by the script and take the queried storage path as a target path;
and the log processing unit is configured to call and process the current system log according to the target path.
5. The system according to claim 4, wherein the system identification unit comprises:
the identification configuration module is used for storing a system identification storage path and system identifications of various operating systems in the script in advance;
the identification calling module is configured to execute the script and call the actual system identification from the system identification storage path;
and the type identification module is configured to acquire the type of the current operating system according to the actual system identifier.
6. The system of claim 4, wherein the log processing unit comprises:
the log saving module is configured to pre-configure a log saving address in the script, and the script saves the current system log to the log saving address;
and the log deleting module is configured for deleting the current system log under the target path according to the deleting instruction by the script.
7. A terminal, comprising:
a processor;
a memory for storing instructions for execution by the processor;
wherein the processor is configured to perform the method of any one of claims 1-3.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-3.
CN202011417720.XA 2020-12-07 2020-12-07 System log processing method, system, terminal and storage medium Withdrawn CN112463742A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011417720.XA CN112463742A (en) 2020-12-07 2020-12-07 System log processing method, system, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011417720.XA CN112463742A (en) 2020-12-07 2020-12-07 System log processing method, system, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN112463742A true CN112463742A (en) 2021-03-09

Family

ID=74801501

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011417720.XA Withdrawn CN112463742A (en) 2020-12-07 2020-12-07 System log processing method, system, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN112463742A (en)

Similar Documents

Publication Publication Date Title
US20170005858A1 (en) Log processing method and client
CN110554938B (en) BIOS (basic input output System) testing method, system, terminal and storage medium based on script set
CN112230847B (en) Method, system, terminal and storage medium for monitoring K8s storage volume
CN111262753B (en) Method, system, terminal and storage medium for automatically configuring number of NUMA nodes
CN114448972A (en) Distributed storage log compression downloading method, system, terminal and storage medium
CN108459960A (en) Method of automatic configuration, device, equipment and the storage medium of test environment
CN112003730A (en) Method, system, terminal and storage medium for rapid cluster deployment
CN113076231A (en) Server application scene setting method, system, terminal and storage medium
CN111966682A (en) White list protection matching method, system, terminal and storage medium
CN109992420B (en) Parallel PCIE-SSD performance optimization method and system
CN112214384A (en) Hard disk serial number management method, system, terminal and storage medium
CN112187509A (en) Multi-architecture cloud platform execution log management method, system, terminal and storage medium
CN109558300B (en) Whole cabinet alarm processing method and device, terminal and storage medium
CN112463742A (en) System log processing method, system, terminal and storage medium
CN111124772A (en) Cloud platform storage performance testing method, system, terminal and storage medium
CN116450165A (en) Method, system, terminal and storage medium for quickly building environment and deploying program
CN110554992A (en) Distributed metadata path management method, system, terminal and storage medium
CN109920466B (en) Hard disk test data analysis method, device, terminal and storage medium
CN114490238A (en) Method, system, terminal and storage medium for monitoring whole server diagnosis process
CN111966286A (en) Multi-data pool hierarchical migration method and system
CN110597572B (en) Service call relation analysis method and computer system
CN112463748A (en) Storage system file lock identification method, system, terminal and storage medium
CN111475349B (en) Method, system, terminal and storage medium for testing stability of cluster DPDK
CN111124890A (en) Distributed database performance test method, system, terminal and storage medium
CN111143193A (en) Big data service testing method, system, terminal and storage medium based on RobotFramework

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20210309

WW01 Invention patent application withdrawn after publication