CN112732665A - Log processing method, system and storage medium based on Linux platform - Google Patents

Log processing method, system and storage medium based on Linux platform Download PDF

Info

Publication number
CN112732665A
CN112732665A CN202110010342.1A CN202110010342A CN112732665A CN 112732665 A CN112732665 A CN 112732665A CN 202110010342 A CN202110010342 A CN 202110010342A CN 112732665 A CN112732665 A CN 112732665A
Authority
CN
China
Prior art keywords
log
information
output
file
parameter information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110010342.1A
Other languages
Chinese (zh)
Other versions
CN112732665B (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.)
Goertek Inc
Original Assignee
Goertek Inc
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 Goertek Inc filed Critical Goertek Inc
Priority to CN202110010342.1A priority Critical patent/CN112732665B/en
Publication of CN112732665A publication Critical patent/CN112732665A/en
Application granted granted Critical
Publication of CN112732665B publication Critical patent/CN112732665B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Library & Information Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a log processing method, a log processing system and a log processing storage medium based on a Linux platform, wherein the log processing method comprises the following steps: setting a log information output interface for custom processing of logs in a Linux platform, and defining corresponding parameter information in the log information output interface; when an output instruction of the log information of the Linux platform is received through a preset interface, determining parameter information of the log information output interface required to be called by the output instruction as target parameter information; and determining to-be-output log information and execution operation corresponding to the Linux platform based on the target parameter information, and outputting the to-be-output log information to a corresponding log storage file based on the execution operation. According to the method and the device, the log information to be output is output to the corresponding log storage file according to the execution operation, the log information can be directly inquired in the corresponding log storage file, and all log information does not need to be filtered, so that the inquiry efficiency of the log information is improved.

Description

Log processing method, system and storage medium based on Linux platform
Technical Field
The present application relates to the technical field of log information collection, encryption, and output, and in particular, to a log processing method, system, and storage medium based on a Linux platform.
Background
The main method for debugging the Linux kernel (an open source operating system) is to check output information of the Linux kernel through log information. Currently, all log information of a Linux kernel is output according to different levels, all the log information is mixed together, and if a user wants to acquire required log information, all the log information needs to be filtered.
The above is only for the purpose of assisting understanding of the technical solutions of the present application, and does not represent an admission that the above is prior art.
Disclosure of Invention
The application mainly aims to provide a log processing method, a log processing system and a log processing storage medium based on a Linux platform, and aims to improve the query efficiency of log information.
In order to achieve the above object, an embodiment of the present application provides a log processing method based on a Linux platform, where the log processing method based on the Linux platform includes:
setting a log information output interface for custom processing of logs in a Linux platform, and defining corresponding parameter information in the log information output interface;
when an output instruction of the log information of the Linux platform is received through a preset interface, determining the parameter information of the log information output interface required to be called by the output instruction as target parameter information;
and determining the log information to be output and the execution operation corresponding to the Linux platform based on the target parameter information, and outputting the log information to be output to a corresponding log storage file based on the execution operation.
Optionally, the log processing method based on the Linux platform further includes:
setting a log collection callback interface for analyzing parameter information in a Linux platform;
setting a log encryption interface for encrypting log information in a Linux platform;
and embedding the log information output interface, the log collection callback interface and the log encryption interface into a kernel module of a Linux platform in a driving mode.
Optionally, the target parameter information includes log parameter information, log storage path parameter information, and log encryption parameter information, and the step of determining log information to be output and executing operation corresponding to the Linux platform based on the target parameter information includes:
calling a log collection callback interface to perform parameter analysis on the target parameter information to obtain log parameter information, log storage path parameter information and log encryption parameter information in the target parameter information;
determining log information to be output, which is required to be output by the Linux platform, based on the log parameter information;
and determining the execution operation of the Linux platform based on the log storage path parameter information and the log encryption parameter information.
Optionally, the step of outputting the log information to be output to a corresponding log storage file based on the execution operation includes:
determining whether the log information to be output needs information encryption based on the log encryption parameter information;
and if the log information to be output does not need information encryption, outputting the log information to be output to a corresponding log storage file based on the log storage path parameter information.
Optionally, the step of outputting the log information to be output to a corresponding log storage file based on the log storage path parameter information includes:
if the storage path of the log information to be output is determined to be a preset storage path based on the log storage path parameter information, determining whether a specified log label file exists in the preset storage path;
if the log label file exists in the preset storage path, determining the log label file as the log storage file;
and outputting the log information to be output to the log storage file.
Optionally, after the step of determining whether the log label file exists in the preset storage path, the method further includes:
and if the log label file does not exist in the preset storage path, creating a new label file, and determining the new label file as a log storage file.
Optionally, the step of outputting the log information to be output to a corresponding log storage file based on the log storage path parameter information includes:
if the storage path of the log information to be output is determined to be a system storage path based on the log storage path parameter information, determining a system file for storing the log information in the system;
determining a log label file or a new label file in a preset storage path, and determining the system file, the log label file or the new label file as a log storage file;
and outputting the log information to be output to a log storage file.
Optionally, after the step of determining whether the log information to be output needs information encryption based on the log encryption parameter information, the method further includes:
if the to-be-output log information needs to be encrypted based on the log encryption parameter information, calling a log encryption interface and creating an encrypted tag file with preset suffix in a preset storage path through a preset encryption algorithm in an openssl software library packet;
and determining the encrypted tag file as a log storage file, and outputting the log information to be output to the log storage file.
The embodiment of the present application further provides a system, where the system includes a memory, a processor, and a Linux platform-based log processing program stored in the memory and running on the processor, and when the Linux platform-based log processing program is executed by the processor, the Linux platform-based log processing method is implemented.
The embodiment of the application also provides a storage medium, wherein the storage medium is stored with a log processing program based on the Linux platform, and the log processing program based on the Linux platform realizes the steps of the log processing method based on the Linux platform when being executed by a processor.
According to the log processing method, the log processing system and the log processing storage medium based on the Linux platform, the Linux platform is provided with the log information output interface for custom processing of logs, and corresponding parameter information is defined in the log information output interface; when an output instruction of the log information of the Linux platform is received through a preset interface, determining parameter information of the log information output interface required to be called by the output instruction as target parameter information; and determining to-be-output log information and execution operation corresponding to the Linux platform based on the target parameter information, and outputting the to-be-output log information to a corresponding log storage file based on the execution operation. According to the method and the device, the log information to be output and the execution operation are determined according to the output instruction, the log information to be output is output to the corresponding log storage file according to the execution operation, when the user needs to inquire the corresponding log information, the log information needing to be inquired is directly obtained in the corresponding log storage file, all log information does not need to be filtered, and therefore the inquiry efficiency of the log information is improved.
Drawings
FIG. 1 is a system diagram illustrating a hardware operating environment according to an embodiment of the present disclosure;
FIG. 2 is a schematic flowchart of a first embodiment of a log processing method based on a Linux platform according to the present application;
FIG. 3 is a schematic flowchart of a detailed process of step S60 in the first embodiment of the log processing method based on the Linux platform according to the present application
Fig. 4 is a schematic flowchart of another embodiment of the log processing method based on the Linux platform according to the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The main solution of the embodiment of the application is as follows: setting a log information output interface for custom processing of logs in a Linux platform, and defining corresponding parameter information in the log information output interface; when an output instruction of the log information of the Linux platform is received through a preset interface, determining parameter information of the log information output interface required to be called by the output instruction as target parameter information; and determining to-be-output log information and execution operation corresponding to the Linux platform based on the target parameter information, and outputting the to-be-output log information to a corresponding log storage file based on the execution operation. According to the method and the device, the log information to be output and the execution operation are determined according to the output instruction, the log information to be output is output to the corresponding log storage file according to the execution operation, when the user needs to inquire the corresponding log information, the log information needing to be inquired is directly obtained in the corresponding log storage file, all log information does not need to be filtered, and therefore the inquiry efficiency of the log information is improved.
Specifically, referring to fig. 1, fig. 1 is a schematic system structure diagram of a hardware operating environment according to an embodiment of the present application.
As shown in fig. 1, the system is a Linux (open source operating system) kernel-based log management system, and the Linux kernel-based log management system may include: a processor 1001, such as a CPU (Central Processing Unit), a memory 1005, a network interface 1004, a user interface 1003, and a communication bus 1002. A communication bus 1002 is used to enable connection communications between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a keyboard (board), and the user interface 1003 may optionally include a standard wired interface (e.g., a USB (Universal Serial Bus) interface), and a wireless interface (e.g., a bluetooth interface). The network interface 1004 may include a standard wired interface, a Wireless interface (e.g., WI-FI (Wireless-Fidelity)) interface, a bluetooth interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001. Optionally, the system may further include RF (Radio Frequency) circuitry, sensors, WiFi modules, and the like.
Those skilled in the art will appreciate that the system architecture shown in FIG. 1 is not intended to be limiting of the system, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005 as a storage medium (it should be noted that the storage medium in this application is a computer-readable storage medium) may include an operating system, a network communication module, a user interface module, and a Linux platform-based log processing program. The operating system is a program for managing and controlling system hardware and software resources, and supports the running of a log processing program and other software or programs based on a Linux platform.
The processor 1001 may be configured to call a Linux platform based log handler stored in the memory 1005, and perform the following operations:
setting a log information output interface for custom processing of logs in a Linux platform, and defining corresponding parameter information in the log information output interface;
when an output instruction of the log information of the Linux platform is received through a preset interface, determining the parameter information of the log information output interface required to be called by the output instruction as target parameter information;
and determining the log information to be output and the execution operation corresponding to the Linux platform based on the target parameter information, and outputting the log information to be output to a corresponding log storage file based on the execution operation.
Further, the processor 1001 may call the Linux platform based log handler stored in the memory 1005, and also perform the following operations:
setting a log collection callback interface for analyzing parameter information in a Linux platform;
setting a log encryption interface for encrypting log information in a Linux platform;
and embedding the log information output interface, the log collection callback interface and the log encryption interface into a kernel module of a Linux platform in a driving mode.
Further, the processor 1001 may call the Linux platform based log handler stored in the memory 1005, and also perform the following operations:
calling a log collection callback interface to perform parameter analysis on the target parameter information to obtain log parameter information, log storage path parameter information and log encryption parameter information in the target parameter information;
determining log information to be output, which is required to be output by the Linux platform, based on the log parameter information;
and determining the execution operation of the Linux platform based on the log storage path parameter information and the log encryption parameter information.
Further, the processor 1001 may call the Linux platform based log handler stored in the memory 1005, and also perform the following operations:
determining whether the log information to be output needs information encryption based on the log encryption parameter information;
and if the log information to be output does not need information encryption, outputting the log information to be output to a corresponding log storage file based on the log storage path parameter information.
Further, the processor 1001 may call the Linux platform based log handler stored in the memory 1005, and also perform the following operations:
if the storage path of the log information to be output is determined to be a preset storage path based on the log storage path parameter information, determining whether a specified log label file exists in the preset storage path;
if the log label file exists in the preset storage path, determining the log label file as the log storage file;
and outputting the log information to be output to the log storage file.
Further, the processor 1001 may call the Linux platform based log handler stored in the memory 1005, and also perform the following operations:
and if the log label file does not exist in the preset storage path, creating a new label file, and determining the new label file as a log storage file.
Further, the processor 1001 may call the Linux platform based log handler stored in the memory 1005, and also perform the following operations:
if the storage path of the log information to be output is determined to be a system storage path based on the log storage path parameter information, determining a system file for storing the log information in the system;
determining a log label file or a new label file in a preset storage path, and determining the system file, the log label file or the new label file as a log storage file;
and outputting the log information to be output to a log storage file.
Further, the processor 1001 may call the Linux platform based log handler stored in the memory 1005, and also perform the following operations:
if the to-be-output log information needs to be encrypted based on the log encryption parameter information, calling a log encryption interface and creating an encrypted tag file with preset suffix in a preset storage path through a preset encryption algorithm in an openssl software library packet;
and determining the encrypted tag file as a log storage file, and outputting the log information to be output to the log storage file.
Based on the above system architecture, but not limited to the above architecture, the present application provides an embodiment of a log processing method based on a Linux platform, and it should be noted that although a logical order is shown in a flowchart, in some data, the steps shown or described may be performed in an order different from that here.
In the method of the embodiment of the present application, a log management system based on a Linux (open source operating system) kernel is taken as an execution main body for example.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a first embodiment of a log processing method based on a Linux platform according to the present application. The log processing method based on the Linux platform comprises the following steps:
step S10, setting a log information output interface for custom processing the log in the Linux platform, and defining corresponding parameter information in the log information output interface;
step S20, setting a log collection callback interface for analyzing parameter information in the Linux platform;
step S30, setting a log encryption interface for encrypting log information in the Linux platform;
and step S40, embedding the log information output interface, the log collection callback interface and the log encryption interface into a kernel module of a Linux platform in a driving mode.
In the embodiment, the log management system is exemplified as a Linux kernel-based log management system. The method comprises the steps that a log information output interface used for processing logs in a user-defined mode is arranged in a Linux platform, and corresponding parameter information is defined in the log information output interface, wherein the parameter information comprises but is not limited to parameter information of log information to be output, parameter information of a specified label file, parameter information of a specified log storage path, parameter information of whether log information is output to a log management system or not, and parameter information of whether the log information is encrypted or not. It should be noted that the log output interface is externally connected through a preset interface, that is, other modules in the Linux kernel may trigger the log information output interface to output the log information by calling the preset interface. In the present embodiment, the preset interface is defaulted to an exit _ SYMBOL _ GPL () interface, but is not limited to the exit _ SYMBOL _ GPL () interface. Meanwhile, a log collection callback interface used for analyzing the parameter information in the log information output interface is arranged in the Linux platform, a log encryption interface used for encrypting the log information to be output is arranged in the Linux platform, and the log information output interface, the log collection callback interface and the log encryption interface are embedded into a kernel module of the Linux platform in a driving mode.
Step S50, when receiving an output instruction of the log information of the Linux platform through a preset interface, determining the parameter information of the log information output interface required to be called by the output instruction as target parameter information.
When a user needs to output log information in the log management system to a corresponding log storage file for storage, the user needs to send an output instruction of the log information to the log management system through a corresponding user terminal, where the output instruction indicates parameter information in a log output interface to be called. When a log information output interface in the log management system receives an output instruction sent by a user terminal through a preset interface, namely an EXPORT _ SYMBOL _ GPL () interface, responding to the output instruction sent by the user terminal, determining parameter information required to be called by the output instruction as target parameter information according to the parameter information of the log output interface to be called, which is indicated in the output instruction, and transmitting the target parameter information to a log collection callback interface.
Step S60, determining the log information to be output and the execution operation corresponding to the Linux platform based on the target parameter information, and outputting the log information to be output to the corresponding log storage file based on the execution operation.
After the log management system determines the target parameter information, the target parameter information is transmitted to a log collection callback interface to trigger the log collection callback interface in the log management system, it needs to be explained that the log management system transmits the determined target parameter information into the log collection callback interface when triggering the log collection callback interface, the log collection callback interface receives the transmitted target parameter information and analyzes the parameters of the transmitted parameter information, determines the log information (to-be-output log information) required to be output by the Linux platform according to the analyzed parameters, and determines a system for storing the log information required to be output by the Linux platform into the log management system according to the analyzed parameters, or stores the log information required to be output by the Linux platform into a storage path designated by a user, or stores the log information required to be output by the Linux platform into the system and a storage path designated by the user, meanwhile, after determining whether the log information required to be output by the Linux platform needs to be encrypted, encrypting the information according to whether the log information required to be output by the Linux platform needs to be encrypted. And finally, the log management system outputs the log information required to be output by the Linux platform to a corresponding log storage file for storage according to the system of the log management system and the storage requirement of the storage path specified by the user.
Further, the step S60 determines log information to be output and execution operation corresponding to the Linux platform based on the target parameter information, including:
step S601, calling a log collection callback interface to perform parameter analysis on the target parameter information to obtain log parameter information, log storage path parameter information and log encryption parameter information in the target parameter information;
step S602, determining the log information to be output, which is required to be output by the Linux platform, based on the log parameter information;
step S603, determining an execution operation of the Linux platform based on the log storage path parameter information and the log encryption parameter information.
Specifically, after receiving the incoming target parameter information, a log collection callback interface in the log management system performs parameter analysis on the incoming target parameter information by calling the log collection callback interface, and determines log parameter information (parameter information of log information to be output), log storage path parameter information (parameter information specifying a tag file, parameter information specifying a log storage path, and parameter information indicating whether to output the log information to the log management system) and log encryption parameter information (parameter information indicating whether to encrypt the log information) in the target parameter information according to the analyzed parameters. Then, the log management system determines the log information to be output, which is required to be output by the Linux platform, according to the log parameter information, and determines to store (output) the log information to be output to a system file in the log management system of the Linux platform according to the log storage path parameter information, or to store the log information to be output to a storage path specified by a user, or to store the log information to be output to the system file in the log management system of the Linux platform and the storage path specified by the user. Meanwhile, the log management system determines whether the log information to be output needs to be encrypted according to the log encryption parameter information.
Further, the step S60, outputting the log information to be output to a corresponding log storage file based on the execution operation, includes:
step S604, determining whether the log information to be output needs information encryption based on the log encryption parameter information;
step S605, if it is determined that the log information to be output does not require information encryption, outputting the log information to be output to a corresponding log storage file based on the log storage path parameter information.
Specifically, the log management system determines whether the log information to be output needs information encryption according to the log encryption parameter information, and if the log management system determines that the log information to be output does not need information encryption, the log management system determines that the storage path of the log information to be output is a system storage path or a preset storage path according to the log storage path parameter information. If the log management system determines that the storage path of the log information to be output is a system storage path, the log management system determines a system file used by the log management system for storing the log information, and outputs the log information to be output to the system file used by the log management system for storing the log information. Meanwhile, the log management system determines a file for storing log information in the preset storage path and outputs the log information to be output to the file for storing the log information in the preset storage path. It can be understood that, if the log management system determines that the storage path of the log information to be output is the system storage path, the log management system outputs the log information to be output to the system file of the system storage path and the file of the preset storage path. If the log management system determines that the storage path of the log information to be output is a preset storage path, the log management system directly outputs the log information to be output to a file for storing the log information in the preset storage path.
Further, the step S605 includes:
step S6051, if the storage path of the log information to be output is determined to be a preset storage path based on the log storage path parameter information, determining whether a specified log label file exists in the preset storage path;
step S6052, if the log label file is determined to exist in the preset storage path, determining the log label file as the log storage file;
step S6053, if the log label file does not exist in the preset storage path, creating a new label file, and determining the new label file as a log storage file;
step S6054, output the to-be-output log information to the log storage file.
Specifically, if the log management system determines that the log information to be output does not need to be encrypted, and determines the storage path of the log information to be output as the preset storage path according to the log storage path parameter information, where the preset storage path is the log information storage path specified by the log storage path parameter information, and is set by the user according to the requirement, which is not limited in this embodiment. Then, the log management system determines whether a specified log label file exists in a preset storage path, if the log management system determines that the specified log label file exists in the preset storage path, the log management system determines the specified log label file as a log storage file of log information to be output, simultaneously outputs the log information to be output to the specified log label file, and adds the log information to be output to the tail of the specified log label file. If the log management system determines that the designated log label file exists in the preset storage path, the log management system creates a new label file, determines the new label file as a log storage file of the log information to be output, and simultaneously outputs the log information to be output to the new label file.
In the embodiment, a log information output interface for custom processing of logs is arranged in a Linux platform, and corresponding parameter information is defined in the log information output interface; when an output instruction of the log information of the Linux platform is received through a preset interface, determining parameter information of the log information output interface required to be called by the output instruction as target parameter information; and determining to-be-output log information and execution operation corresponding to the Linux platform based on the target parameter information, and outputting the to-be-output log information to a corresponding log storage file based on the execution operation. According to the method and the device, the log information to be output and the execution operation are determined according to the output instruction, the log information to be output is output to the corresponding log storage file according to the execution operation, when the user needs to inquire the corresponding log information, the log information needing to be inquired is directly obtained in the corresponding log storage file, all log information does not need to be filtered, and therefore the inquiry efficiency of the log information is improved.
Referring to fig. 3, fig. 3 is a schematic detailed flow chart of step S60 in the first embodiment of the Linux platform-based log processing method according to the present application. The step S60 further includes:
step S606, if the storage path of the log information to be output is determined to be a system storage path based on the log storage path parameter information, determining a system file for storing the log information in the system;
step S607, determining a log label file or a new label file in a preset storage path, and determining the system file, the log label file or the new label file as a log storage file;
step S608, outputting the log information to be output to a log storage file.
If the log management system determines that the log information to be output does not need to be encrypted, and determines the storage path of the log information to be output as a system storage path according to the log storage path parameter information, namely when the log management system determines that the log information to be output needs to be stored in a system file of the log management system, the log management system stores the system file for storing the log information in the log management system and outputs the log information to be output to the system file for storing the log information. Meanwhile, the log management system determines whether a specified log label file exists in a preset storage path, if the log management system determines that the specified log label file exists in the preset storage path, the log management system determines a system file for storing log information in the log management system and the specified log label file as log storage files of log information to be output, and simultaneously outputs the log information to be output to the system file for storing the log information in the log management system and the specified log label file. If the log management system determines that the designated log label file does not exist in the preset storage path, the log management system re-creates a new label file, determines a system file for storing log information in the log management system and the new label file as a log storage file of the log information to be output, and simultaneously outputs the log information to be output to the system file for storing the log information in the log management system and the new label file.
If the storage path of the log information to be output is determined to be a system storage path based on the log storage path parameter information, determining a system file for storing the log information in the system; determining a log label file or a new label file in a preset storage path, and determining a system file, the log label file or the new label file as a log storage file; and outputting the log information to be output to a log storage file. Therefore, after the storage path of the log information to be output is determined to be the system storage path, the log information to be output is not only output to the system file storing the log information in the log management system, but also output to the log label file or the new label file of the preset storage path, and the log information to be output is output to a plurality of files for storage, so that when one file is damaged, the log information can be queried through other files, and the query efficiency of the log information is improved.
Referring to fig. 4, fig. 4 is a schematic flowchart illustrating another embodiment of the log processing method based on the Linux platform according to the present application. After step S601, the method further includes:
step S609, if the to-be-output log information needs to be encrypted based on the log encryption parameter information, calling a log encryption interface and creating an encrypted tag file with preset suffix in a preset storage path through a preset encryption algorithm in an openssl software library packet;
step S610, determining the encrypted tag file as a log storage file, and outputting the log information to be output to the log storage file.
If the log management system determines that the log information to be output needs to be encrypted, a log collection callback interface in the log management system calls a log encryption interface, namely, the log management system creates an encrypted tag file with a suffix 'enc' in a preset storage path through the log encryption interface and a preset encryption algorithm in an openssl (open source code software library package), determines the encrypted tag file with the suffix 'enc' as a log storage file of the log information to be output, and outputs the log information to be output to the encrypted tag file with the suffix 'enc'. After the log management system outputs the log information to be output to the encrypted label file, corresponding security level identifiers are added at the header of the file containing the log information to be output, for example, the security level identifier of the business Secret III level is Secret, the security level identifier of the business Secret II level is Confidential, the security level identifier of the business Secret I level is Internal, and the public security level identifier is/.
The preset Encryption algorithm adopted by the log Encryption interface includes, but is not limited to, an Advanced Encryption Standard (AES) Encryption algorithm and a Data Encryption Standard (DES) Encryption algorithm, in this embodiment, the default preset Encryption algorithm is the AES Encryption algorithm, a Block Cipher (CBC) mode (ciphertext Block Chaining) mode, and a key (128 bits), and a key (Encryption key) and an initial session Vector (IV) in the AES Encryption algorithm can be set by the user according to the user's requirement, which is not limited in this embodiment.
And after receiving a query instruction for querying log information sent by a user through a user terminal, the log management system determines a corresponding encrypted tag file according to the query instruction of the user and pulls the log information out of the encrypted tag file. Then, the log management system decrypts through an AES decryption interface in the openssl, and when the log file is subjected to AES decryption, the log file can be normally decrypted as long as the used keys and the used IV are the same as those used in AES encryption. And after decrypting the log information, the log management system returns the decrypted log information to the user terminal corresponding to the user.
It should be noted that, the log management system determines that the log information to be output needs to be encrypted, and cannot create a corresponding encrypted tag file in the system storage path of the log management system, that is, the log information that needs to be decrypted cannot be stored in the log management system, so as to prevent log information in the log system (log management system) that is confused by the Linux kernel.
If the log information to be output needs to be encrypted based on the log encryption parameter information, calling a log encryption interface and creating an encryption tag file with preset suffix in a preset storage path through a preset encryption algorithm in an openssl software library packet; and determining the encrypted tag file as a log storage file, and outputting the log information to be output to the log storage file. Therefore, after determining that the log information to be output needs to be encrypted, the embodiment creates the encrypted tag file in the preset storage path, stores the log information to be output through the encrypted tag file, prevents information in the log information from being leaked, ensures the safety of the log information, and simultaneously, a user can encrypt and decrypt the log information to be output according to the self requirement, thereby improving the query efficiency of the log information.
The present application further provides a log processing apparatus based on a Linux platform, the log processing apparatus based on the Linux platform includes:
the system comprises a definition module, a log information output interface and a log information processing module, wherein the definition module is used for setting the log information output interface for custom processing of logs in a Linux platform and defining corresponding parameter information in the log information output interface;
the system comprises a determining module, a processing module and a processing module, wherein the determining module is used for determining parameter information of a log information output interface required to be called by an output instruction as target parameter information when the output instruction of the log information of the Linux platform is received through a preset interface;
the determining module is further used for determining log information to be output and executing operation corresponding to the Linux platform based on the target parameter information;
and the output module is used for outputting the log information to be output to a corresponding log storage file based on the execution operation.
The function implementation of each module in the log processing device based on the Linux platform corresponds to each step in the log processing method based on the Linux platform, and the functions and implementation processes are not described in detail herein.
The present invention also provides a storage medium, wherein the storage medium stores a Linux platform based log processing program, and the Linux platform based log processing program implements the steps of the Linux platform based log processing method according to any one of the above embodiments when being executed by a processor.
The specific embodiment of the storage medium of the present invention is basically the same as the embodiments of the log processing method based on the Linux platform, and is not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation manner in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of software goods stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and including instructions for causing a system to complete the methods according to the embodiments of the present application.

Claims (10)

1. A log processing method based on a Linux platform is characterized by comprising the following steps:
setting a log information output interface for custom processing of logs in a Linux platform, and defining corresponding parameter information in the log information output interface;
when an output instruction of the log information of the Linux platform is received through a preset interface, determining the parameter information of the log information output interface required to be called by the output instruction as target parameter information;
and determining the log information to be output and the execution operation corresponding to the Linux platform based on the target parameter information, and outputting the log information to be output to a corresponding log storage file based on the execution operation.
2. The Linux platform-based log processing method of claim 1, further comprising:
setting a log collection callback interface for analyzing parameter information in a Linux platform;
setting a log encryption interface for encrypting log information in a Linux platform;
and embedding the log information output interface, the log collection callback interface and the log encryption interface into a kernel module of a Linux platform in a driving mode.
3. The Linux platform-based log processing method of claim 1, wherein the target parameter information includes log parameter information, log storage path parameter information, and log encryption parameter information, and the determining of the Linux platform-corresponding log information to be output and the executing of the operation based on the target parameter information includes:
calling a log collection callback interface to perform parameter analysis on the target parameter information to obtain log parameter information, log storage path parameter information and log encryption parameter information in the target parameter information;
determining log information to be output, which is required to be output by the Linux platform, based on the log parameter information;
and determining the execution operation of the Linux platform based on the log storage path parameter information and the log encryption parameter information.
4. The Linux platform-based log processing method of claim 3, wherein the step of outputting the log information to be output to the corresponding log storage file based on the execution operation comprises:
determining whether the log information to be output needs information encryption based on the log encryption parameter information;
and if the log information to be output does not need information encryption, outputting the log information to be output to a corresponding log storage file based on the log storage path parameter information.
5. The Linux platform-based log processing method of claim 4, wherein the step of outputting the log information to be output to a corresponding log storage file based on the log storage path parameter information comprises:
if the storage path of the log information to be output is determined to be a preset storage path based on the log storage path parameter information, determining whether a specified log label file exists in the preset storage path;
if the log label file exists in the preset storage path, determining the log label file as the log storage file;
and outputting the log information to be output to the log storage file.
6. The Linux platform-based log processing method of claim 5, wherein after the step of determining whether the log label file exists in the preset storage path, further comprising:
and if the log label file does not exist in the preset storage path, creating a new label file, and determining the new label file as a log storage file.
7. The Linux platform-based log processing method according to any one of claims 3 to 6, wherein the step of outputting the to-be-output log information to a corresponding log storage file based on the log storage path parameter information comprises:
if the storage path of the log information to be output is determined to be a system storage path based on the log storage path parameter information, determining a system file for storing the log information in the system;
determining a log label file or a new label file in a preset storage path, and determining the system file, the log label file or the new label file as a log storage file;
and outputting the log information to be output to a log storage file.
8. The Linux platform-based log processing method of any one of claims 3 to 6, wherein after the step of determining whether the log information to be output requires information encryption based on the log encryption parameter information, further comprising:
if the to-be-output log information needs to be encrypted based on the log encryption parameter information, calling a log encryption interface and creating an encrypted tag file with preset suffix in a preset storage path through a preset encryption algorithm in an openssl software library packet;
and determining the encrypted tag file as a log storage file, and outputting the log information to be output to the log storage file.
9. A system comprising a memory, a processor and a Linux platform based log processing program stored on the memory and running on the processor, the Linux platform based log processing program when executed by the processor implementing the steps of the Linux platform based log processing method of any one of claims 1 to 8.
10. A storage medium, wherein the storage medium stores thereon a Linux platform-based log processing program, which when executed by a processor implements the steps of the Linux platform-based log processing method according to any one of claims 1 to 8.
CN202110010342.1A 2021-01-04 2021-01-04 Log processing method, system and storage medium based on Linux platform Active CN112732665B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110010342.1A CN112732665B (en) 2021-01-04 2021-01-04 Log processing method, system and storage medium based on Linux platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110010342.1A CN112732665B (en) 2021-01-04 2021-01-04 Log processing method, system and storage medium based on Linux platform

Publications (2)

Publication Number Publication Date
CN112732665A true CN112732665A (en) 2021-04-30
CN112732665B CN112732665B (en) 2022-10-18

Family

ID=75590162

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110010342.1A Active CN112732665B (en) 2021-01-04 2021-01-04 Log processing method, system and storage medium based on Linux platform

Country Status (1)

Country Link
CN (1) CN112732665B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105005528A (en) * 2015-06-26 2015-10-28 浪潮(北京)电子信息产业有限公司 Log information extraction method and apparatus
CN109388622A (en) * 2018-11-01 2019-02-26 郑州云海信息技术有限公司 A kind of log information processing method, device, equipment and readable storage medium storing program for executing
WO2019140828A1 (en) * 2018-01-17 2019-07-25 平安科技(深圳)有限公司 Electronic apparatus, method for querying logs in distributed system, and storage medium
CN110716908A (en) * 2019-09-29 2020-01-21 捷开通讯(深圳)有限公司 Log information writing method, system, storage medium and mobile terminal
CN110765085A (en) * 2019-10-12 2020-02-07 捷开通讯(深圳)有限公司 Log information writing method, system, storage medium and mobile terminal
CN111897786A (en) * 2020-05-27 2020-11-06 深圳市广和通无线股份有限公司 Log reading method and device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105005528A (en) * 2015-06-26 2015-10-28 浪潮(北京)电子信息产业有限公司 Log information extraction method and apparatus
WO2019140828A1 (en) * 2018-01-17 2019-07-25 平安科技(深圳)有限公司 Electronic apparatus, method for querying logs in distributed system, and storage medium
CN109388622A (en) * 2018-11-01 2019-02-26 郑州云海信息技术有限公司 A kind of log information processing method, device, equipment and readable storage medium storing program for executing
CN110716908A (en) * 2019-09-29 2020-01-21 捷开通讯(深圳)有限公司 Log information writing method, system, storage medium and mobile terminal
CN110765085A (en) * 2019-10-12 2020-02-07 捷开通讯(深圳)有限公司 Log information writing method, system, storage medium and mobile terminal
CN111897786A (en) * 2020-05-27 2020-11-06 深圳市广和通无线股份有限公司 Log reading method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112732665B (en) 2022-10-18

Similar Documents

Publication Publication Date Title
AU2019271965B2 (en) POS System with white box encryption key sharing
US11128447B2 (en) Cryptographic operation method, working key creation method, cryptographic service platform, and cryptographic service device
CN107801165B (en) Business short message pushing method and device, computer equipment and storage medium
EP2095288B1 (en) Method for the secure storing of program state data in an electronic device
CN107786331B (en) Data processing method, device, system and computer readable storage medium
CN111614683B (en) Data processing method, device and system and network card
CN111274611A (en) Data desensitization method, device and computer readable storage medium
CN110855433B (en) Data encryption method and device based on encryption algorithm and computer equipment
US9571273B2 (en) Method and system for the accelerated decryption of cryptographically protected user data units
CN113839780A (en) Encryption method, decryption method, server and storage medium
CN115525916A (en) Database encryption method and device, electronic equipment and storage medium
CN114416773B (en) Data processing method, device, storage medium and server
EP2689367B1 (en) Data protection using distributed security key
CN112732665B (en) Log processing method, system and storage medium based on Linux platform
CN112214270A (en) Page redrawing method, device, equipment and storage medium
EP3425552B1 (en) Hardware secure module, related processing system, integrated circuit, device and method
CN110730066A (en) Network encryption and decryption method and device for data, storage medium and electronic device
EP2591437B1 (en) Microcode-based challenge/response process
CN114915503A (en) Data stream splitting processing encryption method based on security chip and security chip device
CN113672955A (en) Data processing method, system and device
CN111641497A (en) Method and device for automatically decrypting sensitive parameters
EP3425551A1 (en) A processing system, related integrated circuit, device and method for a hardware secure module
CN110943834B (en) Network device, password processing method thereof, control device and readable storage medium
CN116896444B (en) File packet management method and device
CN115801274B (en) Firmware protection method

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