Log data processing method and device, storage medium and electronic device
By generating target identifiers matching the service type for log data and encrypting it, the problem of difficulty in managing log data in complex distributed environments is solved, and efficient data management and security protection is achieved.
Patent Information
- Application Number
- CN202411832147.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-11
AI Technical Summary
In a complex distributed environment, the management and protection of log data becomes extremely difficult, especially when the data volume surges, how to identify log data for subsequent log searches has become an urgent problem.
By obtaining multiple log data, the matching identification type is determined based on the service type of the application service, the target identification corresponding to the log data is generated and embedded in the log structure, and finally the target log data is encrypted and stored.
It realizes precise tracking and management of log data, simplifies the classification and retrieval of log data, improves the efficiency of system analysis and troubleshooting, and protects the security of data through encryption.
Smart Images

Figure CN119806977A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of wind turbines, and in particular to a method and device for processing log data, a storage medium, and an electronic device. Background Art
[0002] In today's highly information-based and digitalized era, knowledge engineering, as a bridge between artificial intelligence and industry applications, is becoming increasingly important. Knowledge engineering systems collect, analyze and utilize various data, including but not limited to log data, to achieve knowledge acquisition, representation, reasoning and application, in order to improve the efficiency and effectiveness of decision support, operation and maintenance management, and business optimization. However, knowledge engineering systems face many challenges when processing large-scale, high-concurrency log data, especially in terms of data security, integrity and processing efficiency.
[0003] Log data, as a record of the operation trajectory of the knowledge engineering system, contains a wealth of information such as operation status, user activities, abnormal events, etc. It is a key data source for system maintenance, troubleshooting, performance analysis and security auditing. However, in a complex distributed environment, the management and protection of log data becomes extremely difficult.
[0004] With the surge in the amount of log data, how to identify the log data to facilitate subsequent log searches has become an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present application provide a method and device for processing log data, a storage medium, and an electronic device to at least solve the problem of difficulty in searching log data in the related art.
[0006] According to an embodiment of the present application, a method for processing log data is provided, including: acquiring multiple log data obtained by collecting data for multiple application services; determining identification types that respectively match the multiple log data based on the service types of the multiple application services; determining target identifications corresponding to the multiple log data respectively according to the identification types that respectively match the multiple log data, and embedding the target identifications into the log structures of the multiple log data respectively to obtain multiple target log data; encrypting the multiple target log data, and storing the encrypted multiple target log data in a preset storage unit.
[0007] In an exemplary embodiment, the service types include data processing services, user interaction services, and system detection services; the determining of identification types that respectively match the multiple log data based on the service types of the multiple application services includes: when the multiple application services include data processing services, determining the task identification that matches the data processing service based on the task information associated with the log data; when the multiple application services include user interaction services, determining the identity that matches the user interaction service based on the user information associated with the log data; when the multiple application services include system detection services, determining the device identification that matches the system detection service based on the device information associated with the log data.
[0008] In an exemplary embodiment, the target identifiers corresponding to the multiple log data are determined according to the identification types that match the multiple log data respectively, including: in a case where the identification type is a task identifier, task parameters of the log data associated with the task identifier are determined, and the target identifier corresponding to the log data is determined based on the task parameters; in a case where the identification type is a user identifier, identity parameters of the log data associated with the task identifier are determined, and the target identifier corresponding to the log data is determined based on the identity parameters; in a case where the identification type is a device identifier, device parameters of the log data associated with the task identifier are determined, and the target identifier corresponding to the log data is determined based on the device parameters.
[0009] In an exemplary embodiment, determining the target identifier corresponding to the log data based on the task parameters includes: extracting a timestamp from the log data and randomly generating a random number; determining the target identifier corresponding to the log data based on the timestamp, the random number and the task parameters.
[0010] In an exemplary embodiment, determining the target identifier corresponding to the log data based on the identity parameters includes: extracting a timestamp from the log data and randomly generating a random number; determining the target identifier corresponding to the log data based on the timestamp, the random number and the identity parameters.
[0011] In an exemplary embodiment, encrypting the multiple target log data and storing the encrypted multiple target log data in a preset storage unit includes: encrypting the multiple target log data based on a preset symmetric encryption algorithm to obtain the encrypted multiple target log data; based on a set storage method, storing the encrypted multiple target log data in a preset storage unit.
[0012] In an exemplary embodiment, based on the set storage method, the encrypted multiple target log data are stored in a preset storage unit, including: based on a hash data structure, storing the encrypted multiple target log data, wherein the target identifier is used as a key and the encrypted target log data is used as a value.
[0013] According to another embodiment of the embodiments of the present application, a log data processing device is also provided, including: an acquisition module, used to acquire multiple log data obtained by data collection for multiple application services; a determination module, used to determine the identification types that match the multiple log data respectively based on the service types of the multiple application services; the determination module is also used to determine the target identifications corresponding to the multiple log data respectively according to the identification types that match the multiple log data respectively, and embed the target identifications into the log structures of the multiple log data respectively to obtain multiple target log data; a storage module, used to encrypt the multiple target log data, and store the encrypted multiple target log data in a preset storage unit.
[0014] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above method when running.
[0015] According to another aspect of the embodiments of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method through the computer program.
[0016] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0017] In an embodiment of the present application, a unique identifier matching the service type is generated for each log data, which can ensure accurate tracking and management of all log data in the entire data stream. This identification mechanism simplifies the classification and retrieval of log data and improves the efficiency of system analysis and troubleshooting. The target log data is encrypted and the encrypted data is stored in a preset storage unit, which effectively prevents the leakage and tampering of data during storage and transmission. The embedding of the target identifier helps to organize data in a more efficient way in the storage unit, effectively improving the data access speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 It is a hardware structure block diagram of a computer terminal of a method for processing log data in an embodiment of the present application;
[0020] Figure 2 is a flowchart of a method for generating a log data processing method according to an embodiment of the present application;
[0021] Figure 3 It is a structural block diagram of a log data processing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices; "plurality" means two or more.
[0024] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal or similar computing device or cloud platform or independent physical server or software platform, wherein the above software platform is run through one or more servers. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure diagram of a method for processing log data according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1Only one is shown in the figure) processor 102 and memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 for communication functions and an input and output device 108, wherein the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. A person skilled in the art can understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 A different configuration with more features is shown.
[0025] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the methods in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, the above-mentioned methods are implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0026] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0027] In this embodiment, a method for processing log data is provided, which is applied to the above-mentioned computer device. Figure 2 : is a flowchart of a method for processing log data according to an embodiment of the present application, the process includes the following steps:
[0028] Step S202, obtaining multiple log data obtained by collecting data for multiple application services;
[0029] Step S204, determining identification types that respectively match the plurality of log data based on the service types of the plurality of application services;
[0030] Step S206, determining target identifiers corresponding to the plurality of log data respectively according to the identifier types respectively matched with the plurality of log data, and embedding the target identifiers into the log structures of the plurality of log data respectively, to obtain the plurality of target log data;
[0031] Step S208: encrypt the plurality of target log data and store the encrypted plurality of target log data in a preset storage unit.
[0032] In an embodiment of the present application, a unique identifier matching the service type is generated for each log data, which can ensure accurate tracking and management of all log data in the entire data stream. This identification mechanism simplifies the classification and retrieval of log data and improves the efficiency of system analysis and troubleshooting. The target log data is encrypted and the encrypted data is stored in a preset storage unit, which effectively prevents the leakage and tampering of data during storage and transmission. The embedding of the target identifier helps to organize data in a more efficient way in the storage unit, effectively improving the data access speed.
[0033] In an exemplary embodiment, the service types include data processing services, user interaction services, and system detection services; the determining of identification types that respectively match the multiple log data based on the service types of the multiple application services includes: when the multiple application services include data processing services, determining the task identification that matches the data processing service based on the task information associated with the log data; when the multiple application services include user interaction services, determining the identity that matches the user interaction service based on the user information associated with the log data; when the multiple application services include system detection services, determining the device identification that matches the system detection service based on the device information associated with the log data.
[0034] It should be noted that for different services, the information used to determine the identification type is also different. Task information includes task ID (identifier), task name, task status, task execution time and task executor. This information is the basis for generating task identification and can reflect the business attributes of the log data of the data processing service. Based on the task information, a certain algorithm (such as a hash function, a combination of timestamp and task ID, etc.) is used to generate a globally unique task identification. The task identification should be able to uniquely identify each task, and ensure the uniqueness of the identification and the distinguishability of the data even in a high-concurrency environment.
[0035] User information may include user ID, login time, operation type, request parameters, etc., which constitute the basis for generating identity identification. Encryption algorithms or custom encoding rules are used to generate identity identification in combination with user information. The generation of identity identification should ensure that even if the user information is the same, the identification generated at different time points is still different to ensure the uniqueness of the identification.
[0036] For system detection services, which are services designed to monitor and diagnose the operating status of the system, its log data is closely related to the operating conditions of the system devices. In order to improve the management efficiency and recovery speed of these log data, the present invention proposes to determine the device identification that matches the system detection service based on the device information associated with the log data.
[0037] For system detection services, identify device ID, device type, device status and other information, which are key elements for generating device identification. Combine device information and use hash algorithms or other identification generation strategies to generate device identification. The device identification should be able to reflect the uniqueness of the device and accurately distinguish the operation logs of each device even in an environment with multiple devices of the same type.
[0038] In the above embodiment, the method of determining the log identification type based on the service type can realize accurate management, secure storage and efficient recovery of log data according to the characteristics of log data in different scenarios. This method not only improves the efficiency of system operation and maintenance and troubleshooting, but also strengthens the security and compliance of data, and provides a comprehensive and effective solution for the stable operation and data protection of knowledge engineering systems.
[0039] In an exemplary embodiment, the target identifiers corresponding to the multiple log data are determined according to the identification types that match the multiple log data respectively, including: in a case where the identification type is a task identifier, task parameters of the log data associated with the task identifier are determined, and the target identifier corresponding to the log data is determined based on the task parameters; in a case where the identification type is a user identifier, identity parameters of the log data associated with the task identifier are determined, and the target identifier corresponding to the log data is determined based on the identity parameters; in a case where the identification type is a device identifier, device parameters of the log data associated with the task identifier are determined, and the target identifier corresponding to the log data is determined based on the device parameters.
[0040] Specific task parameters are extracted from the log data, including but not limited to task ID, task name, task type, task status, task execution time, system components or services that execute the task, etc. These parameters provide detailed information about the task and are the basis for generating task identifiers. The identified parameters are standardized to ensure that the same type of task parameters in log data from different sources or formats can be processed uniformly to avoid inconsistent identifiers due to parameter differences.
[0041] Based on the standardized task parameters, a deterministic algorithm (such as hash algorithm, timestamp-based encoding, combination of task parameters, etc.) is used to generate a globally unique target identifier. The generated task identifier should be able to reflect the uniqueness of the task and ensure that the identifiers of different tasks do not conflict even in a high-concurrency environment.
[0042] Parameters related to user identity are extracted from log data, such as user ID, user name, user role, login time, operation type, etc. These parameters are used to construct basic information for user identification. The obtained parameters are standardized to ensure the consistency of the same user parameters in different scenarios. After that, the user identification is generated based on the standardized parameters using certain combination rules or encryption algorithms. For example, using the hash value of the user ID and login time as the user identification can ensure the uniqueness of the identification while protecting the privacy of the user information.
[0043] Extract device-related parameters from log data, including device ID, device type, device location, device status, device operation records, etc. These parameters provide detailed information about the device and are an important basis for generating device identification. Unify the device parameters to ensure that the same device is represented consistently in different log entries. Then, use encoding or encryption algorithms to generate device identification based on these parameters to ensure uniqueness and identifiability.
[0044] In the above embodiment, by identifying and processing key parameters in the log data (such as task parameters, user parameters, and device parameters), a target identifier that matches its business scenario or service type can be generated for each log data. This not only helps to achieve refined data management, but also can quickly and accurately restore data through a unique identifier when the data is lost or damaged, significantly enhancing the system's data processing capabilities and operation and maintenance management efficiency.
[0045] In an exemplary embodiment, determining the target identifier corresponding to the log data based on the task parameters includes: extracting a timestamp from the log data and randomly generating a random number; based on the timestamp, the random number and the task parameters, determining the target identifier corresponding to the log data.
[0046] Among them, the timestamp is the precise identifier of the time when an event occurs in the log data. It is usually a long integer number, which represents the number of milliseconds or microseconds from a fixed time point (such as the beginning of Unix time, that is, January 1, 1970 0:00:00) to the time when the event occurs. The role of the timestamp in generating the target identifier is to ensure that the identifier has a time sequence. Even in a high-concurrency environment, the timestamp can be used to distinguish log data generated at different time points. In addition, the timestamp can also provide the time context of the log data, which is helpful for subsequent data analysis and log sorting. Accurately extracting timestamps from log data requires that the log record format contains a clear timestamp field. This field may be stored in milliseconds, microseconds, or finer-grained time units to ensure the accuracy of the time information.
[0047] Random numbers are another important component when generating target identifiers. Their purpose is to increase the randomness of identifiers and prevent duplicate identifiers generated in a short period of time. In high-concurrency scenarios, relying solely on timestamps may not ensure the uniqueness of identifiers, especially at microsecond or millisecond timestamps. The addition of random numbers ensures that identifiers of different log data remain unique even at the same timestamp.
[0048] Generate a random number of fixed length using a random number generator built into the system or provided by a third-party library. To ensure the quality of randomness, you should choose a true random number generator or a cryptographically secure pseudo-random number generator, and avoid using the default implementation of the pseudo-random number generator to prevent predictability.
[0049] The extracted timestamp, the generated random number, and the related task parameters are combined to form a string or number sequence that reflects the characteristics of the log data. The task parameters may include the task ID, task type, etc., depending on the business information recorded in the log data.
[0050] An identification generation algorithm, such as a hash function (such as MD5, SHA-1, SHA-256, etc.), an encoding rule based on timestamp and parameters, or a combined encryption algorithm, is used to convert the above combined parameters into a globally unique target identifier.
[0051] Through the above embodiments, the target identifier generated based on timestamp, random number and task parameters can ensure the unique identification of each log data, and can achieve efficient data management and fast retrieval even in high concurrency and large-scale data environments. This method also effectively improves the security and privacy protection level of data, because the identification generation process contains random and encryption elements, reducing the risk of directly inferring the original data from the identification.
[0052] In an exemplary embodiment, determining the target identifier corresponding to the log data based on the identity parameters includes: extracting a timestamp from the log data and randomly generating a random number; determining the target identifier corresponding to the log data based on the timestamp, the random number and the identity parameters.
[0053] In an exemplary embodiment, encrypting the multiple target log data and storing the encrypted multiple target log data in a preset storage unit includes: encrypting the multiple target log data based on a preset symmetric encryption algorithm to obtain the encrypted multiple target log data; based on a set storage method, storing the encrypted multiple target log data in a preset storage unit.
[0054] Among them, a symmetric encryption algorithm can be selected from a series of available encryption algorithms, such as AES (Advanced Encryption Standard), DES (Data Encryption Standard), 3DES (Triple Data Encryption Standard), etc. The characteristic of the symmetric encryption algorithm is that the same key is used to encrypt and decrypt data.
[0055] Before encryption, an encryption key needs to be generated. The generation of the key should follow security specifications to ensure its randomness and complexity to prevent the key from being cracked. Key management is also very important. A secure key storage and distribution mechanism must be adopted to ensure the security of the key. Use the selected symmetric encryption algorithm and the generated encryption key to encrypt multiple target log data. The encryption process involves converting the original log data into ciphertext. This conversion process is achieved based on mathematical operations of the algorithm and key, ensuring the confidentiality of the data.
[0056] After encryption, simple verification can be performed, such as data integrity check, to ensure that the encryption process has not caused data loss or damage. In addition, it should also be ensured that the encrypted data format meets the requirements of the storage system.
[0057] The preset storage unit can be an Elasticsearch cluster, database, file system, or cloud storage service. When selecting a storage unit, factors such as data access frequency, storage cost, data security, and reliability should be considered. Convert the encrypted log data into a format supported by the storage system. For example, Elasticsearch usually supports data in JSON format, while the file system may support multiple formats such as XML, CSV, etc. Data format conversion helps improve storage efficiency and retrieval speed. According to the set storage method, store the encrypted multiple target log data in the preset storage unit. The storage method may include data sharding, indexing, compression, etc. These processes can optimize the use of storage space and improve the efficiency of data retrieval and recovery.
[0058] In addition to storing encrypted log data, corresponding metadata should also be stored, such as the encryption algorithm, the identification of the encryption key (the key itself is not stored, only its unique identifier), the creation time of the data, the data type, etc. These metadata are crucial for subsequent decryption and data management.
[0059] When storing encrypted log data, a data security and recovery plan should be developed, including data backup strategies, disaster recovery processes, and key management mechanisms to ensure that data can be quickly recovered in the event of data loss or system failure, and can be decrypted for analysis and use when necessary.
[0060] In the above embodiments, the security of log data can be ensured through encryption and storage processing, and the data can be prevented from being unauthorizedly accessed or tampered with during transmission and storage. At the same time, the selection of storage units and the setting of data storage methods also optimize the storage efficiency and retrieval performance of data, providing a solid foundation for large-scale data management and security auditing. This method has broad application prospects in the fields of knowledge engineering, cloud computing, the Internet of Things, etc., and is particularly suitable for processing log data containing sensitive information, such as user data, transaction records, system logs, etc.
[0061] In an exemplary embodiment, based on the set storage method, the encrypted multiple target log data are stored in a preset storage unit, including: based on a hash data structure, storing the encrypted multiple target log data, wherein the target identifier is used as a key and the encrypted target log data is used as a value.
[0062] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0063] The present application also provides a structural block diagram of a log data processing device. Figure 3 is a structural block diagram of a log data processing device according to an embodiment of the present application; Figure 3 As shown, including:
[0064] An acquisition module 32 is used to acquire multiple log data obtained by collecting data for multiple application services;
[0065] A determination module 34, configured to determine identification types that respectively match the plurality of log data based on the service types of the plurality of application services;
[0066] The determination module 34 is further configured to determine target identifiers corresponding to the plurality of log data respectively according to the identifier types respectively matched with the plurality of log data, and embed the target identifiers into the log structures of the plurality of log data respectively to obtain the plurality of target log data;
[0067] The storage module 36 is used to encrypt the plurality of target log data and store the encrypted plurality of target log data in a preset storage unit.
[0068] Through the above device, a unique identifier matching the service type is generated for each log data, which can ensure the accurate tracking and management of all log data in the entire data stream. This identification mechanism simplifies the classification and retrieval of log data and improves the efficiency of system analysis and troubleshooting. The target log data is encrypted and stored in a preset storage unit, which effectively prevents the leakage and tampering of data during storage and transmission. The embedding of the target identifier helps to organize data in a more efficient way in the storage unit, effectively improving the data access speed.
[0069] In an exemplary embodiment, the service types include data processing services, user interaction services, and system detection services; the determination module 34 is also used to determine the task parameters of the log data associated with the task identifier when the identification type is a task identifier, and determine the target identifier corresponding to the log data based on the task parameters; when the identification type is a user identifier, determine the identity parameters of the log data associated with the task identifier, and determine the target identifier corresponding to the log data based on the identity parameters; when the identification type is a device identifier, determine the device parameters of the log data associated with the task identifier, and determine the target identifier corresponding to the log data based on the device parameters.
[0070] In an exemplary embodiment, the determination module 34 is further configured to extract a timestamp from the log data and randomly generate a random number; and determine a target identifier corresponding to the log data based on the timestamp, the random number and the task parameter.
[0071] In an exemplary embodiment, the determination module 34 is further configured to extract a timestamp from the log data and randomly generate a random number; and determine a target identifier corresponding to the log data based on the timestamp, the random number and the identity parameter.
[0072] In an exemplary embodiment, the determination module 34 is also used to encrypt the multiple target log data based on a preset symmetric encryption algorithm to obtain the encrypted multiple target log data; based on the set storage method, store the encrypted multiple target log data in a preset storage unit.
[0073] In an exemplary embodiment, the determination module 34 is further configured to store the encrypted multiple pieces of target log data based on a hash data structure, wherein the target identifier is used as a key and the encrypted target log data is used as a value.
[0074] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0075] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0076] S1, obtaining multiple log data obtained by collecting data for multiple application services;
[0077] S2, determining identification types that respectively match the plurality of log data based on the service types of the plurality of application services;
[0078] S3, determining target identifiers corresponding to the plurality of log data respectively according to the identifier types respectively matched with the plurality of log data, and embedding the target identifiers into the log structures of the plurality of log data respectively, to obtain the plurality of target log data;
[0079] S4, encrypting the plurality of target log data, and storing the encrypted plurality of target log data in a preset storage unit.
[0080] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0081] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0082] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0083] S1, obtaining multiple log data obtained by collecting data for multiple application services;
[0084] S2, determining identification types that respectively match the plurality of log data based on the service types of the plurality of application services;
[0085] S3, determining target identifiers corresponding to the plurality of log data respectively according to the identifier types respectively matched with the plurality of log data, and embedding the target identifiers into the log structures of the plurality of log data respectively, to obtain the plurality of target log data;
[0086] S4, encrypting the plurality of target log data, and storing the encrypted plurality of target log data in a preset storage unit.
[0087] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0088] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0089] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0090] An embodiment of the present application also provides a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any one of the above method embodiments.
[0091] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0092] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0093] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for processing log data, characterized in that: include: Obtain multiple log data obtained by collecting data for multiple application services; Based on the service types of the multiple application services, determining identification types that match the multiple log data respectively; Determine target identifiers corresponding to the plurality of log data respectively according to identifier types respectively matched with the plurality of log data, and embed the target identifiers into log structures of the plurality of log data respectively to obtain the plurality of target log data; The plurality of target log data are encrypted, and the encrypted plurality of target log data are stored in a preset storage unit.
2. The method according to claim 1, characterized in that The service types include data processing services, user interaction services and system detection services; The determining, based on the service types of the multiple application services, identification types that respectively match the multiple pieces of log data includes: When the plurality of application services include a data processing service, determining a task identifier matching the data processing service based on task information associated with the log data; When the plurality of application services include a user interaction service, determining an identity matching the user interaction service based on user information associated with the log data; When the plurality of application services include a system detection service, a device identifier matching the system detection service is determined based on device information associated with the log data.
3. The method according to claim 1, characterized in that The determining, according to the identification types respectively matched with the plurality of log data, target identifications respectively corresponding to the plurality of log data, includes: In the case where the identification type is a task identification, determining a task parameter of the log data associated with the task identification, and determining a target identification corresponding to the log data based on the task parameter; In the case where the identification type is a user identification, determining an identity parameter of the log data associated with the task identification, and determining a target identification corresponding to the log data based on the identity parameter; In the case that the identification type is a device identification, a device parameter of the log data associated with the task identification is determined, and a target identification corresponding to the log data is determined based on the device parameter.
4. The method according to claim 3, characterized in that The determining, based on the task parameter, a target identifier corresponding to the log data includes: Extracting a timestamp from the log data, and randomly generating a random number; Based on the timestamp, the random number, and the task parameter, a target identifier corresponding to the log data is determined.
5. The method according to claim 3, characterized in that: The determining, based on the identity parameter, a target identifier corresponding to the log data includes: Extracting a timestamp from the log data, and randomly generating a random number; Based on the timestamp, the random number, and the identity parameter, a target identifier corresponding to the log data is determined.
6. The method according to claim 1, characterized in that The step of encrypting the plurality of target log data and storing the encrypted plurality of target log data in a preset storage unit includes: Based on a preset symmetric encryption algorithm, encrypt the multiple pieces of target log data to obtain the encrypted multiple pieces of target log data; Based on the set storage method, the encrypted multiple target log data are stored in a preset storage unit.
7. The method according to claim 6, characterized in that Based on the set storage method, storing the encrypted multiple target log data in a preset storage unit includes: Based on the hash data structure, the encrypted multiple pieces of target log data are stored, wherein the target identifier is used as a key and the encrypted target log data is used as a value.
8. A log data processing device, characterized in that: include: The acquisition module is used to acquire multiple log data obtained by collecting data from multiple application services; A determination module, configured to determine identification types that respectively match the plurality of log data based on the service types of the plurality of application services; The determination module is further configured to determine target identifiers corresponding to the plurality of log data respectively according to the identifier types respectively matched with the plurality of log data, and embed the target identifiers into the log structures of the plurality of log data respectively to obtain the plurality of target log data; The storage module is used to encrypt the multiple target log data and store the encrypted multiple target log data in a preset storage unit.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.