Method and apparatus for storing log files
By obtaining preset storage locations and application parameters, filtering target log files based on log modes and application types, and storing them in appropriate locations using standard or non-standard transmission protocols, the problem of complex and inefficient log file storage in autonomous driving systems is solved, achieving efficient log file management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- FOSS (HANGZHOU) INTELLIGENT TECH CO LTD
- Filing Date
- 2023-03-14
- Publication Date
- 2026-06-19
AI Technical Summary
The storage process of log files in autonomous driving systems is complex and inefficient, making fault analysis difficult.
By obtaining preset storage locations and application parameters, target log files are filtered based on log modes and application types, and stored in appropriate locations using standard or non-standard transmission protocols, and then aggregated using target storage chips.
It simplifies the log file storage process, improves storage efficiency, and facilitates fault analysis.
Smart Images

Figure CN116303301B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and more specifically, to a method and apparatus for storing log files. Background Technology
[0002] Logs serve as a crucial basis for ensuring system stability and a key debugging tool, playing a vital role in the development of autonomous driving systems. Especially during fault analysis, a well-managed log system can help staff quickly pinpoint problems. However, with the advancement of autonomous driving, the number of ECUs (Electronic Control Units) in vehicles is increasing, leading to more limitations in log transmission and storage. For example, log files generated by different applications have different interface types, transmission protocols, and storage locations, resulting in increasingly fragmented log storage, larger data volumes, and consequently, more complex and inefficient log file storage processes.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This invention provides a method and apparatus for storing log files, which at least solves the technical problems of complex process and low storage efficiency in the related art for storing log files.
[0005] According to one aspect of the present invention, a method for storing log files is provided, comprising: obtaining a preset storage location for storing log files and application parameters of an application, wherein the log files are generated by the application; filtering the log files based on the log mode in the application parameters to obtain a target log file; and storing the target log file based on the application type and the preset storage location in the application parameters.
[0006] Optionally, the target log file is stored based on the application type and preset storage location in the application parameters, including: obtaining the preset storage method corresponding to the preset storage location; and storing the target log file to the preset storage location based on the application type and preset storage method.
[0007] Optionally, storing the target log file to a preset storage location based on the application type and preset storage method includes: determining the transmission protocol for transmitting the target log file based on the application type; transmitting the target log file to a target storage chip based on the application type and transmission protocol, wherein the target storage chip is used to aggregate multiple files to be stored, the multiple files to be stored including the target log file and other target log files, the other target log files being generated by other applications; and storing the aggregated multiple files to be stored to the preset storage location.
[0008] Optionally, determining the transmission protocol for transmitting the target log file based on the application type includes: in response to the application type being a first preset type, determining the transmission protocol as a standard transmission protocol, wherein the first preset type is used to characterize that the application is on a preset middleware, and the type of the standard transmission protocol is the same as the type of the protocol used to build the preset middleware; in response to the application type being a second preset type, determining the transmission protocol as a non-standard transmission protocol, wherein the second preset type is used to characterize that the target application is not on the middleware, and the non-standard transmission protocol is different from the type of the protocol used to build the preset middleware.
[0009] Optionally, the target log file is transferred to the target storage chip based on the application type and the transmission protocol, including: in response to the application type being a first preset type, the target log file is transferred to the target storage chip according to a standard transmission protocol based on a standard output interface, wherein the standard output interface corresponds to the standard transmission protocol; in response to the application type being a second preset type, the standard output interface is encapsulated according to a preset framework, and the target log file is transferred to the target storage chip according to a non-standard transmission protocol based on the encapsulated standard output interface, wherein the non-standard interface corresponds to a non-standard protocol.
[0010] Optionally, the method further includes: in response to the application type being a first preset type, storing the target log file to a preset storage location based on the standard output interface; in response to the application type being a second preset type, encapsulating the standard output interface according to a preset framework, and storing the target log file to the preset storage location based on the encapsulated standard output interface.
[0011] Optionally, the log file is filtered based on the log mode in the application parameters to obtain the target log file, including: obtaining the configuration information in the application parameters; determining the log mode in the application parameters based on the configuration information; determining the log file as the target log file in response to the log mode being a first preset mode; and processing the log file based on the log mode and a preset processing method in response to the log mode not being the first preset mode.
[0012] Optionally, in response to the log mode not being the first preset mode, the log file is processed based on a preset processing method, including: in response to the log mode being the second preset mode, the log file is displayed based on a preset display window, wherein the second preset mode is used to characterize the mode of processing the log file in real time.
[0013] Optionally, the method further includes: in response to receiving a query instruction sent by a third server for querying log files, displaying the log files in a preset display window based on the query instruction, wherein the third server is used to represent the server monitoring the log files; in response to the log files not being displayed, obtaining the data size of the log files; in response to the data size being greater than a preset data size threshold, splitting the log files based on the preset data size threshold to obtain multiple split files, and marking the splitting order of the multiple split files; and displaying the multiple split files in the preset display window according to the splitting order.
[0014] According to another aspect of the present invention, a log file storage device is also provided, comprising: an acquisition module, configured to acquire a preset storage location for storing the log file and application parameters of an application, wherein the log file is generated by the application; a filtering module, configured to filter the log file based on the log pattern in the application parameters to obtain a target log file; and a storage module, configured to store the target log file based on the application type and the preset storage location in the application parameters.
[0015] Optionally, the storage module includes: an acquisition unit for acquiring a preset storage method corresponding to a preset storage location; and a storage unit for storing the target log file to the preset storage location based on the application type and the preset storage method.
[0016] Optionally, the storage unit includes: a determining subunit, used to determine the transmission protocol for transmitting the target log file based on the application type; a transmission subunit, used to transmit the target log file to the target storage chip based on the application type and the transmission protocol, wherein the target storage chip is used to aggregate multiple files to be stored, the multiple files to be stored including the target log file and other target log files, the other target log files being generated by other applications; and a storage subunit, used to store the aggregated multiple files to be stored to a preset storage location.
[0017] Optionally, the storage subunit is further configured to: determine the transmission protocol as a standard transmission protocol in response to the application type being a first preset type, wherein the first preset type is used to characterize that the application is on a preset middleware, and the type of the standard transmission protocol is the same as the type of the protocol used to build the preset middleware; and determine the transmission protocol as a non-standard transmission protocol in response to the application type being a second preset type, wherein the second preset type is used to characterize that the target application is not on the middleware, and the type of the non-standard transmission protocol is different from the type of the protocol used to build the preset middleware.
[0018] Optionally, the storage subunit is further configured to: in response to an application type of a first preset type, transmit the target log file to the target storage chip according to a standard transmission protocol based on a standard output interface, wherein the standard output interface corresponds to the standard transmission protocol; and in response to an application type of a second preset type, encapsulate the standard output interface according to a preset framework, and transmit the target log file to the target storage chip according to a non-standard transmission protocol based on the encapsulated standard output interface, wherein the non-standard interface corresponds to the non-standard protocol.
[0019] Optionally, the device further includes: a second storage module, configured to store the target log file to a preset storage location based on the standard output interface in response to the application type being a first preset type; and a third storage module, configured to encapsulate the standard output interface according to a preset framework in response to the application type being a second preset type, and store the target log file to the preset storage location based on the encapsulated standard output interface.
[0020] Optionally, the filtering module includes: an information acquisition unit for acquiring configuration information from application parameters; a mode determination unit for determining the log mode from application parameters based on the configuration information; a file determination unit for determining the log file as the target log file in response to the log mode being a first preset mode; and a processing unit for processing the log file based on the log mode and a preset processing method in response to the log mode not being the first preset mode.
[0021] Optionally, the filtering module further includes a display unit, used to display log files based on a preset display window in response to the log mode being a second preset mode, wherein the second preset mode is used to characterize the mode of processing log files in real time.
[0022] Optionally, the device further includes: a display module, configured to display the log file in a preset display window based on a query command sent by a third server for querying the log file, wherein the third server is used to represent a server monitoring the log file; a data volume acquisition module, configured to acquire the data volume of the log file in response to the log file not being able to be displayed; a splitting module, configured to split the log file based on a preset data volume threshold in response to the data volume exceeding a preset data volume threshold, obtaining multiple split files, and marking the splitting order of the multiple split files; and a second display module, configured to display the multiple split files in the preset display window according to the splitting order.
[0023] According to another aspect of the present invention, a computer-readable storage medium is also provided, characterized in that the computer-readable storage medium includes a stored program, wherein, when the program is running, it controls the device where the computer-readable storage medium is located to execute the above-described log file storage method.
[0024] According to another aspect of the present invention, a processor is also provided for running a program, wherein the program executes the above-described log file storage method during runtime.
[0025] In this embodiment of the invention, the following method is employed: obtaining a preset storage location for storing log files and application parameters of the application; filtering log files based on the log mode in the application parameters to obtain target log files; and storing the target log files based on the application type and the preset storage location in the application parameters. By first filtering the target log files to be stored according to the application's log mode, and then directly storing the target log files in the preset storage location based on the application's application type, the log file storage process is simplified, the efficiency of log file storage is improved, and the technical problems of complex log file storage process and low storage efficiency in related technologies are solved. Attached Figure Description
[0026] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0027] Figure 1 This is a schematic diagram illustrating log recording and output according to an embodiment of the present invention;
[0028] Figure 2 This is a flowchart illustrating a method for storing log files according to an embodiment of the present invention;
[0029] Figure 3 This is a schematic diagram illustrating the organization and summarization of target log files according to an embodiment of the present invention;
[0030] Figure 4 This is a schematic diagram illustrating a multi-type chip transmission log file according to an embodiment of the present invention;
[0031] Figure 5 This is a schematic diagram illustrating the storage of a summarized target log file according to an embodiment of the present invention;
[0032] Figure 6 This is a schematic diagram illustrating a log file filtering process according to an embodiment of the present invention;
[0033] Figure 7 This is a schematic diagram illustrating the transmission of log files using an output interface according to an embodiment of the present invention;
[0034] Figure 8 This is a schematic diagram illustrating the transmission of a query command in a log management system according to an embodiment of the present invention;
[0035] Figure 9 This is a schematic diagram illustrating a third server query log according to an embodiment of the present invention;
[0036] Figure 10 This is a schematic diagram illustrating the transmission of log files in a log management system according to an embodiment of the present invention;
[0037] Figure 11 This is a schematic diagram illustrating a third server querying log files according to an embodiment of the present invention;
[0038] Figure 12 This is a structural block diagram of a log file storage device according to an embodiment of the present invention. Detailed Implementation
[0039] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0040] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0041] Currently, log recording and storage in autonomous driving software systems are performed on a single ECU, and the log mode of applications on a single ECU is also file mode, in order to ensure that the application log files can be stored locally on the vehicle's system. Figure 1 This is a schematic diagram illustrating log recording and output according to an embodiment of the present invention, such as... Figure 1 As shown, Application 1, Application 2, and SWC (Software Component) generate log messages, then send the log messages to the logging module, which in turn sends the log messages to the bus. Finally, the log messages are recorded or output to the host computer of an external client.
[0042] However, in the past two years, with the rapid development of automotive electronic and electrical architecture and automotive software, the application of distributed systems in the field of autonomous driving has become increasingly mature. The traditional log recording mode can no longer meet the needs of software development and debugging on distributed systems such as domain controllers. It cannot collect or print log messages from multiple ECUs in real time. Furthermore, as the number of ECUs gradually increases, the storage process of log files will become increasingly complex. When staff develop and debug autonomous driving systems based on the stored log files, the workload will be very heavy.
[0043] Example 1
[0044] According to an embodiment of the present invention, a method embodiment for storing log files is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0045] Figure 2 This is a flowchart illustrating a log file storage method according to an embodiment of the present invention, such as... Figure 2 As shown, the method includes the following steps:
[0046] Step S202: Obtain the preset storage location for storing log files and the application parameters of the application.
[0047] Log files are generated by the application.
[0048] The aforementioned preset storage location can refer to a storage location for application log files determined by the user, such as a cloud server or in-vehicle storage device. Alternatively, it can refer to a storage location determined based on preset rules and application parameters. For example, if the application is currently in global log mode, the preset storage location could be a cloud server; if the application is currently in local log mode, the preset storage location could be an in-vehicle storage device.
[0049] The aforementioned applications can refer to multiple programs deployed in different regions, such as programs on vehicle middleware or programs outside of middleware. The aforementioned application parameters can refer to the application's hardware and software parameters, such as the application's functions, application address location, and application log mode.
[0050] It should be noted that the above preset storage location and application parameters are only for illustrative purposes. The specific selection of preset storage location and application parameters can be determined according to the actual situation and is not limited here.
[0051] Considering that different application parameters can affect the transmission and storage efficiency of log files, for example, if the application's address is an external device connected to the vehicle, and the default storage location is a cloud server connected to the vehicle, then the log files generated by the application cannot be stored directly. Therefore, in order to avoid the application parameters having a significant impact on the transmission and storage of log files, we can first obtain multiple log files generated by different applications, the default storage location for storing multiple log files, and the application parameters of the application.
[0052] In one alternative embodiment, in order to better apply the log management system to the vehicle's autonomous driving system, the Adaptive AUTOSAR architecture (Adaptive Automotive Open System Architecture) can be used to build the log management system.
[0053] In one optional embodiment, a middleware built on the AdaptiveAUTOSAR protocol can be set up in the log management system. The vehicle's own system applications can be deployed in the middleware to improve the efficiency of transmitting or storing log files generated by the system applications. User-configured user applications can be deployed outside the middleware to facilitate user operation and control of user applications.
[0054] Step S204: Filter log files based on the log mode in the application parameters to obtain the target log file.
[0055] The aforementioned logging modes refer to the modes used by applications to generate and process log files, such as transmission, local storage, and real-time display. These logging modes may include, but are not limited to, file mode, remote operation mode, network mode, and console mode.
[0056] In one optional embodiment, since the application has multiple logging modes, and the processing method for log files generated by the application differs depending on the logging mode, for example, if the logging mode is the file mode mentioned above, the application can send the generated log file to a preset storage location for storage; if the logging mode is the console mode mentioned above, the application can send the generated log file to a preset display window for display in real time; if the logging mode is another mode besides the above, the application can also choose to delete the generated log file. It should be noted that the above operations on log files are only illustrative examples, and the specific operations can be set according to the actual situation, and are not limited here.
[0057] Therefore, to avoid accidental operations on log files, such as mistakenly storing log files that should be deleted, the log management system can further filter the multiple log files obtained based on the log mode in the application parameters mentioned above before storing the log files based on the preset storage location, so as to obtain the target log file that needs to be stored.
[0058] In one optional embodiment of the present invention, the target log file can generally be divided into 7 levels: OFF, FATAL, CRITICAL, ERROR, WARNING, INFO, and DEBUG.
[0059] Step S206: Store the target log file based on the application type and preset storage location in the application parameters.
[0060] The application type mentioned above can refer to the type determined by the application's address location. For example, an application located on the aforementioned middleware can be considered as one type, and an application located outside the aforementioned middleware can be considered as another type.
[0061] In one optional solution of this embodiment, since the log files generated by different types of applications have different transmission and storage conditions, such as output interface and transmission protocol, the target log file can be stored based on the application type and preset storage location in the above application parameters in order to avoid mistransmission and misstorage.
[0062] In this embodiment of the invention, the following method is employed: obtaining a preset storage location for storing log files and application parameters of the application; filtering log files based on the log mode in the application parameters to obtain target log files; and storing the target log files based on the application type and preset storage location in the application parameters. By first filtering the target log files to be stored according to the application's log mode, and then directly storing the target log files in the preset storage location based on the application's application type, the log file storage process is simplified, the efficiency of log file storage is improved, and the technical problems of complex log file storage process and low storage efficiency in related technologies are solved.
[0063] Optionally, the target log file is stored based on the application type and preset storage location in the application parameters, including: obtaining the preset storage method corresponding to the preset storage location; and storing the target log file to the preset storage location based on the application type and preset storage method.
[0064] The aforementioned preset storage methods can refer to the transmission and storage methods corresponding to different application types and preset storage locations.
[0065] In one optional embodiment, since the storage conditions and storage processes corresponding to different preset storage locations have different complexities, before transferring the target log file to the preset storage location for storage, the preset storage methods corresponding to different preset storage locations can be obtained first. For example, if the preset storage location is a storage device on the vehicle's local end, the target log file can be directly transferred to the storage device through a preset output interface. If the preset storage location is a cloud server, the target log file generated by the application needs to be preprocessed, such as using a preset framework to standardize the size, format, and other information of the target log file, and then the target log file is stored in the cloud server according to the output interface, transmission protocol, and other conditions corresponding to different application types.
[0066] After obtaining the preset storage method corresponding to the preset storage location, the target log file is stored in the preset storage location according to the application type and preset storage method, thereby avoiding the transmission and storage of the target log file in the wrong storage method.
[0067] Optionally, storing the target log file to a preset storage location based on the application type and preset storage method includes: determining the transmission protocol for transmitting the target log file based on the application type; transmitting the target log file to a target storage chip based on the application type and transmission protocol, wherein the target storage chip is used to aggregate multiple files to be stored, the multiple files to be stored including the target log file and other target log files, the other target log files being generated by other applications; and storing the aggregated multiple files to be stored to the preset storage location.
[0068] The aforementioned target storage chip may refer to a chip used to organize and summarize multiple target log files sent by multiple applications on the vehicle.
[0069] Currently, vehicle log management systems are typically set up as distributed systems. In a log management system, there are multiple SOC chips (System On Chip) used to process log files. Each SOC chip can be used to process log files generated by different applications. One application generally corresponds to one SOC chip, but different SOC chips are not interconnected. This results in low efficiency of SOC chips when transmitting or storing target log files.
[0070] Therefore, in order to improve the efficiency of storing log files generated by applications in the vehicle, one SOC chip can be identified as the master SOC chip from multiple SOC chips, and a transmission bus can be set up between the multiple SOC chips. The other SOC chips can use this transmission bus to transfer their respective log files to the log disk of the master SOC chip for sorting and summarizing. The master SOC chip can be the target storage chip mentioned above.
[0071] In one optional embodiment, considering that if the preset storage location is not on the vehicle's local end, file preprocessing and file transfer operations are required, and the preprocessing methods, transfer methods, and transfer protocols differ for different application types, when the preset storage location is a server not on the vehicle's local end, such as a cloud server or a network server, the transfer protocol for transmitting the target log file can be determined first based on the application type. Then, based on the application type and the determined transfer protocol, the target log file is transferred to the target storage chip. In the target storage chip, multiple target log files, i.e., the files to be stored, can be organized and summarized. Finally, the organized and summarized target log files are stored in the preset storage location, thereby achieving the desired storage location.
[0072] Figure 3 This is a schematic diagram illustrating the organization and summarization of target log files according to an embodiment of the present invention, such as... Figure 3 As shown, a log management system can contain multiple SOC chips. If the preset storage location is not on the vehicle's local end but on a cloud server, then a primary SOC chip can be determined from among the multiple SOC chips. Figure 3 The SOC1 chip in the middle, and the other SOC chips, such as Figure 3 The SOC2 and SOC3 chips in the SOC chip can transfer their respective target log files to the log disk of the SOC1 chip. Then, the SOC1 chip organizes and summarizes the multiple target log files and transfers them to the preset storage location.
[0073] In one optional embodiment, the target storage chip can receive target log files transmitted by the SOC chip, as well as target log files transmitted by other log processing units or chips capable of processing log files, such as target log files transmitted by an MCU chip (Microcontroller Unit). Figure 4 This is a schematic diagram illustrating a multi-type chip transmission log file according to an embodiment of the present invention, such as... Figure 4As shown, in addition to the SOC chip being able to transfer the target log file to the log disk of the SOC1 chip, which is the target storage chip, the MCU chip can also transfer the target log file to be stored to the log disk of the SOC1 chip. The SOC1 chip then organizes and summarizes the target log files from both chips and uploads them to the aforementioned preset storage location.
[0074] In one optional embodiment, if the preset storage location consists of multiple servers not located on the vehicle's local end, such as the aforementioned cloud server or network server, the target storage chip, after organizing and summarizing multiple target log files, can simultaneously transmit the summarized target log files to multiple servers. Figure 5 This is a schematic diagram illustrating the storage of a summarized target log file according to an embodiment of the present invention, such as... Figure 5 As shown, in order to improve storage efficiency, when the SOC1 chip, as the target storage chip, organizes and summarizes multiple target log files, it can set the summarized target log files to different data formats according to the preset storage location, and then send the summarized target log files to the corresponding servers at the same time. Alternatively, depending on the different storage locations of the target log files, for example, if file 1 needs to be stored on the cloud server and file 2 needs to be stored on the network server, the SOC1 chip can separate file 1 and file 2 when organizing and summarizing multiple target log files, and then transfer file 1 to the cloud server for storage and file 2 to the network server for storage.
[0075] In one alternative embodiment, the application can first send the log file to the corresponding log processing chip, such as the aforementioned SOC chip, and then the log processing chip performs filtering and screening operations on the log file before sending it to the target storage chip, such as the aforementioned SOC2.
[0076] Figure 6 This is a schematic diagram illustrating a log file filtering process according to an embodiment of the present invention, such as... Figure 6 As shown, the application can first send the generated log file to the SOC chip. The operations that the SOC chip can perform on the log file include: filtering the target log file, selecting a transmission channel for transmitting the target log file, checking the length of the target log file, transmitting the target log file using the transmission channel, incrementing the target log file count, adding the target log file to the buffer of the transmission channel, and finally, the SOC chip can transmit the target log file in the buffer to the SOC1 chip and return the sent message to the application.
[0077] Optionally, determining the transmission protocol for transmitting the target log file based on the application type includes: in response to the application type being a first preset type, determining the transmission protocol as a standard transmission protocol, wherein the first preset type is used to characterize that the application is on a preset middleware, and the type of the standard transmission protocol is the same as the type of the protocol used to build the preset middleware; in response to the application type being a second preset type, determining the transmission protocol as a non-standard transmission protocol, wherein the second preset type is used to characterize that the target application is not on the middleware, and the non-standard transmission protocol is different from the type of the protocol used to build the preset middleware.
[0078] The aforementioned preset middleware may refer to the middleware built based on the Adaptive AUTOSAR protocol, the application corresponding to the first preset type may refer to the aforementioned system application, and the application corresponding to the second preset type may refer to the aforementioned user application.
[0079] In one optional embodiment, the transmission protocol can be divided into two types based on the application type: standard protocols and non-standard protocols. Standard protocols refer to the same log transmission protocol used to build the middleware described above. These protocols are generally used to transmit target log files generated by the vehicle's system applications and may include, but are not limited to, the E2E protocol (End to End, a secure end-to-end information transmission protocol) and SOME / IP protocol (Scalable service-oriented middleware over IP, a communication protocol) from the aforementioned Adaptive AUTOSAR standard protocols. Non-standard protocols refer to transmission protocols different from those used to build the middleware. These protocols are generally used to transmit target log files generated by user-configured user applications and may include, but are not limited to, UDP (User Datagram Protocol) and IPC (Inter-Process Communication) protocols.
[0080] Therefore, the transmission protocol used to transmit the target log file can be determined based on the application type, i.e., whether the application's address is on the aforementioned preset middleware.
[0081] If the application type is the first preset type, that is, the application is on the preset middleware, then the transmission protocol can be determined to be the standard transmission protocol. If the application type is the second preset type, that is, the application is not on the preset middleware, then the transmission protocol can be determined to be the non-standard transmission protocol.
[0082] Optionally, the target log file is transferred to the target storage chip based on the application type and the transmission protocol, including: in response to the application type being a first preset type, the target log file is transferred to the target storage chip according to a standard transmission protocol based on a standard output interface, wherein the standard output interface corresponds to the standard transmission protocol; in response to the application type being a second preset type, the standard output interface is encapsulated according to a preset framework, and the target log file is transferred to the target storage chip according to a non-standard transmission protocol based on the encapsulated standard output interface.
[0083] The aforementioned standard output interface may refer to an interface corresponding to a standard transmission protocol, such as the output interface corresponding to the aforementioned preset middleware.
[0084] In one optional embodiment, to avoid errors during the transmission of the target log file due to too many interface types, the standard output interface can be configured according to the aforementioned transmission protocol to transmit the target log file, for example... Figure 3 The SOC3 chip can transfer the target log file to the SOC1 chip through this standard output interface.
[0085] In one optional embodiment, since the protocol used to build the preset middleware and the protocol used to build the log management system are the same, if the above-mentioned transmission protocol is a standard transmission protocol, that is, the application type of the application is the first preset type, the log management system can directly transmit the target log file to the target storage chip through the standard output interface according to the standard transmission protocol; if the above-mentioned transmission protocol is a non-standard protocol, that is, the application type of the application is the second preset type, the target log file cannot be directly transmitted through the standard output interface, then the log management system can first encapsulate the standard output interface according to the preset framework so that the encapsulated standard output interface can transmit the target log file, and then transmit the target log file to the target storage chip through the encapsulated standard output interface according to the above-mentioned non-standard transmission protocol.
[0086] In one optional embodiment, to avoid incompatibility between some units or chips that process the target log file and the standard output interface, a non-standard transmission interface can be additionally set in the specified unit or chip to facilitate the transmission and storage of the target log file generated by the incompatible application.
[0087] Figure 7 This is a schematic diagram illustrating the transmission of log files using an output interface according to an embodiment of the present invention, such as... Figure 7As shown, the interface corresponding to the SOCn chip is a standard output interface, while the interface corresponding to the MCUn chip is a non-standard output interface. By using both types of output interfaces in the transmission of target log files, it can be ensured that all target log files can be transmitted to SOC1 for processing and summarization, effectively avoiding situations where target log files cannot be transmitted and improving the applicability of the log management system.
[0088] Optionally, the method further includes: in response to the application type being a first preset type, storing the target log file to a preset storage location based on the standard output interface; in response to the application type being a second preset type, encapsulating the standard output interface according to a preset framework, and storing the target log file to the preset storage location based on the encapsulated standard output interface.
[0089] In one optional embodiment, if the preset storage location is on the vehicle's local end, the log management system can directly write the target log file to disk without preprocessing multiple target log files through the target storage chip. Similarly, if the application type is the first preset type, the log management system can directly transmit the target log file to the preset storage location through the standard output interface. If the application type is the second preset type, the target log file cannot be directly transmitted through the standard output interface. In this case, the log management system can first encapsulate the standard output interface according to the preset framework, so that the encapsulated standard output interface can transmit the target log file. Then, the log management system transmits the target log file to the preset storage location through the encapsulated standard output interface.
[0090] Optionally, the log file is filtered based on the log mode in the application parameters to obtain the target log file, including: obtaining the configuration information in the application parameters; determining the log mode in the application parameters based on the configuration information; determining the log file as the target log file in response to the log mode being a first preset mode; and processing the log file based on the log mode and a preset processing method in response to the log mode not being the first preset mode.
[0091] The aforementioned first preset mode can refer to a log mode that requires storing log files generated by the application, and may include, but is not limited to, file mode, remote operation mode, network mode, etc.
[0092] The above configuration information may include, but is not limited to: the application's execution functions, address location, priority, etc.
[0093] In one optional embodiment, as described above, since the processing methods for log files generated by the application differ depending on the log mode, the log files generated only need to be stored when the application is in the first preset mode. Therefore, before determining the target log file, the configuration information can be obtained first, and then the application's current log mode can be determined based on the configuration information. If it is, the log file generated by the application can be determined as the target log file; if not, the log file can be further processed according to the preset processing method corresponding to the current log mode. The preset processing method may include, but is not limited to, deletion, real-time display, etc.
[0094] Optionally, in response to the log mode not being the first preset mode, the log file is processed based on a preset processing method, including: in response to the log mode being the second preset mode, the log file is displayed based on a preset display window, wherein the second preset mode is used to characterize the mode of processing the log file in real time.
[0095] The second preset mode mentioned above can refer to real-time processing of log files, such as a real-time log display mode, or the aforementioned console mode.
[0096] In one optional embodiment, after determining that the current log mode of the application is not the first preset mode, it can be further determined whether the current log mode is the second preset mode. If so, the corresponding log file can be displayed in a preset display window in real time to facilitate the user to view the log file.
[0097] Optionally, the method further includes: in response to receiving a query instruction sent by a third server for querying log files, displaying the log files in a preset display window based on the query instruction, wherein the third server is used to represent the server monitoring the log files; in response to the log files not being displayed, obtaining the data size of the log files; in response to the data size being greater than a preset data size threshold, splitting the log files based on the preset data size threshold to obtain multiple split files, and marking the splitting order of the multiple split files; and displaying the multiple split files in the preset display window according to the splitting order.
[0098] The aforementioned third server may refer to a server used to monitor log files. Users can perform operations on the log files through the third server, such as deleting, displaying, or changing the storage location.
[0099] In one optional embodiment, taking querying log files as an example, when a user sends a query command to the log management system, the log management system, after receiving the query command, can display the corresponding log file in a preset display window based on the information in the query command, such as query logs, log file identifiers, display windows, etc.
[0100] If the log file cannot be displayed, the log management system can determine whether the data volume of the log file is too large, i.e. whether it exceeds the preset data volume threshold. If it does, the log file can be split into multiple split files according to the preset data volume threshold, and the splitting order of the multiple split files can be recorded. Finally, the multiple split files can be displayed in the preset display window according to the splitting order.
[0101] In one optional embodiment, the third server can also read configuration information from multiple applications according to the log management system, and then generate an operation window based on the configuration information. This window can include information such as log level, log generation time, and log data size. Users can directly operate on the log files in the log management system through this operation window.
[0102] Figure 8 This is a schematic diagram illustrating the transmission of a query command in a log management system according to an embodiment of the present invention, such as... Figure 8 As shown, when the log management system receives a query command from the third server, the target storage chip, namely the SOC1 chip, first processes the query command to obtain the query information in the query command, such as the log file identifier and the log file generation time. Then, the query information is sent to the log processing chips, namely the SOCn chip and the MCUn chip. The log processing chip obtains the corresponding target log file and returns it to the target storage chip. Finally, the target storage chip transmits the obtained target log file (i.e., the summary file) to the third server.
[0103] Figure 9 This is a schematic diagram illustrating a third server query log according to an embodiment of the present invention, such as... Figure 9As shown, the third server can first send a query command for collecting logs to the target storage chip, such as the aforementioned SOC1 chip. At this time, the SOC1 chip can initialize the log framework, preparing to query log files according to the query command. After preparation, it sends feedback to the third server that the log framework initialization is complete. After receiving the initialization completion information, the third server can prepare to receive log files and control the SOC1 to start the log collection function. At this time, the SOC1 chip can continuously determine multiple log files from multiple log files according to the query command, such as log files 1, 2, and 3, and then send log files 1, 2, and 3 to the third server in sequence. The third server stores the received log files in sequence to different disks, such as disks 1, 2, and 3, and sends a stop collection command to the SOC1 chip. After stopping collection, the SOC1 sends feedback to the third server, and the third server can notify the user that log collection is complete.
[0104] For ease of understanding, Figure 10 This is a schematic diagram illustrating the transmission of log files by a log management system according to an embodiment of the present invention. Specifically, the log management system can first obtain the configuration information of the application and determine the current log mode of the application. If the log mode is a first preset mode, it can be determined that the log files generated by the application can be stored in a preset storage location. This log file is the target log file. At this time, according to the application type and the preset storage location, the transmission protocol and output interface for transmitting the target log file are determined, and the target log file is transmitted to the target storage chip using the transmission protocol and output interface. Multiple target log files are organized and summarized, and finally the target storage chip can transmit the summarized multiple target log files to the corresponding preset storage location.
[0105] If the log mode is not the first preset mode mentioned above, then it can be further determined whether the log mode is the second preset mode. If it is, the log file can be displayed in the preset display window in real time. If not, the log file can be stored locally or deleted.
[0106] Figure 11This is a schematic diagram illustrating a third server querying a log file according to an embodiment of the present invention. The third server can first obtain the application's configuration information and generate an operation window based on the configuration information. After receiving a query command from the user in the operation window, the third server can send the query command to the log management system and wait for the log management system to return the log file based on the query command. If the third server successfully opens the log file, it can display the log file in a preset display window, such as the operation window mentioned above. If the third server fails to open the log file, it can determine whether the data volume of the log file exceeds a preset data volume threshold. If it does, the log file can be split into multiple split files according to the preset data volume threshold, and the order of the multiple split files can be recorded. Finally, the multiple split files are displayed sequentially in the preset display window according to the order. If it does not exceed the threshold, the log file can be retrieved again.
[0107] Example 2
[0108] According to another aspect of the embodiments of the present invention, corresponding to the embodiments of the log file storage method described above, this specification also provides a log file storage device. Figure 12 This is a structural block diagram of a log file storage device according to an embodiment of the present invention, such as... Figure 12 As shown, the acquisition module 1202 is used to acquire the preset storage location for storing log files and the application parameters of the application, wherein the log files are generated by the application; the filtering module 1204 is used to filter the log files based on the log mode in the application parameters to obtain the target log file; the storage module 1206 is used to store the target log file based on the application type and preset storage location in the application parameters.
[0109] Optionally, the storage module includes: an acquisition unit for acquiring a preset storage method corresponding to a preset storage location; and a storage unit for storing the target log file to the preset storage location based on the application type and the preset storage method.
[0110] Optionally, the storage unit includes: a determining subunit, used to determine the transmission protocol for transmitting the target log file based on the application type; a transmission subunit, used to transmit the target log file to the target storage chip based on the application type and the transmission protocol, wherein the target storage chip is used to aggregate multiple files to be stored, the multiple files to be stored including the target log file and other target log files, the other target log files being generated by other applications; and a storage subunit, used to store the aggregated multiple files to be stored to a preset storage location.
[0111] Optionally, the storage subunit is further configured to: determine the transmission protocol as a standard transmission protocol in response to the application type being a first preset type, wherein the first preset type is used to characterize that the application is on a preset middleware, and the type of the standard transmission protocol is the same as the type of the protocol used to build the preset middleware; and determine the transmission protocol as a non-standard transmission protocol in response to the application type being a second preset type, wherein the second preset type is used to characterize that the target application is not on the middleware, and the type of the non-standard transmission protocol is different from the type of the protocol used to build the preset middleware.
[0112] Optionally, the storage subunit is further configured to: in response to an application type of a first preset type, transmit the target log file to the target storage chip according to a standard transmission protocol based on a standard output interface, wherein the standard output interface corresponds to the standard transmission protocol; and in response to an application type of a second preset type, encapsulate the standard output interface according to a preset framework, and transmit the target log file to the target storage chip according to a non-standard transmission protocol based on the encapsulated standard output interface, wherein the non-standard interface corresponds to the non-standard protocol.
[0113] Optionally, the device further includes: a second storage module, configured to store the target log file to a preset storage location based on the standard output interface in response to the application type being a first preset type; and a third storage module, configured to encapsulate the standard output interface according to a preset framework in response to the application type being a second preset type, and store the target log file to the preset storage location based on the encapsulated standard output interface.
[0114] Optionally, the filtering module includes: an information acquisition unit for acquiring configuration information from application parameters; a mode determination unit for determining the log mode from application parameters based on the configuration information; a file determination unit for determining the log file as the target log file in response to the log mode being a first preset mode; and a processing unit for processing the log file based on the log mode and a preset processing method in response to the log mode not being the first preset mode.
[0115] Optionally, the filtering module further includes a display unit, used to display log files based on a preset display window in response to the log mode being a second preset mode, wherein the second preset mode is used to characterize the mode of processing log files in real time.
[0116] Optionally, the device further includes: a display module, configured to display the log file in a preset display window based on a query command sent by a third server for querying the log file, wherein the third server is used to represent a server monitoring the log file; a data volume acquisition module, configured to acquire the data volume of the log file in response to the log file not being able to be displayed; a splitting module, configured to split the log file based on a preset data volume threshold in response to the data volume exceeding a preset data volume threshold, obtaining multiple split files, and marking the splitting order of the multiple split files; and a second display module, configured to display the multiple split files in the preset display window according to the splitting order.
[0117] Example 3
[0118] According to another aspect of the present invention, a computer-readable storage medium is also provided, characterized in that the computer-readable storage medium includes a stored program, wherein, when the program is running, it controls the device where the computer-readable storage medium is located to execute the above-described log file storage method.
[0119] Example 4
[0120] According to another aspect of the present invention, a processor is also provided for running a program, wherein the program executes the above-described log file storage method during runtime.
[0121] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0122] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0123] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0124] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0125] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0126] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0127] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A log file storage method characterized by comprising: The method includes: Obtain the preset storage location for storing log files, and the application parameters of the application, wherein the log files are generated by the application; The log files are filtered based on the log patterns in the application parameters to obtain the target log files; Based on the application type in the application parameters and the preset storage location, the target log file is stored, wherein the preset storage location is a server not located on the vehicle's local end; The method of storing a target log file based on the application type in the application parameters and the preset storage location includes: determining a transmission protocol for transmitting the target log file based on the application type; transmitting the target log file to a target storage chip based on the application type and the transmission protocol, wherein the target storage chip is used to aggregate multiple files to be stored, the multiple files to be stored including the target log file and other target log files, the other target log files being generated by other applications; and storing the aggregated multiple files to be stored in the preset storage location. Determining the transmission protocol for transmitting the target log file based on the application type includes: in response to the application type being a first preset type, determining the transmission protocol as a standard transmission protocol, wherein the first preset type is used to characterize that the application is on a preset middleware, the type of the standard transmission protocol is the same as the type of the protocol used to build the preset middleware, and the preset middleware is built based on the Adaptive Automotive Open System Architecture protocol; in response to the application type being a second preset type, determining the transmission protocol as a non-standard transmission protocol, wherein the second preset type is used to characterize that the target application is not on the middleware, and the type of the non-standard transmission protocol is different from the type of the protocol used to build the preset middleware.
2. The method according to claim 1, characterized in that, Based on the application type and the transmission protocol, the target log file is transmitted to the target storage chip, including: In response to the application type being a first preset type, the target log file is transmitted to the target storage chip according to the standard transmission protocol based on the standard output interface, wherein the standard output interface corresponds to the standard transmission protocol; In response to the application type being the second preset type, the standard output interface is encapsulated according to a preset framework, and based on the encapsulated standard output interface, the target log file is transmitted to the target storage chip according to the non-standard transmission protocol, wherein the encapsulated standard output interface corresponds to the non-standard protocol.
3. The method according to claim 1, characterized in that, The method further includes: In response to the application type being a first preset type, the target log file is stored in the preset storage location based on the standard output interface; In response to the application type being the second preset type, the standard output interface is encapsulated according to a preset framework, and the target log file is stored in the preset storage location based on the encapsulated standard output interface.
4. The method according to claim 1, characterized in that, The log files are filtered based on the log patterns in the application parameters to obtain target log files, including: Obtain the configuration information from the application parameters; The log mode in the application parameters is determined based on the configuration information; In response to the log mode being a first preset mode, the log file is determined to be the target log file; In response to the log mode not being the first preset mode, the log file is processed based on the log mode and the preset processing method.
5. The method according to claim 4, characterized in that, In response to the log mode not being the first preset mode, the log file is processed based on a preset processing method, including: In response to the log mode being the second preset mode, the log file is displayed based on a preset display window, wherein the second preset mode is used to characterize the mode of processing the log file in real time.
6. The method according to claim 1, characterized in that, The method further includes: In response to receiving a query instruction from a third server for querying the log file, the log file is displayed in a preset display window based on the query instruction, wherein the third server is used to represent a server monitoring the log file; In response to the log file being unable to be displayed, the size of the log file's data is obtained; In response to the data volume exceeding a preset data volume threshold, the log file is split based on the preset data volume threshold to obtain multiple split files, and the splitting order of the multiple split files is marked. The multiple split files are displayed in the preset display window according to the splitting order.
7. A storage device for log files, characterized in that, The device includes: The acquisition module is used to acquire a preset storage location for storing log files and application parameters of the application, wherein the log files are generated by the application. The filtering module is used to filter the log files based on the log pattern in the application parameters to obtain the target log files; The storage module is used to store the target log file based on the application type in the application parameters and the preset storage location, wherein the preset storage location is a server not located on the vehicle's local end; The storage module is further configured to determine a transmission protocol for transmitting the target log file based on the application type; transmit the target log file to the target storage chip based on the application type and the transmission protocol, wherein the target storage chip is configured to aggregate multiple files to be stored, the multiple files to be stored including the target log file and other target log files, the other target log files being generated by other applications; and store the aggregated multiple files to be stored in the preset storage location. The storage module is further configured to, in response to the application type being a first preset type, determine that the transmission protocol is a standard transmission protocol, wherein the first preset type is used to characterize that the application is on a preset middleware, the type of the standard transmission protocol is the same as the type of the protocol used to build the preset middleware, and the preset middleware is built based on the Adaptive Automotive Open System Architecture protocol; and to, in response to the application type being a second preset type, determine that the transmission protocol is a non-standard transmission protocol, wherein the second preset type is used to characterize that the target application is not on the middleware, and the type of the non-standard transmission protocol is different from the type of the protocol used to build the preset middleware.
Citation Information
Patent Citations
Log storage method and device
CN105868340A
Data transmission method and device, storage medium and electronic equipment
CN112291366A