Log storage method, system, electronic device and storage medium
By standardizing the processing and type distinction of vehicle-side logs, unified storage and management of logs is realized, the problem of irregular log storage in the existing technology is solved, and the meticulousness of vehicle supervision and management and the ability to store and view logs is enhanced.
Patent Information
- Application Number
- CN202210761297.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-06-29
AI Technical Summary
The prior art CR-end log storage method has problems such as inconsistent and irregular log storage and management, and cannot provide unified log storage, management and viewing channels, especially for MCU devices with limited resources, it is impossible to realize long-term log storage.
By obtaining the logs to be stored and performing log specifications, distinguishing the log types, uploading the logs to the preset storage area according to the type matching delivery method, realizing standardized storage, providing detailed specifications for log format, level, storage and cloud access, and adopting service-oriented Architectural methods for log storage and management.
It realizes unified and standardized processing of vehicle-side logs, enhances the meticulousness of vehicle supervision and management, ensures driving safety, and provides local and cloud storage and viewing channels for logs, solving the inconsistent problem of log storage and management.
Smart Images

Figure CN115114250B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a log storage method, system, electronic device and storage medium. Background Art
[0002] As the computing power of vehicle-side chips continues to increase and vehicle-side applications gradually increase, it is very necessary to standardize the printing and storage of vehicle-side application logs. However, in the prior art, the vehicle-side log storage method has the problem of inconsistent and non-standardized log storage and management. At the same time, the existing vehicle-side log storage method has the problem of being unable to standardize logs and the log usage specifications are not detailed, such as being unable to provide a unified log storage, management and viewing channel, and being unable to provide a long-term log storage channel for MCUs (Microcontroller Units, referred to as MCUs) with fewer resources. Summary of the invention
[0003] In view of the above-mentioned shortcomings of the prior art, the present application provides a log storage method, system, electronic device and storage medium to solve the above-mentioned technical problems.
[0004] The present application provides a log storage method, the method comprising the following steps:
[0005] Obtaining the log to be stored, and performing log standardization on the log to be stored to obtain a standardized log;
[0006] Distinguishing data sources of the standard logs to determine log types of the standard logs;
[0007] The log delivery method is matched according to the log type, and the standard log is uploaded to a preset storage area based on the matched log delivery method, so as to perform standard storage on the log to be stored.
[0008] In one embodiment of the present application, the process of performing log standardization on the log to be stored to obtain the standardized log includes:
[0009] Obtaining a preset log standardization method, and selecting at least one log standardization method from the preset log standardization methods;
[0010] Performing corresponding log standardization on the log to be stored by using the selected log standardization method to obtain a standardized log, which is recorded as a standardized log;
[0011] Among them, the preset log standardization method includes at least one of the following: log format specification, log level specification, log storage specification, log usage specification, and log cloud specification.
[0012] In one embodiment of the present application, the process of distinguishing the data source of the standard log and determining the log type of the standard log includes:
[0013] Compare the data source of the specification log with the data source of the application log to determine whether the specification log is an application log;
[0014] If the data source of the specification log is the same as the data source of the application log, determining that the log type of the specification log is an application log;
[0015] If the data source of the standard log is different from the data source of the application log, it is determined that the log type of the standard log is a non-application log.
[0016] In one embodiment of the present application, the process of matching the log delivery method according to the log type includes:
[0017] Obtaining the log type of the standard log, and matching the log delivery mode based on the log type of the standard log;
[0018] If the log type of the standard log is an application log, the log delivery mode matched with the standard log includes a data distribution service mode;
[0019] If the log type of the standard log is a non-application log, the log delivery mode matched by the standard log includes a socket mode.
[0020] In one embodiment of the present application, the process of uploading the standard log to the preset storage area based on the matching log delivery method includes:
[0021] If the log delivery method matched to the application log is a data distribution service method, uploading the application log to a local storage area and / or a cloud storage area based on the data distribution service method;
[0022] If the log delivery mode matched for the non-application log is a socket mode, the non-application log is uploaded to a local storage area and / or a cloud storage area based on the socket mode.
[0023] In one embodiment of the present application, the process of uploading the standard log to the preset storage area based on the matching log delivery method further includes:
[0024] Uploading the application log to the log module based on the data distribution service mode, and uploading the non-application log to the log module based on the socket mode;
[0025] Uploading the logs received by the log module to the local storage area for local storage; and,
[0026] Respond to the log viewing request, obtain the log to be viewed, and upload the log to be viewed to the cloud storage area through the data distribution service.
[0027] In one embodiment of the present application, the method further includes:
[0028] Get the logging SDK dependencies and logging SDK environment;
[0029] Based on the logging software development kit dependency and the logging software development kit environment, copy the logging software development kit folder to the root directory of the application project;
[0030] Modify the configuration file in the log software development kit, and save the modified configuration file to the root directory of the application project;
[0031] Write the software package compilation process input file in the root directory of the application project, compile and apply the written result, and integrate the log module.
[0032] The present application also provides a log storage system, the system comprising:
[0033] The collection module is used to obtain the logs to be stored;
[0034] A standardization module, used for performing log standardization on the log to be stored to obtain a standardized log;
[0035] A distinguishing module, used to distinguish the data source of the standard log and determine the log type of the standard log;
[0036] The storage module is used to match the log delivery method according to the log type, and upload the standard log to a preset storage area based on the matched log delivery method, so as to perform standard storage on the log to be stored.
[0037] The present application also provides an electronic device, the electronic device comprising:
[0038] one or more processors;
[0039] The storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the electronic device implements the log storage method as described in any one of the above.
[0040] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes any of the log storage methods described above.
[0041] As described above, the present application provides a log storage method, system, electronic device and storage medium, which have the following beneficial effects:
[0042] This application first obtains the log to be stored, and then performs log standardization on the log to be stored to obtain a standardized log; then the data source of the standardized log is distinguished to determine the log type of the standardized log; finally, the log delivery method is matched according to the log type, and the standardized log is uploaded to the preset storage area based on the matched log delivery method, so as to perform standardized storage on the log to be stored. This application can define the log specification of the vehicle-side application by performing standardized processing on the log to be stored, thereby solving the problem of non-standardization in log storage in the current prior art. That is, this application proposes a vehicle-side log local storage method based on a service-oriented architecture service (SOA service for short), which can perform more unified and standardized processing on the vehicle-side log module, so that the supervision and management of the vehicle by the vehicle-side log is more detailed and in place, thereby better ensuring the safety of drivers. At the same time, the present application can provide more detailed, unified and specific specifications for the log format, log level, log file storage, log usage and log uploading to the cloud in the log usage specifications, which is equivalent to providing the usage specifications of the vehicle-side log SDK (Software Development Kit, software development kit, referred to as SDK). Not only can the logs be stored locally, but the logs can also be pulled offline to the cloud for viewing, thereby solving the problem that the current existing technology cannot provide a unified log storage, management and viewing channel.
[0043] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0045] Figure 1 A schematic diagram of an exemplary system architecture for applying the technical solutions in one or more embodiments of the present application;
[0046] Figure 2 A flow chart of a log storage method provided in an embodiment of the present application;
[0047] Figure 3 A schematic diagram of the architecture of a log storage method provided in an embodiment of the present application;
[0048] Figure 4 A schematic diagram of the flow of an integrated log module provided in an embodiment of the present application;
[0049] Figure 5 A schematic diagram of the hardware structure of a log storage system provided in an embodiment of the present application;
[0050] Figure 6 The hardware structure diagram of an electronic device suitable for implementing one or more embodiments of the present application. DETAILED DESCRIPTION
[0051] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.
[0052] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0053] In the following description, a lot of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0054] SDA platform: a super digital platform for smart cars that provides full-scenario services for users.
[0055] SOA: Service-Oriented Architecture.
[0056] DDS: Data Distribution Service, abbreviated as DDS.
[0057] OS: Operating System, operating system, referred to as OS.
[0058] VIU: Vehicle Identification Unit, vehicle identification unit, abbreviated as VIU.
[0059] ECU: Electronic Control Unit, electronic control unit, abbreviated as ECU.
[0060] APP: Application, referred to as APP.
[0061] DLT: diagnostic Log and Trace, diagnostic log and trace, referred to as DLT.
[0062] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution in one or more embodiments of the present application can be applied is shown. Figure 1 As shown, the system architecture 100 may include a terminal device 110, a network 120, and a server 130. The terminal device 110 may include various electronic devices such as a smart phone, a tablet computer, a laptop computer, and a desktop computer. The server 130 may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The network 120 may be a communication medium of various connection types that can provide a communication link between the terminal device 110 and the server 130, such as a wired communication link or a wireless communication link.
[0063] According to the implementation requirements, the system architecture in the embodiment of the present application can have any number of terminal devices, networks and servers. For example, the server 130 can be a server group composed of multiple server devices. In addition, the technical solution provided in the embodiment of the present application can be applied to the terminal device 110, can also be applied to the server 130, or can be implemented by the terminal device 110 and the server 130 together, and the present application does not make any special restrictions on this.
[0064] In one embodiment of the present application, the terminal device 110 or server 130 of the present application can obtain the log to be stored, and perform log specification on the log to be stored to obtain a standardized log; distinguish the data source of the standardized log to determine the log type of the standardized log; match the log delivery method according to the log type, and upload the standardized log to the preset storage area based on the matched log delivery method to perform standardized storage on the log to be stored. Using the terminal device 110 or the server 130 to execute the log storage method, not only can the vehicle-side log module be processed more uniformly and standardized, but also the vehicle-side log can supervise and manage the vehicle more meticulously, thereby better ensuring the safety of the driving personnel. The log format, log level, log file storage, log usage and log cloud in the log usage specification can also be more meticulous, unified and specific. It is equivalent to providing the usage specification of the vehicle-side log SDK, which can not only store the log locally, but also pull the log offline to the cloud for viewing, thereby solving the problem that the current existing technology cannot provide a unified log storage, management and viewing channel.
[0065] The above section introduces the contents of an exemplary system architecture that applies the technical solution of the present application. Next, we will continue to introduce the log storage method of the present application.
[0066] Figure 2 FIG. 1 shows a flow chart of a log storage method provided by an embodiment of the present application. Specifically, in an exemplary embodiment, Figure 2 As shown, this embodiment provides a log storage method, which includes the following steps:
[0067] S210, obtaining the log to be stored;
[0068] S220, perform log standardization on the log to be stored to obtain a standardized log. Specifically, the process of performing log standardization on the log to be stored to obtain a standardized log includes: obtaining a preset log standardization method, and selecting at least one log standardization method from the preset log standardization methods; performing corresponding log standardization on the log to be stored using the selected log standardization method, obtaining a standardized log, and recording it as a standardized log; wherein the preset log standardization method includes at least one of the following: log format specification, log level specification, log storage specification, log usage specification, and log cloud specification.
[0069] The log format is based on the DLT (diagnostic Log and Trace) open source protocol and complies with the AUTOSAR (Automotive Open System Architecture) standard. Specifically, the log format specifications for the stored logs include: time, timestamp, message counter, ecuid (controller id), appid (application id), contextid (context id), message type, level, complex mode, number of parameter segments, and log content (log content).
[0070] The log level definition is based on the dlt open source protocol and complies with the AUTOSAR standard. The log levels include: VERBOSE (detailed information), DEBUG (debugging information), INFO (notification information), WARN (warning information), ERROR (error information), and FATAL (system error). Specifically, the process of log level specification for stored logs includes:
[0071] a. The default log storage level of the application APP is WARN (alarm);
[0072] b. Unless there are special circumstances, the log level stored by the APP on the vehicle side must be INFO or above;
[0073] c. In special cases, when setting the log level below INFO, the log output volume needs to be evaluated;
[0074] d. When reading the vehicle-side application log stream through the diagnostic middleware, you can set the level of the currently read log stream, but it does not affect the level of vehicle-side log storage.
[0075] Among them, the log storage specification includes the log storage method specification and the log storage location specification. Specifically, the log storage method specification refers to storage in the form of files, and each vehicle-side application can correspond to multiple log files. File storage involves 4 parameters: logTraceFileNum (maximum number of log files that can be stored), logTraceFilePath (log file storage location), logTraceFileSize (maximum storage bytes of a single log file), and logTraceLogLevel (log file storage level). The log storage location specification means that the vehicle-side application log storage is uniformly stored and managed by the log module. The log file storage location defaults to / log / , and the file name is APP name + number, such as: / log / app / DIAG_1. In addition, the name definitions of each vehicle-side APP cannot be repeated.
[0076] Among them, the log usage specifications include log frequency specifications and log content specifications. Specifically, the log frequency specification means that the frequency of printing the vehicle-side application log is not higher than 1 / 10ms in principle. If the log frequency is higher than the required frequency, you need to evaluate the impact on the vehicle-side chip and then notify the log module management team for verification and confirmation. The log content specification means that the log content needs to contain 3 parts, namely: a 32-bit random string corresponding to each request, the function name, and the log content, and each part is separated by English characters semicolons.
[0077] Among them, the log cloud specification includes the real-time log stream cloud specification and the log file cloud specification. Specifically, the real-time log stream cloud specification means that the real-time log stream cloud method mainly includes the method through the log module client tool-dlt viewer, and the method through the diagnostic module cloud diagnostic instrument-WEB interface. The log file cloud specification means that the log file cloud method mainly includes the method through the log module client tool-dlt viewer, and the method through the diagnostic module cloud diagnostic instrument-WEB interface. Among them, in the log module API definition, C calls mainly include: logsdk_init_logger, logsdk_log, logsdk_verbose, logsdk_debug, logsdk_info, logsdk_warn, logsdk_error and logsdk_fatal.
[0078] S230, distinguishing the data source of the standard log and determining the log type of the standard log;
[0079] S240, matching a log delivery method according to the log type, and uploading the standard log to a preset storage area based on the matched log delivery method, so as to perform standard storage on the log to be stored.
[0080] In an exemplary embodiment, the process of distinguishing the data source of the standard log and determining the log type of the standard log includes: comparing the data source of the standard log with the data source of the application log to determine whether the standard log is an application log; if the data source of the standard log is the same as the data source of the application log, then determining that the log type of the standard log is an application log; if the data source of the standard log is different from the data source of the application log, then determining that the log type of the standard log is a non-application log. In addition, the process of matching the log delivery method according to the log type includes: obtaining the log type of the standard log, and matching the log delivery method based on the log type of the standard log; if the log type of the standard log is an application log, then the log delivery method matched for the standard log includes a data distribution service method; if the log type of the standard log is a non-application log, then the log delivery method matched for the standard log includes a socket method.
[0081] According to the above records, in an exemplary embodiment, the process of uploading the standard log to a preset storage area based on a matching log delivery method may include: if the log delivery method matched for the application log is a data distribution service method, uploading the application log to a local storage area and / or a cloud storage area based on the data distribution service method; if the log delivery method matched for the non-application log is a socket method, uploading the non-application log to a local storage area and / or a cloud storage area based on the socket method. Specifically, when the log type of the standard log is an application log, the local socket method is used to upload the application log; when the log type of the standard log is a non-application log, the data distribution service DDS method is used to upload the application log.
[0082] According to the above records, in an exemplary embodiment, the process of uploading the standard log to the preset storage area based on the matching log delivery method may also include: uploading the application log to the log module based on the data distribution service method, and uploading the non-application log to the log module based on the socket method; uploading the log received by the log module to the local storage area for local storage; and, responding to the log viewing request, obtaining the log to be viewed, and uploading the log to be viewed to the cloud storage area through the data distribution service method. Specifically, Figure 3 As shown, Figure 3 A schematic diagram of a log storage method is provided. Figure 3In the data acquisition module, the log module is a software application for unified log management. It is mainly responsible for real-time log collection and reporting log information to the DDS service to the data acquisition module; among them, the reported logs include: OS logs, middleware logs, application logs, VIU logs and ECU logs. The data acquisition module is mainly responsible for collecting logs in the DDS service and uploading them to the cloud. The APP module is mainly responsible for integrating the log SDK to report logs in real time. In the log module architecture, the overall process of local storage of vehicle-side logs and offline pulling to the cloud for viewing is included, mainly: when the integrated log SDK in the APP module is transmitted to the log module via the local Socket, and other log information is transmitted to the log module via DDS for local storage, the log module will report the relevant log information to the data acquisition module via the DDS service. After receiving the log information in the DDS service, the data acquisition module directly uploads it to the cloud, thereby realizing the function of offline pulling to the cloud for viewing. The log module specification in this embodiment is not only for the development of the log module to define the log format, log level, log storage, and log cloud specifications, but also for the APP that needs to integrate the log SDK. Among them, Figure 3 The various modules in are explained as follows:
[0083] Label ①: Other logs are transmitted to the log module for storage using DDS.
[0084] Label ②: APP application logs are transmitted to the log module for storage using local Socket.
[0085] Mark ③: When the cloud diagnostic instrument views the corresponding APP log stream, the log module sends the corresponding APP log information to the data acquisition module through DDS and uploads it to the cloud. There are two main ways to view log files: (1) Windows operating system: use the open source dlt viewer tool to view the file (the tool will be provided with the document); (2) Linux operating system: use the open source dlt viewer command to view the file content.
[0086] Label ④: The log module will store the received log information locally.
[0087] In addition, the log module integration process in this embodiment is as follows Figure 4 As shown. Figure 4According to the records, the integration process of the log module includes: obtaining the log software development kit dependency and the log software development kit environment; based on the log software development kit dependency and the log software development kit environment, copying the log software development kit folder to the root directory of the application project; modifying the configuration file in the log software development kit, and saving the modified configuration file to the root directory of the application project; writing the software package compilation process input file in the root directory of the application project, and compiling and applying the writing result to integrate the log module. The log module integration method can be described as follows: adding log SDK dependency and environment; adding log SDK folder to the project; modifying the configuration file in the log SDK; writing CMakeLists.txt file; compiling and applying; generating results. Specifically: The log module integration process is explained as follows:
[0088] Step 1: Add logging SDK dependency and environment. Put the SDK file sdk_20220114_NeuSAR_aCore_1911_27075_jetson_agx_linux.sh into the arm64 board to be executed and execute directly: . / sdk_20220114_NeuSAR_aCore_1911_27075_jetson_agx_linux.sh, and execute to generate: export toolchain / environment.config.
[0089] Step 2: Add the log SDK folder to the project. Copy the log SDK folder logs to the root directory of the APP project.
[0090] Step 3: Modify the configuration file in the log SDK. Modify the configuration content in the log SDK configuration file logs / etc / processLogConfig.json. After compilation, the configuration file will be automatically placed in the etc folder under the root directory of the application APP.
[0091] Step 4: Write the CMakeLists.txt file. Write your own logic in the CmakeLists.txt file in logsdk (software installation package log).
[0092] Step 5: Compile the application.
[0093] Step 6: Generate results. Generate bin files and etc files. The bin file contains the executable files of this project, and the etc file contains the previous configuration file processLogConfig.json.
[0094] In summary, the present application provides a log storage method, which first obtains the log to be stored, and then performs log standardization on the log to be stored to obtain a standardized log; then distinguishes the data source of the standardized log to determine the log type of the standardized log; finally, matches the log delivery method according to the log type, and uploads the standardized log to a preset storage area based on the matched log delivery method, so as to perform standardized storage on the log to be stored. This method can define the log specification of the vehicle-side application by performing standardized processing on the log to be stored, thereby solving the problem of non-standardization in log storage in the current prior art. That is, this method proposes a vehicle-side log local storage method based on a service-oriented architecture service, which can perform more unified and standardized processing on the vehicle-side log module, so that the vehicle-side log can supervise and manage the vehicle in a more detailed and effective manner, thereby better ensuring the safety of drivers. At the same time, this method can provide more detailed, unified and specific specifications for the log format, log level, log file storage, log usage and log uploading to the cloud in the log usage specifications, which is equivalent to providing the usage specifications of the vehicle-side log software installation toolkit. Not only can the logs be stored locally, but the logs can also be pulled offline to the cloud for viewing, thus solving the problem that the current existing technology cannot provide a unified log storage, management and viewing channel.
[0095] like Figure 5 As shown, the present application also provides a log storage system, the system comprising:
[0096] The acquisition module 510 is used to obtain the logs to be stored;
[0097] The specification module 520 is used to perform log specification on the log to be stored to obtain a standardized log. Specifically, the process of performing log specification on the log to be stored to obtain a standardized log includes: obtaining a preset log specification method, and selecting at least one log specification method from the preset log specification methods; performing corresponding log specification on the log to be stored using the selected log specification method, and obtaining a standardized log, which is recorded as a standardized log; wherein the preset log specification method includes at least one of the following: log format specification, log level specification, log storage specification, log usage specification, and log cloud specification.
[0098] The log format is based on the DLT (diagnostic Log and Trace) open source protocol and complies with the AUTOSAR (Automotive Open System Architecture) standard. Specifically, the log format specifications for the stored logs include: time, timestamp, message counter, ecuid (controller id), appid (application id), contextid (context id), message type, level, complex mode, number of parameter segments, and log content (log content).
[0099] The log level definition is based on the dlt open source protocol and complies with the AUTOSAR standard. The log levels include: VERBOSE (detailed information), DEBUG (debugging information), INFO (notification information), WARN (warning information), ERROR (error information), and FATAL (system error). Specifically, the process of log level specification for stored logs includes:
[0100] a. The default log storage level of the application APP is WARN (alarm);
[0101] b. Unless there are special circumstances, the log level stored by the APP on the vehicle side must be INFO or above;
[0102] c. In special cases, when setting the log level below INFO, the log output volume needs to be evaluated;
[0103] d. When reading the vehicle-side application log stream through the diagnostic middleware, you can set the level of the currently read log stream, but it does not affect the level of vehicle-side log storage.
[0104] Among them, the log storage specification includes the log storage method specification and the log storage location specification. Specifically, the log storage method specification refers to storage in the form of files, and each vehicle-side application can correspond to multiple log files. File storage involves 4 parameters: logTraceFileNum (maximum number of log files that can be stored), logTraceFilePath (log file storage location), logTraceFileSize (maximum storage bytes of a single log file), and logTraceLogLevel (log file storage level). The log storage location specification means that the vehicle-side application log storage is uniformly stored and managed by the log module. The log file storage location defaults to / log / , and the file name is APP name + number, such as: / log / app / DIAG_1. In addition, the name definitions of each vehicle-side APP cannot be repeated.
[0105] Among them, the log usage specifications include log frequency specifications and log content specifications. Specifically, the log frequency specification means that the frequency of printing the vehicle-side application log is not higher than 1 / 10ms in principle. If the log frequency is higher than the required frequency, you need to evaluate the impact on the vehicle-side chip and then notify the log module management team for verification and confirmation. The log content specification means that the log content needs to contain 3 parts, namely: a 32-bit random string corresponding to each request, the function name, and the log content, and each part is separated by English characters semicolons.
[0106] Among them, the log cloud specification includes the real-time log stream cloud specification and the log file cloud specification. Specifically, the real-time log stream cloud specification means that the real-time log stream cloud method mainly includes the method through the log module client tool-dlt viewer, and the method through the diagnostic module cloud diagnostic instrument-WEB interface. The log file cloud specification means that the log file cloud method mainly includes the method through the log module client tool-dlt viewer, and the method through the diagnostic module cloud diagnostic instrument-WEB interface. Among them, in the log module API definition, C calls mainly include: logsdk_init_logger, logsdk_log, logsdk_verbose, logsdk_debug, logsdk_info, logsdk_warn, logsdk_error and logsdk_fatal.
[0107] A distinguishing module 530 is used to distinguish the data source of the standard log and determine the log type of the standard log;
[0108] The storage module 540 is used to match the log delivery method according to the log type, and upload the standard log to a preset storage area based on the matched log delivery method, so as to perform standard storage on the log to be stored.
[0109] In an exemplary embodiment, the process of distinguishing the data source of the standard log and determining the log type of the standard log includes: comparing the data source of the standard log with the data source of the application log to determine whether the standard log is an application log; if the data source of the standard log is the same as the data source of the application log, then determining that the log type of the standard log is an application log; if the data source of the standard log is different from the data source of the application log, then determining that the log type of the standard log is a non-application log. In addition, the process of matching the log delivery method according to the log type includes: obtaining the log type of the standard log, and matching the log delivery method based on the log type of the standard log; if the log type of the standard log is an application log, then the log delivery method matched for the standard log includes a data distribution service method; if the log type of the standard log is a non-application log, then the log delivery method matched for the standard log includes a socket method.
[0110] According to the above records, in an exemplary embodiment, the process of uploading the standard log to a preset storage area based on a matching log delivery method may include: if the log delivery method matched for the application log is a data distribution service method, uploading the application log to a local storage area and / or a cloud storage area based on the data distribution service method; if the log delivery method matched for the non-application log is a socket method, uploading the non-application log to a local storage area and / or a cloud storage area based on the socket method. Specifically, when the log type of the standard log is an application log, the local socket method is used to upload the application log; when the log type of the standard log is a non-application log, the data distribution service DDS method is used to upload the application log.
[0111] According to the above records, in an exemplary embodiment, the process of uploading the standard log to the preset storage area based on the matching log delivery method may also include: uploading the application log to the log module based on the data distribution service method, and uploading the non-application log to the log module based on the socket method; uploading the log received by the log module to the local storage area for local storage; and, responding to the log viewing request, obtaining the log to be viewed, and uploading the log to be viewed to the cloud storage area through the data distribution service method. Specifically, Figure 3 As shown, in Figure 3 In the data acquisition module, the log module is a software application for unified log management. It is mainly responsible for real-time log collection and reporting log information to the DDS service to the data acquisition module; among them, the reported logs include: OS logs, middleware logs, application logs, VIU logs and ECU logs. The data acquisition module is mainly responsible for collecting logs in the DDS service and uploading them to the cloud. The APP module is mainly responsible for integrating the log SDK to report logs in real time. In the log module architecture, the overall process of local storage of vehicle-side logs and offline pulling to the cloud for viewing is included, mainly: when the integrated log SDK in the APP module is transmitted to the log module via the local Socket, and other log information is transmitted to the log module via DDS for local storage, the log module will report the relevant log information to the data acquisition module via the DDS service. After receiving the log information in the DDS service, the data acquisition module directly uploads it to the cloud, thereby realizing the function of offline pulling to the cloud for viewing. The log module specification in this embodiment is not only for the development of the log module to define the log format, log level, log storage, and log cloud specifications, but also for the APP that needs to integrate the log SDK. Among them, Figure 3 The various modules in are explained as follows:
[0112] Label ①: Other logs are transmitted to the log module for storage using DDS.
[0113] Label ②: APP application logs are transmitted to the log module for storage using local Socket.
[0114] Mark ③: When the cloud diagnostic instrument views the corresponding APP log stream, the log module sends the corresponding APP log information to the data acquisition module through DDS and uploads it to the cloud. There are two main ways to view log files: (1) Windows operating system: use the open source dlt viewer tool to view the file (the tool will be provided with the document); (2) Linux operating system: use the open source dlt viewer command to view the file content.
[0115] Label ④: The log module will store the received log information locally.
[0116] In addition, the log module integration process in this embodiment is as follows Figure 4 As shown. Figure 4 According to the records, the integration process of the log module includes: obtaining the log software development kit dependency and the log software development kit environment; based on the log software development kit dependency and the log software development kit environment, copying the log software development kit folder to the root directory of the application project; modifying the configuration file in the log software development kit, and saving the modified configuration file to the root directory of the application project; writing the software package compilation process input file in the root directory of the application project, and compiling and applying the writing result to integrate the log module. The log module integration method can be described as follows: adding log SDK dependency and environment; adding log SDK folder to the project; modifying the configuration file in the log SDK; writing CMakeLists.txt file; compiling and applying; generating results. Specifically: The log module integration process is explained as follows:
[0117] Step 1: Add logging SDK dependency and environment. Put the SDK file sdk_20220114_NeuSAR_aCore_1911_27075_jetson_agx_linux.sh into the arm64 board to be executed and execute directly: . / sdk_20220114_NeuSAR_aCore_1911_27075_jetson_agx_linux.sh, and execute to generate: export toolchain / environment.config.
[0118] Step 2: Add the log SDK folder to the project. Copy the log SDK folder logs to the root directory of the APP project.
[0119] Step 3: Modify the configuration file in the log SDK. Modify the configuration content in the log SDK configuration file logs / etc / processLogConfig.json. After compilation, the configuration file will be automatically placed in the etc folder under the root directory of the application APP.
[0120] Step 4: Write the CMakeLists.txt file. Write your own logic in the CmakeLists.txt file in logsdk (software installation package log).
[0121] Step 5: Compile the application.
[0122] Step 6: Generate results. Generate bin files and etc files. The bin file contains the executable files of this project, and the etc file contains the previous configuration file processLogConfig.json.
[0123] In summary, the present application provides a log storage system, which first obtains the log to be stored, and then performs log standardization on the log to be stored to obtain a standardized log; then distinguishes the data source of the standardized log to determine the log type of the standardized log; finally, matches the log delivery method according to the log type, and uploads the standardized log to a preset storage area based on the matched log delivery method, so as to perform standardized storage on the log to be stored. By performing standardized processing on the log to be stored, the present system can define the log specification of the vehicle-side application, thereby being able to solve the problem of non-standardization in log storage in the current prior art. That is, the present system proposes a vehicle-side log local storage system based on a service-oriented architecture service, which can perform more unified and standardized processing on the vehicle-side log module, so that the supervision and management of the vehicle by the vehicle-side log is more detailed and in place, thereby better ensuring the safety of drivers. At the same time, the system can provide more detailed, unified and specific specifications for the log format, log level, log file storage, log usage and log uploading to the cloud in the log usage specifications, which is equivalent to providing the usage specifications of the vehicle-side log software installation toolkit. Not only can the logs be stored locally, but the logs can also be pulled offline to the cloud for viewing, thus solving the problem that the current existing technology cannot provide a unified log storage, management and viewing channel.
[0124] It should be noted that the log storage system provided in the above embodiment and the log storage method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the log storage system provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the system into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0125] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device implements the log storage method provided in the above-mentioned embodiments.
[0126] Figure 6 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 6 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0127] like Figure 6 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage part 1008 to the random access memory (RAM) 1003, such as executing the method described in the above embodiment. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002 and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0128] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0129] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1009, and / or installed from a removable medium 1011. When the computer program is executed by a central processing unit (CPU) 1001, various functions defined in the system of the present application are executed.
[0130] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0131] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0132] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0133] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor of a computer, the computer executes the log storage method as described above. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0134] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the log storage method provided in each of the above embodiments.
[0135] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A log storage method, characterized in that: The method comprises the following steps: Obtaining the log to be stored, and performing log standardization on the log to be stored to obtain a standardized log; Distinguishing the data source of the specification log to determine the log type of the specification log; including: comparing the data source of the specification log with the data source of the application log to determine whether the specification log is an application log; if the data source of the specification log is the same as the data source of the application log, determining the log type of the specification log is an application log; if the data source of the specification log is different from the data source of the application log, determining the log type of the specification log is a non-application log; The log delivery method is matched according to the log type, and the standard log is uploaded to a preset storage area based on the matched log delivery method, so as to perform standard storage on the log to be stored; the process of matching the log delivery method according to the log type includes: obtaining the log type of the standard log, and matching the log delivery method based on the log type of the standard log; if the log type of the standard log is an application log, the log delivery method matched by the standard log includes a data distribution service method; if the log type of the standard log is a non-application log, the log delivery method matched by the standard log includes a socket method.
2. The log storage method according to claim 1, characterized in that: The process of performing log standardization on the log to be stored to obtain the standardized log includes: Obtaining a preset log standardization method, and selecting at least one log standardization method from the preset log standardization methods; Performing corresponding log standardization on the log to be stored by using the selected log standardization method to obtain a standardized log, which is recorded as a standardized log; Among them, the preset log standardization method includes at least one of the following: log format specification, log level specification, log storage specification, log usage specification, and log cloud specification.
3. The log storage method according to claim 1 or 2, characterized in that: The process of uploading the standard log to the preset storage area based on the matching log delivery method includes: If the log delivery method matched to the application log is a data distribution service method, uploading the application log to a local storage area and / or a cloud storage area based on the data distribution service method; If the log delivery mode matched for the non-application log is a socket mode, the non-application log is uploaded to a local storage area and / or a cloud storage area based on the socket mode.
4. The log storage method according to claim 3, characterized in that: The process of uploading the standard log to the preset storage area based on the matching log delivery method also includes: Uploading the application log to the log module based on the data distribution service mode, and uploading the non-application log to the log module based on the socket mode; Uploading the logs received by the log module to the local storage area for local storage; and, Respond to the log viewing request, obtain the log to be viewed, and upload the log to be viewed to the cloud storage area through the data distribution service.
5. The log storage method according to claim 4, characterized in that: The method further comprises: Get the logging SDK dependencies and logging SDK environment; Based on the logging software development kit dependency and the logging software development kit environment, copy the logging software development kit folder to the root directory of the application project; Modify the configuration file in the log software development kit, and save the modified configuration file to the root directory of the application project; Write the software package compilation process input file in the root directory of the application project, compile and apply the writing result, and integrate the log module.
6. A log storage system, characterized in that: The system comprises: The collection module is used to obtain the logs to be stored; A standardization module, used for performing log standardization on the log to be stored to obtain a standardized log; A distinguishing module, used to distinguish the data source of the specification log and determine the log type of the specification log; including: comparing the data source of the specification log with the data source of the application log to determine whether the specification log is an application log; if the data source of the specification log is the same as the data source of the application log, determining that the log type of the specification log is an application log; if the data source of the specification log is different from the data source of the application log, determining that the log type of the specification log is a non-application log; A storage module is used to match the log delivery method according to the log type, and upload the standard log to a preset storage area based on the matched log delivery method, so as to perform standard storage on the log to be stored; wherein, the process of matching the log delivery method according to the log type includes: obtaining the log type of the standard log, and matching the log delivery method based on the log type of the standard log; if the log type of the standard log is an application log, the log delivery method matched by the standard log includes a data distribution service method; if the log type of the standard log is a non-application log, the log delivery method matched by the standard log includes a socket method.
7. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device, used to store one or more programs, when the one or more programs are executed by the one or more processors, enables the electronic device to implement the log storage method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the log storage method according to any one of claims 1 to 5.
