WO2025123746A1 - 一种车机日志记录方法、系统及车辆 - Google Patents

一种车机日志记录方法、系统及车辆 Download PDF

Info

Publication number
WO2025123746A1
WO2025123746A1 PCT/CN2024/112985 CN2024112985W WO2025123746A1 WO 2025123746 A1 WO2025123746 A1 WO 2025123746A1 CN 2024112985 W CN2024112985 W CN 2024112985W WO 2025123746 A1 WO2025123746 A1 WO 2025123746A1
Authority
WO
WIPO (PCT)
Prior art keywords
log
rules
statistical
vehicle
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2024/112985
Other languages
English (en)
French (fr)
Inventor
尹旻
杨明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Faw Beijing Software Technology Co Ltd
FAW Group Corp
Original Assignee
Faw Beijing Software Technology Co Ltd
FAW Group Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Faw Beijing Software Technology Co Ltd, FAW Group Corp filed Critical Faw Beijing Software Technology Co Ltd
Publication of WO2025123746A1 publication Critical patent/WO2025123746A1/zh
Anticipated expiration legal-status Critical
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0736Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in functional embedded systems, i.e. in a data processing system designed as a combination of hardware and software dedicated to performing a certain function
    • G06F11/0739Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in functional embedded systems, i.e. in a data processing system designed as a combination of hardware and software dedicated to performing a certain function in a data processing system embedded in automotive or aircraft systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the log system is an indispensable basic tool in development.
  • the log system is very important, which can provide key data information for reproducing and locating problems, analyzing system operation status, etc., especially for the vehicle system that developers cannot debug at any time (during road testing or user driving, online debugging is not possible, and these scenarios are more common).
  • the log file storage time is short. For example, if the log storage space is 500M, if the log output is 100M per minute, only 5 minutes of logs can be saved; if the log output is 10M per minute, 50 minutes of logs can be saved.
  • the log coverage period is short, it is not conducive to analyzing and locating the problem.
  • the log is analyzed and it is found that the relevant log may have been overwritten.
  • a patent document with publication number CN115373963A discloses a log statistics method, device and server, which obtains a list of log records in a log warehouse within a preset time period, extracts user identifiers in the log records, and groups the log records in the log record list based on the user identifier to generate multiple log groups; for each log record in the log group, generates work description information corresponding to the user identifier according to the work information; summarizes the work description information to generate a description of the work content of the user identifier within the time period.
  • Log content is close to semi-structured data, the content format is not standard, many details need to be processed, and the processing process is complex, time-consuming, and prone to errors.
  • a vehicle log recording method provided to achieve the purpose of the present invention includes:
  • the log in response to a log output request, is processed to generate log information, specifically including:
  • the sent log is received by the log service and formatted by the log service.
  • the log information is classified based on defined log rules, specifically including:
  • the log information is classified and divided.
  • real-time statistics are performed on the classified log information to generate statistical results, which specifically include:
  • the defined statistical rules include:
  • the log information is counted in real time to generate statistical results
  • the statistical results are stored independently and can be viewed in real time.
  • real-time statistics are performed on the classified log information to generate statistical results, which also includes:
  • process number rule and the thread number rule count the number of bytes of each process ID and each thread ID
  • log indicators related to system stability are counted
  • correlation statistics are performed on related applications.
  • analyzing and saving the statistical results and outputting the logs specifically include:
  • a log information statistics module is configured to perform real-time statistics on the classified log information based on defined statistical rules and generate statistical results
  • a vehicle log recording method includes:
  • the log in response to a log output request, the log is processed to generate log information, specifically including sending the log in response to the log output request;
  • the log is formatted to generate log information; wherein the sent log is received by the log service and formatted by the log service.
  • the log service receives the output log according to the log output request, formats the output log, and generates log information.
  • the output log can be received in real time and formatted, which lays the foundation for subsequent log statistics.
  • log rules are first defined, and log information is classified according to the defined log rules
  • log rules can be flexibly set according to the commonality, individuality and functionality of the logs, with the purpose of distinguishing different types of information contained in the logs.
  • the log information is classified based on defined log rules, specifically, the defined log rules include time rules, process number rules, thread number rules, log level rules, log tag rules and log body rules; based on the defined log rules, the log information is classified and divided.
  • the defined log rules include time rules, process number rules, thread number rules, log level rules, log tag rules and log body rules; based on the defined log rules, the log information is classified and divided.
  • the defined log rules include time rules, process number rules, thread number rules, log level rules, log Tag rules and log body rules.
  • the time rule is the time attribute of the log
  • the process number rule and the thread number rule are the naming rules of the process number and the thread number, that is, the process number and the thread number
  • the log level rule is the alarm rule, that is, it is set according to the error priority that affects the security or stability of the system
  • the log Tag rule is a marking rule for easy search
  • the log body rule is the log message body after the tag. According to the defined log rules, the log information is classified and divided, so that the log information is clear and convenient for subsequent log statistics.
  • this step firstly, a statistical rule is defined, and the classified log information is counted in real time according to the defined statistical rule to generate a statistical result;
  • the classified log information is counted in real time to generate statistical results, specifically including defining statistical rules for defining statistical time intervals, risk conditions and abnormal conditions; based on the defined statistical rules, the log information is counted in real time to generate statistical results; wherein the statistical results are independently stored and can be viewed in real time.
  • the statistical rules are defined as time intervals, risk conditions and abnormal conditions, which can be understood as the time intervals that need to be counted, the conditions that may cause risks to be counted, and the conditions that may cause abnormalities that affect the system.
  • the log information can be counted in real time and statistical results can be generated.
  • the statistical results can be stored independently and can be viewed in real time, so that problems can be discovered in time.
  • the classified log information is counted in real time to generate statistical results, which also includes determining the statistical time interval based on the time rule; based on the time interval shown, counting the log volume of the log tag according to the log tag rule; counting the number of bytes of each process ID and each thread ID according to the process number rule and the thread number rule; counting log indicators related to system stability according to the log level rule; and performing associated statistics on related applications according to the log subject rule.
  • the statistical results are analyzed and saved, and the logs are output;
  • the statistical results can be analyzed as needed, and the analysis process is performed by the log service, the statistical results after analysis are saved, and the log is output.
  • the statistical results are analyzed and saved, and the log is output, which specifically includes performing multi-dimensional analysis and evaluation on the statistical results and saving them; and outputting the log.
  • the log service When the log service receives a log output request from an application, it formats the data and outputs it to a log file.
  • the log service process can collect statistics on the required data.
  • the statistical results will be output to a file and saved. You can also use commands in the command line terminal window to view dynamic statistical information in real time.
  • logs at the Warning and Error levels may indicate risks or system errors, which are related to application and system stability indicators and require special attention.
  • Count application exception information (Exception)
  • process crashes and restart times.
  • a count exceeds a certain threshold, a risk warning is printed in the log to attract the attention of developers.
  • the log information generating module 201 is configured to process the log and generate log information in response to the log output request;
  • the log information statistics module 203 is configured to perform real-time statistics on the classified log information based on defined statistical rules and generate statistical results;
  • the log information recording module 204 is configured to analyze and save the statistical results and output the log.
  • the vehicle log recording system includes a log information generation module 201, a log information classification module 202, a log information statistics module 203 and a log information recording module 204.
  • the log information generation module 201 is configured to process the log and generate log information in response to a log output request;
  • the log information classification module 202 is configured to classify the log information based on defined log rules;
  • the log information statistics module 203 is configured to perform real-time statistics on the classified log information based on defined statistical rules to generate statistical results;
  • the log information recording module 204 is configured to analyze and save the statistical results and output the log.
  • the present invention also provides an electronic device, including: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the vehicle log recording method.
  • Figure 5 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
  • the electronic device provided by the embodiment of the present invention includes: one or more processors 710 and a storage device 720; the processor 710 in the electronic device can be one or more, and Figure 5 takes one processor 710 as an example; the storage device 720 is used to store one or more programs; the one or more programs are executed by the one or more processors 710, so that the one or more processors 710 implement the vehicle log recording method as described in any one of the embodiments of the present invention.
  • the electronic device may further include: an input device 730 and an output device 740 .
  • the processor 710, storage device 720, input device 730 and output device 740 in the electronic device may be connected via a bus or other means, and FIG5 takes the connection via a bus as an example.
  • the storage device 720 in the electronic device is a computer-readable storage medium that can be used to store one or more programs, which can be software programs, computer executable programs, and modules, such as program instructions/modules corresponding to the vehicle log recording method provided in the embodiment of the present invention.
  • the processor 710 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the storage device 720, that is, the vehicle log recording method in the above method embodiment is implemented.
  • the storage device 720 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc.
  • the storage device 720 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device.
  • the storage device 720 may further include a memory device with respect to the processor.
  • the remote memories may be connected to the device via a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
  • the input device 730 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device.
  • the output device 740 may include a display device such as a display screen.
  • the program when one or more programs included in the electronic device are executed by the one or more processors 710, the program performs the following operations:
  • the present invention also provides a computer-readable storage medium storing a computer program executable by an electronic device.
  • the computer program runs on the electronic device, the electronic device executes the steps of the vehicle log recording method.
  • the computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media.
  • the computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above.
  • Non-exhaustive list of computer-readable storage media include: 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 or 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.
  • the computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
  • the present invention also provides a vehicle, wherein the vehicle is provided with the above-mentioned vehicle log recording system.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明公开了一种车机日志记录方法、系统、电子设备、存储介质及车辆,包括响应于日志输出请求,对所述日志进行处理,生成日志信息;基于定义的日志规则,对所述日志信息进行分类;基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;分析并保存所述统计结果,输出所述日志。可在日志记录过程中动态统计相关信息,减少后期统计的工作量,可以非常精准的统计各项指标,不存在事后分析可能误判的情况,准确性以及统计效率显著提高。

Description

一种车机日志记录方法、系统及车辆 技术领域
本发明涉及车辆技术领域,特别是涉及一种车机日志记录方法、系统、电子设备、存储介质及车辆。
背景技术
日志系统是开发中不可或缺的基础工具。在车机系统中日志系统非常重要,对于复现和定位问题、分析系统运行情况等否能提供关键数据信息,尤其是对于开发人员不能随时进行调试的车机系统(在路测或用户驾驶过程中,无法联机调试,这些场景更为常见)。
实际开发中遇到的矛盾是:有限的存储空间和尽量多保存日志的需求。系统的各个模块都在不停的输出日志内容,日志文件随着时间推移不断增大。通常策略是分配一定的存储空间,当日志文件超过存储空间上限后就覆盖最旧的日志文件,即日志文件总大小是固定的,例如:
如果日志输出过多、过快,日志文件存储的时长较短。例如:日志存储空间为500M,如果每分钟输出日志100M,只能保存5分钟时长的日志;如果每分钟日志输出10M,则可保存50分钟时长日志。
如果日志覆盖时长较短,不利于分析和定位问题。当发现问题后,分析日志,发现相关日志可能已经被覆盖了。
不同应用之间输出日志存在一定竞争关系。例如:假设系统中只有A和B两个应用,应用A每分钟输出90M日志,应用B每分钟输出10M日志,在全部日志文件中,大部分空间都被应用A占用了。对于应用B,日志输出速度慢,但由于业务复杂需要长时间记录日志,此时就无法满足这个选,所输出日志会被应用A所覆盖。
解决上述问题,需要对日志进行分析和优化。哪些模块或应用日志输出的过多、过快,是否都是必要的日志,能否进行优化。或者从架构设计角度,对 各个模块的日志进行规范约束,不能超过输出要求指标等。根据分析的结果对日志进行优化、调整,提升存储效率和日志内容的有效性。
现有技术中,对日志进行优化是以量化分析为前提和基础,通常对日志进行事后分析,例如公开号为CN115373963A的专利文件公开了一种日志统计方法、装置及服务器,获取预设时间周期内日志仓库中的日志记录列表,提取日志记录中的用户标识,基于用户标识对日志记录列表中的日志记录进行分组,生成多个日志组;对于日志组中的每个日志记录,根据工作信息生成用户标识对应的工作描述信息;将工作描述信息进行汇总,生成用户标识在时间周期内的工作内容描述。
但是这种方法存在多种问题:
需要专门进行分析,由于日志量较大,还需要编写脚本等工具。具有一定的工作量。
日志内容接近半结构化数据,内容格式不标准,需要处理很多细节,处理过程复杂、费时,易出错。
由于上述格式解析等问题,不可避免的产生遗漏、错误计数等问题,导致统计结果不够精确。
发明内容
为解决现有技术中的日志记录方法不能在日志记录过程中进行动态统计的技术问题,本发明提供一种车机日志记录方法、系统、电子设备、存储介质及车辆。
为实现本发明目的提供的一种车机日志记录方法,包括:
响应于日志输出请求,对所述日志进行处理,生成日志信息;
基于定义的日志规则,对所述日志信息进行分类;
基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;
分析并保存所述统计结果,输出所述日志。
在其中一些具体实施例中,响应于日志输出请求,对所述日志进行处理,生成日志信息,具体包括:
响应于日志输出请求,对所述日志进行发送;
对发送的所述日志进行格式化处理,生成日志信息;
其中,发送的所述日志由日志服务进行接收,并由所述日志服务进行格式化处理。
在其中一些具体实施例中,基于定义的日志规则,对所述日志信息进行分类,具体包括:
所述定义的日志规则包括:
时间规则、进程号规则、线程号规则、日志等级规则、日志Tag规则以及日志主体规则;
基于定义的所述日志规则,对所述日志信息进行分类划分。
在其中一些具体实施例中,基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果,具体包括:
所述定义的统计规则包括:
定义统计时间区间、风险条件以及异常条件;
基于定义的所述统计规则,对所述日志信息进行实时统计,生成统计结果;
其中,所述统计结果进行独立存储并可实时进行查看。
在其中一些具体实施例中,基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果,还包括:
基于所述时间规则,确定统计的时间区间;
基于所示时间区间,根据所述日志Tag规则统计日志Tag的日志量;
根据所述进程号规则以及所述线程号规则,统计每个进程ID以及每个线程ID的字节数;
根据所述日志等级规则,对关系到系统稳定性的日志指标进行统计;
根据所述日志主体规则,对相关应用进行关联统计。
在其中一些具体实施例中,分析并保存所述统计结果,输出所述日志,具体包括:
对所述统计结果进行多维度分析评估,并进行保存;
将所述日志进行输出。
基于同一构思,本发明还提供一种车机日志记录系统,包括:
日志信息生成模块,配置为响应于日志输出请求,对所述日志进行处理,生成日志信息;
日志信息分类模块,配置为基于定义的日志规则,对所述日志信息进行分类;
日志信息统计模块,配置为基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;
日志信息记录模块,配置为分析并保存所述统计结果,输出所述日志。
基于同一构思,本发明还提供一种电子设备,包括:处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器执行上述车机日志记录方法的步骤。
基于同一构思,本发明还提供一种计算机可读存储介质,其存储有可由电子设备执行的计算机程序,当所述计算机程序在所述电子设备上运行时,使得所述电子设备执行上述车机日志记录方法的步骤。
基于同一构思,本发明还提供一种车辆,所述车辆设置有如上所述的车机日志记录系统。
与现有技术相比,本发明具有以下有益效果:
本发明公开了一种车机日志记录方法、系统、电子设备、存储介质及车辆,在日志记录过程中动态统计相关信息,可以更加准确、高效,在日志记录服务 增加统计功能,减少后期统计的工作量,在日志服务中进行统计,准确性更高。可以非常精准的统计各项指标,因为在源码中日志记录的各个属性都是明确的,不存在事后分析可能误判的情况。效率更高,比如对某个时间区间进行统计,如果事后分析,可能要处理多个文件、处理日志内容缺失等问题。在日志服务中进行相关统计,不会遇到此类问题,而且统计效率更高。
附图说明
图1是本发明一种车机日志记录方法在一些具体实施例的流程示意图;
图2是本发明一种车机日志记录方法在一些应用中的流程示意图;
图3是本发明一种车机日志记录方法在另一些应用中的流程示意图;
图4是本发明一种车机日志记录系统在一些具体实施例的结构示意图;
图5是本发明一种电子设备在一些具体实施例的结构示意图。
具体实施方式
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。
在本申请实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义,“多种”一般包含至少两种。
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
应当理解,尽管在本申请实施例中可能采用术语第一、第二、第三等来描述,但这些描述不应限于这些术语。这些术语仅用来将描述区分开。例如,在不脱离本申请实施例范围的情况下,第一也可以被称为第二,类似地,第二也可以被称为第一。
取决于语境,如在此所使用的词语“如果”、“若”可以被解释成为“在……时”或“当……时”或“响应于确定”或“响应于检测”。类似地,取决于语境,短语“如果确定”或“如果检测(陈述的条件或事件)”可以被解释成为“当确定时”或“响应于确定”或“当检测(陈述的条件或事件)时”或“响应于检测(陈述的条件或事件)”。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的商品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种商品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的商品或者装置中还存在另外的相同要素。
特别需要说明的是,在说明书中存在的符号和/或数字,如果在附图说明中未被标记的,均不是附图标记。
参照图1,一种车机日志记录方法,包括:
S101,响应于日志输出请求,对所述日志进行处理,生成日志信息;
具体的,在此步骤中,根据日志输出的请求对日志进行处理,生成日志信息;
可以理解的是,此步骤根据日志输出请求,即可对将要输出的日志进行监控,从而当日志输出时,对输出的日志进行处理,生成日志信息。
在其中一些应用中,响应于日志输出请求,对所述日志进行处理,生成日志信息,具体包括响应于日志输出请求,对所述日志进行发送;对发送的所述 日志进行格式化处理,生成日志信息;其中,发送的所述日志由日志服务进行接收,并由所述日志服务进行格式化处理。
可以理解的是,在此应用中日志服务根据日志输出请求,接收输出的日志,并对输出的日志进行格式化处理,生成日志信息,通过在日志输出的路径上添加日志服务,可实时接收输出的日志,并对输出的日志进行格式化处理,为后续的日志统计奠定了基础。
S102,基于定义的日志规则,对所述日志信息进行分类;
具体的,在此步骤中,首先定义日志规则,根据定义的日志规则,对日志信息进行分类;
可以理解的是,日志规则可以根据日志的共性、个性以及功能性进行灵活设置,目的是区分日志中包含的不同种类的信息。
在其中一些应用中,基于定义的日志规则,对所述日志信息进行分类,具体包括,所述定义的日志规则包括时间规则、进程号规则、线程号规则、日志等级规则、日志Tag规则以及日志主体规则;基于定义的所述日志规则,对所述日志信息进行分类划分。
可以理解的是,在此应用中,定义的日志规则包括了时间规则、进程号规则、线程号规则、日志等级规则、日志Tag规则以及日志主体规则,时间规则为日志的时间属性,进程号规则和线程号规则为进程号和线程号的命名规则,即进程号和线程号,日志等级规则为报警规则,即按影响系统安全或者稳定的报错优先级进行设置,日志Tag规则为便于查找的标记规则,日志主体规则为Tag之后的日志消息主体,根据定义的日志规则,对日志信息进行分类划分,从而使日志信息清晰了然,便于后续对日志进行统计。
S103,基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;
具体的,在此步骤中,首先定义统计规则,根据定义的统计规则对分类后的日志信息进行实时统计,生成统计结果;
可以理解的是,在此步骤中,本领域技术人员可以根据需要的统计信息进行统计规则的定义,然后根据定义的统计规则对分类后的日志信息进行实时统计,生成统计结果。
在其中一些应用中,基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果,具体包括定义的统计规则为定义统计时间区间、风险条件以及异常条件;基于定义的所述统计规则,对所述日志信息进行实时统计,生成统计结果;其中,所述统计结果进行独立存储并可实时进行查看。
可以理解的是,在此应用中将统计规则定义为时间区间、风险条件以及异常条件,可理解为需要统计的时间区间,需要统计的可能出现风险所达成的条件以及有可能出现影响系统异常所达成的条件,根据定义的统计规则即可实时对日志信息进行统计,并生成统计结果,将统计结果进行独立存储,并可实时进行查看,当出现问题时可及时发现。
在另一些应用中,基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果,还包括基于所述时间规则,确定统计的时间区间;基于所示时间区间,根据所述日志Tag规则统计日志Tag的日志量;根据所述进程号规则以及所述线程号规则,统计每个进程ID以及每个线程ID的字节数;根据所述日志等级规则,对关系到系统稳定性的日志指标进行统计;根据所述日志主体规则,对相关应用进行关联统计。
可以理解的是,在此应用中,根据定义的时间规则确定统计的时间区间,即根据统计的需要设置需要的统计的时间段或者时间节点,当确定需要统计的时间区间后,根据日志Tag规则统计日志Tag的日志量,即每次出现对应的计数加一,Tag总数也等于包含这个tag的日志行数,根据进程号规则以及线程号规则,统计每个进程ID以及每个线程ID的字节数,即产生的log总行数和 数量,根据日志等级规则,对关系到系统稳定性的日志指标进行统计,即可设置报警阈值,当出现关系到系统稳定性的日志指标时,进行报警提示,根据日志主体规则,对相关应用进行关联统计,即关联发送日志的客户端主体。
S104,分析并保存所述统计结果,输出所述日志。
具体的,在此步骤中,对统计结果进行分析并保存,将日志进行输出;
可以理解的是,在此步骤中,可根据需要对统计结果进行分析,分析过程都由日志服务进行,将分析后的统计结果进行保存,将日志进行输出。
在其中一些应用中,分析并保存所述统计结果,输出所述日志,具体包括对所述统计结果进行多维度分析评估,并进行保存;将所述日志进行输出。
可以理解的是,在此应用中,本领域技术人员可以根据实际需要对统计结果进行多维度以及多层次的分析评估,将评估结果以及统计结果进行保存,将日志进行输出。通过上述步骤可在日志记录过程中动态统计相关信息,减少后期统计的工作量,可以非常精准的统计各项指标,不存在事后分析可能误判的情况,准确性以及统计效率显著提高。
下面将结合图2和图3说明本发明一种车机日志记录方法在一些应用中的实施例,如图2和图3所示:
当日志服务收到应用发送的日志输出请求时,对数据进行格式化处理后,输出到日志文件中。
在处理过程中,日志服务进程可以对所需各项数据进行统计。
统计的结果会输出到一个文件中保存,也可以在命令行终端窗口中,通过命令实时查看动态统计信息。
下面说明具体的统计方法和统计指标。
日志内容
简要说明每行日志包含的内容和格式,以下是一行日志的示例:
2023-07-04 05:10:39.293469 715 937W ActivityManager:Start proc com.abc.settings for service{VehicleSettingService}
各字段含义:
时间:2023-07-04 05:10:39.293469
进程号:715
线程号:937
日志等级:W(表示Warning,还可能包括:Debug、Info、Error等级别)
日志Tag:ActivityManager,这是日志输出模块设置的一个标记名称,便于在日志中查找。
日志消息主体:tag之后的部分就是日志的消息主体,是日志输出方根据需要输出的内容。
日志服务数据统计指标包括:
日志Tag统计:
每个tag出现过的总数,例如:上述示例中,统计ActivityManager,每次出现对应的计数加一。Tag总数也等于包含这个tag的日志行数。
包含这个tag的日志量(字节数),统计使用这个tag总共输出的多大的日志量。
统计一个时间区间,例如一个小时内上述各项指标,可以看出日志输出是否平稳,是否存在波动性,并可进一步分析原因。
进程和线程统计
统计每个进程ID(唯一)产生的log总行数和数量(字节数)。
统计每个线程ID(唯一)产生的log总行数和数量(字节数)。
对时间区间统计上述指标。
日志等级统计
统计某些日志等级的指标,例如:Warning和Error等级的日志可能意味着风险或系统错误,关系到应用和系统稳定性指标,需要重点关注。
每个等级日志的输出总函数。
按时间区间统计的日志行数。
可设置报警阈值,例如:如果达到每个小时10条Error日志,则在日志中记录风险提示信息,以提醒研发人员关注。
按时间进行整体统计
不区分应用模块、Tag,统计日志整体的输出速度,例如:每分钟输出行数、日志量(字节数)
按时间区间进行分段统计,输出速度是否变化或者异常。
异常情况统计
统计应用异常信息(Exception)、进程崩溃、重启的次数,当某项计数超过一定的阈值时,在日志中打印风险提示,应引起开发人员的注意。
还可通过配置,对指定关键字进行统计分析,关注用户自定义的统计实践。
根据上述统计指标,可能得到一些结论:
根据日志速度,可以估算出给定日志存储空间可以保存的日志时长。
判断日志整体输出量是否合理,如果过快,需要进行优化的比例是多少。
可以根据日志tag或进程统计指标,筛选出哪些模块或者应用进程的日志超标,需要有针对性的进行优化或精简。
根据实际需要通过进一步分析,可以得到更多的一些结论,进而对日志内容从不同的层面和维度进行评估,为日志设计、优化提供有针对性的指导。
数据统计的功能已经内置到日志服务中,无需再对日志进行额外的处理,不会增加分析工作量。
对于上述实施例公开的方法步骤,出于简单描述的目的将方法步骤表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明实施例并不受所描述的动作顺序的限制,因为依据本发明实施例,某些步骤可以采用其他顺序或 者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本发明实施例所必须的。
如图4所示,本发明还提供一种车机日志记录系统,其特征在于,包括:
日志信息生成模块201,配置为响应于日志输出请求,对所述日志进行处理,生成日志信息;
日志信息分类模块202,配置为基于定义的日志规则,对所述日志信息进行分类;
日志信息统计模块203,配置为基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;
日志信息记录模块204,配置为分析并保存所述统计结果,输出所述日志。
具体的,本实施例提供的车机日志记录系统包括日志信息生成模块201、日志信息分类模块202、日志信息统计模块203以及日志信息记录模块204,日志信息生成模块201,配置为响应于日志输出请求,对所述日志进行处理,生成日志信息;日志信息分类模块202,配置为基于定义的日志规则,对所述日志信息进行分类;日志信息统计模块203,配置为基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;日志信息记录模块204,配置为分析并保存所述统计结果,输出所述日志。
值得注意的是,虽然在本发明实施例中只披露了一些基本功能模块,但并不意味着本系统的组成仅仅局限于上述基本功能模块,相反,本实施例所要表达的意思是:在上述基本功能模块的基础之上本领域技术人员可以结合现有技术任意添加一个或多个功能模块,形成无穷多个实施例或技术方案,也就是说本系统是开放式而非封闭式的,不能因为本实施例仅仅披露了个别基本功能模块,就认为本发明权利要求的保护范围局限于所公开的基本功能模块。同时,为了描述的方便,描述以上装置时以功能分为各种单元、模块分别描述。当然 在实施本发明时可以把各单元、模块的功能在同一个或多个软件和/或硬件中实现。
如图5所示,本发明还提供一种电子设备,包括:处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器执行车机日志记录方法的步骤。
图5是本发明实施例提供的一种电子设备的结构示意图。如图5所示结构,本发明实施例中提供的电子设备包括:一个或多个处理器710和存储装置720;该电子设备中的处理器710可以是一个或多个,图5中以一个处理器710为例;存储装置720用于存储一个或多个程序;所述一个或多个程序被所述一个或多个处理器710执行,使得所述一个或多个处理器710实现如本发明实施例中任一项所述的车机日志记录方法。
该电子设备还可以包括:输入装置730和输出装置740。
该电子设备中的处理器710、存储装置720、输入装置730和输出装置740可以通过总线或其他方式连接,图5中以通过总线连接为例。
该电子设备中的存储装置720作为一种计算机可读存储介质,可用于存储一个或多个程序,所述程序可以是软件程序、计算机可执行程序以及模块,如本发明实施例中所提供的车机日志记录方法对应的程序指令/模块。处理器710通过运行存储在存储装置720中的软件程序、指令以及模块,从而执行电子设备的各种功能应用以及数据处理,即实现上述方法实施例中车机日志记录方法。
存储装置720可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据电子设备的使用所创建的数据等。此外,存储装置720可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储装置720可进一步包括相对于处理 器710远程设置的存储器,这些远程存储器可以通过网络连接至设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置730可用于接收输入的数字或字符信息,以及产生与电子设备的用户设置以及功能控制有关的键信号输入。输出装置740可包括显示屏等显示设备。
并且,当上述电子设备所包括一个或者多个程序被所述一个或者多个处理器710执行时,程序进行如下操作:
响应于日志输出请求,对所述日志进行处理,生成日志信息;
基于定义的日志规则,对所述日志信息进行分类;
基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;
分析并保存所述统计结果,输出所述日志。
本发明还提供一种计算机可读存储介质,其存储有可由电子设备执行的计算机程序,当所述计算机程序在所述电子设备上运行时,使得所述电子设备执行车机日志记录方法的步骤。
具体的,本发明实施例的计算机存储介质,可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
本发明还提供一种车辆,所述车辆设置有上所述的车机日志记录系统。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (10)

  1. 一种车机日志记录方法,其特征在于,包括:
    响应于日志输出请求,对所述日志进行处理,生成日志信息;
    基于定义的日志规则,对所述日志信息进行分类;
    基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;
    分析并保存所述统计结果,输出所述日志。
  2. 根据权利要求1所述的车机日志记录方法,其特征在于,响应于日志输出请求,对所述日志进行处理,生成日志信息,具体包括:
    响应于日志输出请求,对所述日志进行发送;
    对发送的所述日志进行格式化处理,生成日志信息;
    其中,发送的所述日志由日志服务进行接收,并由所述日志服务进行格式化处理。
  3. 根据权利要求1所述的车机日志记录方法,其特征在于,基于定义的日志规则,对所述日志信息进行分类,具体包括:
    所述定义的日志规则包括:
    时间规则、进程号规则、线程号规则、日志等级规则、日志Tag规则以及日志主体规则;
    基于定义的所述日志规则,对所述日志信息进行分类划分。
  4. 根据权利要求3所述的车机日志记录方法,其特征在于,基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果,具体包括:
    所述定义的统计规则包括:
    定义统计时间区间、风险条件以及异常条件;
    基于定义的所述统计规则,对所述日志信息进行实时统计,生成统计结果;
    其中,所述统计结果进行独立存储并可实时进行查看。
  5. 根据权利要求3所述的车机日志记录方法,其特征在于,基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果,还包括:
    基于所述时间规则,确定统计的时间区间;
    基于所示时间区间,根据所述日志Tag规则统计日志Tag的日志量;
    根据所述进程号规则以及所述线程号规则,统计每个进程ID以及每个线程ID的字节数;
    根据所述日志等级规则,对关系到系统稳定性的日志指标进行统计;
    根据所述日志主体规则,对相关应用进行关联统计。
  6. 根据权利要求1所述的车机日志记录方法,其特征在于,分析并保存所述统计结果,输出所述日志,具体包括:
    对所述统计结果进行多维度分析评估,并进行保存;
    将所述日志进行输出。
  7. 一种车机日志记录系统,其特征在于,包括:
    日志信息生成模块,配置为响应于日志输出请求,对所述日志进行处理,生成日志信息;
    日志信息分类模块,配置为基于定义的日志规则,对所述日志信息进行分类;
    日志信息统计模块,配置为基于定义的统计规则,对所述分类后的日志信息进行实时统计,生成统计结果;
    日志信息记录模块,配置为分析并保存所述统计结果,输出所述日志。
  8. 一种电子设备,其特征在于,包括:处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器执行权利要求1至6中任一项所述方法的步骤。
  9. 一种计算机可读存储介质,其特征在于,其存储有可由电子设备执行的计算机程序,当所述计算机程序在所述电子设备上运行时,使得所述电子设备执行权利要求1至6中任一项所述方法的步骤。
  10. 一种车辆,其特征在于,所述车辆设置有如权利要求7所述的车机日志记录系统。
PCT/CN2024/112985 2023-12-13 2024-08-19 一种车机日志记录方法、系统及车辆 Pending WO2025123746A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202311709351.5A CN117931489A (zh) 2023-12-13 2023-12-13 一种车机日志记录方法、系统及车辆
CN202311709351.5 2023-12-13

Publications (1)

Publication Number Publication Date
WO2025123746A1 true WO2025123746A1 (zh) 2025-06-19

Family

ID=90758229

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/112985 Pending WO2025123746A1 (zh) 2023-12-13 2024-08-19 一种车机日志记录方法、系统及车辆

Country Status (2)

Country Link
CN (1) CN117931489A (zh)
WO (1) WO2025123746A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931489A (zh) * 2023-12-13 2024-04-26 中国第一汽车股份有限公司 一种车机日志记录方法、系统及车辆
CN118643513A (zh) * 2024-06-21 2024-09-13 岚图汽车科技有限公司 汽车日志管理方法、装置、设备和存储介质
CN119415574A (zh) * 2024-09-30 2025-02-11 中国第一汽车股份有限公司 日志数据统计方法、装置、介质及电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050021701A1 (en) * 2001-01-12 2005-01-27 Hitachi, Ltd. Log analyzing method, execution apparatus for the same, and recording medium for recording process program thereof
CN107391746A (zh) * 2017-08-10 2017-11-24 深圳前海微众银行股份有限公司 日志分析方法、设备和计算机可读存储介质
CN115580608A (zh) * 2022-08-25 2023-01-06 国能朔黄铁路发展有限责任公司 机车日志文件传输方法、装置、存储介质及电子设备
CN117931489A (zh) * 2023-12-13 2024-04-26 中国第一汽车股份有限公司 一种车机日志记录方法、系统及车辆

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050021701A1 (en) * 2001-01-12 2005-01-27 Hitachi, Ltd. Log analyzing method, execution apparatus for the same, and recording medium for recording process program thereof
CN107391746A (zh) * 2017-08-10 2017-11-24 深圳前海微众银行股份有限公司 日志分析方法、设备和计算机可读存储介质
CN115580608A (zh) * 2022-08-25 2023-01-06 国能朔黄铁路发展有限责任公司 机车日志文件传输方法、装置、存储介质及电子设备
CN117931489A (zh) * 2023-12-13 2024-04-26 中国第一汽车股份有限公司 一种车机日志记录方法、系统及车辆

Also Published As

Publication number Publication date
CN117931489A (zh) 2024-04-26

Similar Documents

Publication Publication Date Title
WO2025123746A1 (zh) 一种车机日志记录方法、系统及车辆
US20180365085A1 (en) Method and apparatus for monitoring client applications
CN111581054A (zh) 一种基于elk的日志埋点的业务分析告警系统及方法
CN111881011A (zh) 日志管理方法、平台、服务器及存储介质
CN111581057B (zh) 一种通用日志解析方法、终端设备及存储介质
CN110224874B (zh) 一种设备故障的处理方法及装置
CN113505044B (zh) 数据库告警方法、装置、设备和存储介质
CN115827374A (zh) 应用日志的管理方法、装置、电子设备及可读存储介质
CN114595765A (zh) 数据处理方法、装置、电子设备及存储介质
CN116881100A (zh) 日志检测方法、日志告警方法、系统、设备及存储介质
CN110941632A (zh) 一种数据库审计方法、装置及设备
CN112698890A (zh) 函数耗时采集方法、装置、设备及存储介质
CN120973640A (zh) 一种用于监控告警信息的方法及相关设备
CN113806196A (zh) 根因分析方法及系统
CN114356257A (zh) 日志打印方法、装置、计算机设备、存储介质和程序产品
CN113961414A (zh) 一种日志数据的处理方法、装置、设备及存储介质
CN118708555A (zh) 应用于商旅平台的日志管理系统、方法、电子设备及存储介质
CN118312526A (zh) 一种异常sql定位方法、装置、电子设备及存储介质
CN115237886A (zh) 一种Redis的安全审计方法、终端以及存储介质
US20210182453A1 (en) Application behavior identification
CN115757045A (zh) 一种交易日志分析方法、系统及装置
CN116185964A (zh) 日志处理方法、装置、电子设备和存储介质
CN115766292A (zh) 报文系统产出安全日志数据的处理方法及装置
CN112699169A (zh) 基于慢日志的隐患挖掘方法、装置、计算机设备和介质
CN118349452B (zh) 日志检测方法、日志检测装置以及电子装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24902172

Country of ref document: EP

Kind code of ref document: A1