CN112527612A - System log preservation method and device, vehicle-mounted system and vehicle - Google Patents

System log preservation method and device, vehicle-mounted system and vehicle Download PDF

Info

Publication number
CN112527612A
CN112527612A CN202011228254.0A CN202011228254A CN112527612A CN 112527612 A CN112527612 A CN 112527612A CN 202011228254 A CN202011228254 A CN 202011228254A CN 112527612 A CN112527612 A CN 112527612A
Authority
CN
China
Prior art keywords
log
cache space
cached
space
loss
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011228254.0A
Other languages
Chinese (zh)
Other versions
CN112527612B (en
Inventor
王岩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Co Wheels Technology Co Ltd
Original Assignee
Beijing Co Wheels Technology Co Ltd
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 Beijing Co Wheels Technology Co Ltd filed Critical Beijing Co Wheels Technology Co Ltd
Priority to CN202011228254.0A priority Critical patent/CN112527612B/en
Publication of CN112527612A publication Critical patent/CN112527612A/en
Application granted granted Critical
Publication of CN112527612B publication Critical patent/CN112527612B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure relates to a system log preservation method and device, an on-board system and a vehicle. The method comprises the following steps: acquiring a log to be cached; storing the log to be cached to a native cache space or a loss prevention cache space; at least part of the logs to be cached which are not stored in the original cache space are stored in the loss-prevention cache space; and sequentially storing the logs stored in the native cache space and the logs stored in the loss-prevention cache space to a log storage space. According to the technical scheme, the loss prevention cache space is arranged, the logs which are written in failure in the original cache space can be stored in the loss prevention cache space, and then the logs in the original cache space and the logs in the loss prevention log cache are sequentially stored in the log storage space, so that complete logs corresponding to the operation process of the system can be generated in the log storage space, the problem of log loss is favorably solved, and the whole-process effective monitoring of the operation of the system is conveniently realized.

Description

System log preservation method and device, vehicle-mounted system and vehicle
Technical Field
The disclosure relates to the technical field of vehicles, in particular to a system log preservation method and device, a vehicle-mounted system and a vehicle.
Background
With the continuous development of vehicle technology and internet technology, the degree of intelligence and interchangeability of vehicles are higher and higher. In which, the information communication between the vehicles and people, and between the vehicles and the outside (for example, between the vehicles and between the vehicles, and between the vehicles and the remote control center) is usually realized by the vehicle-mounted system.
In the prior art, following the development trend of intelligent vehicles, more and more functions, such as automatic driving, auxiliary driving, vehicle control, audio-video entertainment and the like, are added to a vehicle-mounted system, the amount of logs generated in the corresponding system debugging or running process is increased dramatically, and when a large amount of generated logs are stored simultaneously by the primary cache space of the vehicle-mounted system, the problem of serious log loss may exist.
Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, the disclosure provides a system log saving method, a system log saving device, an on-board system and a vehicle.
The embodiment of the disclosure provides a system log preservation method, which includes:
acquiring a log to be cached;
storing the log to be cached to a native cache space or a loss prevention cache space; wherein at least part of the to-be-cached logs which are not stored in the native cache space are stored in the loss prevention cache space;
and sequentially storing the logs stored in the native cache space and the logs stored in the loss-prevention cache space into a log storage space.
In some embodiments, storing the log to be cached in a native cache space or a loss-prevention cache space includes:
transmitting the log to be cached to the native cache space;
detecting the storage state of the log to be cached in the native cache space;
and if the log to be cached fails to be stored in the native cache space, storing the log to be cached in the loss-prevention cache space.
In some embodiments, storing the log to be cached in a native cache space or a loss-prevention cache space includes:
determining a remaining space of the native cache space;
determining the occupied space of the log to be cached;
determining the residual space of the loss prevention cache space;
if the size of the occupied space of the log to be cached is smaller than or equal to the size of the residual space of the native cache space, storing the log to be cached in the native cache space;
and if the size of the occupied space of the log to be cached is larger than the size of the residual space of the native cache space and is smaller than or equal to the size of the residual space of the loss-prevention cache space, storing the log to be cached in the loss-prevention cache space.
In some embodiments, storing the log to be cached in a native cache space or a loss-prevention cache space includes:
determining a remaining space of the native cache space;
if the native cache space is not full, storing the log to be cached in the native cache space;
and if the native cache space is full, storing the log to be cached in the loss-prevention cache space.
In some embodiments, the number of the loss prevention cache spaces is equal to or greater than two;
when the log to be cached is stored in the loss prevention cache space, determining the residual space of each loss prevention cache space;
storing the logs to be cached to the target loss prevention cache space based on the size of the remaining space of each loss prevention cache space and the size of the logs to be cached; the target anti-loss cache space is the anti-loss cache space in which the size of any remaining space is equal to or larger than that of the log to be cached.
In some embodiments, sequentially storing the logs in the native cache space and the logs in the loss-prevention cache space to a log storage space comprises:
acquiring the time stamp of each log in the native cache space and the time stamp of each log in the loss-prevention cache space;
and sequentially storing each log into the log storage space according to the sequence of the timestamps.
In some embodiments, storing the log to be cached to the native cache space includes:
collecting and processing the log to be cached by using a log collection process; processing the log to be cached comprises carrying out statistics, classification, filtration or sequencing operation on the log to be cached;
based on the log storage requirement, reading the processed logs to be cached according to the time sequence, the preset grades, the preset types, the preset numbers, the preset time intervals or the target content by using a log storage process, and transmitting the logs to be cached to the native cache space.
In some embodiments, storing the log to be cached in the loss prevention cache space includes:
analyzing the log to be cached;
converting the format of the analyzed log to be cached into a target log format based on the target log format associated with the loss prevention cache space;
and storing the log to be cached with the target log format to the loss prevention cache space.
In some embodiments, before storing the log to be cached in the native cache space, the method further includes:
establishing a log transmission channel between the native cache space and the log generation device by using a first network socket;
before storing the log to be cached in the loss prevention cache space, the method further includes:
and establishing a log transmission channel between the loss-prevention cache space and the log generation device by utilizing a second network socket.
The embodiment of the present disclosure further provides a system log saving device, which includes:
the log obtaining module is used for obtaining a log to be cached;
the log storage module is used for storing the log to be cached to a primary cache space or a loss prevention cache space; wherein at least part of the to-be-cached logs which are not stored in the native cache space are stored in the loss prevention cache space;
and the log integration module is used for sequentially storing the logs stored in the native cache space and the logs stored in the loss-prevention cache space into a log storage space.
In some embodiments, the log storage module comprises:
the first storage submodule is used for storing the log to be cached to the native cache space;
and the second storage submodule is used for storing the log to be cached to the loss-prevention cache space.
In some embodiments, the log storage module further comprises:
the log transmission submodule is used for transmitting the log to be cached to the native cache space;
the state detection submodule is used for detecting the storage state of the log to be cached in the native cache space;
the second storage submodule is further configured to store the log to be cached in the loss-prevention cache space if the log to be cached fails to be stored in the native cache space.
In some embodiments, the log storage module further comprises:
a first remaining space determination submodule for determining a remaining space of the native cache space;
the log occupation space determining submodule is used for determining the occupation space of the log to be cached;
a second remaining space determining submodule, configured to determine a remaining space of the loss prevention cache space;
the first storage submodule is further used for storing the log to be cached in the native cache space if the size of the occupied space of the log to be cached is smaller than or equal to the size of the remaining space of the native cache space;
the second storage submodule is further configured to store the log to be cached in the loss-prevention cache space if the size of the occupied space of the log to be cached is larger than the size of the remaining space of the native cache space and smaller than or equal to the size of the remaining space of the loss-prevention cache space.
In some embodiments, the log storage module is configured to:
the first residual space determining submodule is used for determining the residual space of the native cache space;
the first storage submodule is further used for storing the log to be cached to the native cache space if the native cache space is not full;
the second storage submodule is further configured to store the log to be cached in the loss prevention cache space if the native cache space is full.
In some embodiments, the number of the loss prevention cache spaces is equal to or greater than two;
the second remaining space determining submodule is further configured to determine a remaining space of each of the loss-prevention cache spaces when the log to be cached is stored in the loss-prevention cache space;
the second storage submodule is further configured to store the to-be-cached logs into the target anti-loss cache space based on the size of the remaining space of each anti-loss cache space and the size of the to-be-cached logs;
the target anti-loss cache space is the anti-loss cache space in which the size of any remaining space is equal to or larger than that of the log to be cached.
In some embodiments, the log integration module comprises:
the time stamp obtaining submodule is used for obtaining the time stamp of each log in the native cache space and the time stamp of each log in the loss-prevention cache space;
and the log integration sub-module is used for sequentially storing each log to the log storage space according to the sequence of the timestamps.
In some embodiments, the first storage submodule comprises:
the log collection process is used for collecting and processing the logs to be cached;
processing the log to be cached comprises carrying out statistics, classification, filtration or sequencing operation on the log to be cached;
and the log storage process is used for reading the processed logs to be cached according to the time sequence, the preset grade, the preset type, the preset number, the preset time period or the target content based on the log storage requirement, and transmitting the logs to be cached to the native cache space.
In some embodiments, the second storage submodule comprises:
the log analyzing unit is used for analyzing the log to be cached;
the log formatting unit is used for converting the format of the analyzed log to be cached into a target log format based on the target log format associated with the loss prevention cache space;
and the log storage unit is used for storing the log to be cached with the target log format to the loss-prevention cache space.
In some embodiments, the apparatus further comprises a log transmission channel, wherein:
establishing a log transmission channel between the native cache space and the log generation device by using a first network socket;
and establishing a log transmission channel between the loss-prevention cache space and the log generation device by utilizing a second network socket.
The embodiment of the present disclosure further provides an on-vehicle system, including:
a processor and a memory;
the processor is configured to perform the steps of any of the above methods by calling a program or instructions stored in the memory.
In some embodiments, the native cache space and the loss prevention cache space are provided in the same in-vehicle system; or
The native cache space and the loss prevention cache space are arranged in different vehicle-mounted systems.
The embodiment of the disclosure also provides a vehicle, which comprises the vehicle-mounted system.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages:
in the system log preservation method provided by the embodiment of the disclosure, a loss prevention cache space is set, the obtained log to be cached can be stored in the original cache space or the loss prevention cache space, and at least part of the log to be cached which is not stored in the original cache space is stored in the loss prevention cache space. Therefore, the logs to be cached which are written in failure in the original cache space can be stored in the loss-prevention cache space, and subsequently, the original cache space and the logs in the loss-prevention cache space are integrated, namely, the logs in the two cache spaces are sequentially stored in the log storage space, so that a complete log corresponding to the operation process of the system can be formed in the log storage space, the log loss problem can be improved, and the effective monitoring on the operation process of the system can be realized.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic flow chart illustrating a system log preservation method according to an embodiment of the present disclosure;
FIG. 2 is a schematic structural diagram of a system log security apparatus according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an in-vehicle system according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
In the prior art, the storage manner of the log is generally as follows: the log system transmits the logs to be cached to a log collection process through a socket, and after the logs are subjected to preliminary processing such as statistics, classification, filtering, sequencing and the like through the log collection process, the logs are transmitted to a log storage process through the socket, and the log storage process is responsible for storing the logs into a target file (which can be a local file). However, when the log storage method is applied to a vehicle-mounted system (e.g., a car machine system), since the car machine system has more complex functions and needs more services or processes to complete various functions of the car machine system, such as functions of automatic driving, auxiliary driving, car control, audio-video entertainment, etc., a lot of logs are generated during debugging or running of the services or processes in the car machine system, and the amount of logs increases dramatically compared to the small-sized mobile terminal, which causes a problem that the current car machine log system cannot meet the current log storage requirement and the logs are seriously lost.
In view of the foregoing problems, embodiments of the present disclosure provide a system log saving method, in which a log to be cached may be stored in a native cache space or a loss prevention cache space, and at least a portion of the log to be cached that is not stored in the native cache space may be stored in the loss prevention cache space. Therefore, compared with the prior art, the log lost by the native cache space can be stored in the loss-prevention cache space, and the problem of serious log loss is solved. Furthermore, the logs in the original cache space and the logs in the loss-prevention cache space can be sequentially stored in the log storage space, so that the integration of the logs is realized, and a relatively complete log file corresponding to the operation process of the system is obtained, thereby being beneficial to realizing the effective monitoring of the whole operation process of the system.
In the implementation process of the method, for example, the log to be cached of the lost log can be stored in the loss-prevention cache space only when the log to be cached is lost. Specifically, by detecting the log state written into the native cache space (hereinafter may also be referred to as "first cache"), and providing a loss-prevention cache space (hereinafter may also be referred to as "second cache") for log writing when log writing fails. It is equivalent to compensating for log write errors to the native cache space to ensure that the log is not lost. On the basis, the logs in the original cache space and the logs in the loss-prevention cache space are integrated, namely the logs are written into the log storage space in sequence, so that complete logs corresponding to the whole system operation process can be formed in the log storage space, the problem of serious log loss is solved, and the whole-process monitoring of the system operation is facilitated.
In some embodiments, before the log to be cached is to be stored in the native cache space, the remaining space of the native cache space may also be detected, the size of the space occupied by the log to be cached is detected, and by comparing the relative sizes of the two, whether the remaining space of the native cache space can meet the storage requirement of the log to be cached is determined in advance. For example, if the remaining space is larger and equal to or larger than the space occupied by the log to be cached, the native cache space can meet the storage requirement of the log to be cached, and at this time, the log to be cached can be stored in the native cache space; if the remaining space is smaller than the space occupied by the log to be cached, the native cache space cannot meet the storage requirement of the log to be cached, and at this time, the log to be cached needs to be stored in the loss-prevention cache space. Therefore, the logs to be cached, which cannot be stored in the original cache space, are directly stored in the loss-prevention cache space through pre-judgment in advance, and based on the fact that the logs in the original cache space and the logs in the loss-prevention cache space are integrated and sequentially stored in the log storage space, a complete log corresponding to the operation process of the system can be formed, the log loss probability is reduced, the problem of serious log loss is solved, and effective monitoring of the operation process of the system is facilitated.
In some embodiments, to simplify the pre-judging process, only the remaining space of the native cache space may be detected, and the storage space of the log to be cached may be determined based on whether the native cache space is full. For example, if the native cache space is not full, the log to be cached may be stored in the native cache space; and if the native cache space is full, storing the log to be cached in the loss-prevention cache space. Therefore, the problem of serious log loss is solved, and the prejudgment process is simplified.
When the logs to be cached are stored in the loss-prevention cache space, at least the logs lost in the original cache space are stored in the loss-prevention cache space; and partial or all logs stored in the native cache space can be backed up in the lost cache space, so that the overall safety of the logs is further enhanced.
The system log preservation method provided by the embodiment of the disclosure can be applied to any log system for executing software programs or instructions, so as to reduce the log loss rate and improve the log integrity. For example, the method may be applied to a fixed terminal (e.g., a smart tv or a computer) or a mobile terminal (e.g., a smartphone, a tablet, a mobile computer, or a smart vehicle). When the log preservation method is applied to a vehicle (e.g., a smart vehicle), the method may be executed by a log system of any controller in the vehicle, and an on-board system is taken as an example and is exemplified below. The following describes, with reference to fig. 1 to fig. 3, a system log saving method, an apparatus, an on-board system, and a vehicle provided in the embodiments of the present disclosure.
Fig. 1 is a schematic flowchart of a system log saving method according to an embodiment of the present disclosure. Referring to fig. 1, the method may include:
and S110, acquiring the log to be cached.
The log to be cached is a system running process, and comprises a file which is generated in a debugging process or a normal working process and reflects the state of the system.
Specifically, when the system is debugged or normally works, the log to be cached can be acquired, and the embodiment of the present disclosure does not limit a specific application scenario.
And S120, storing the log to be cached to a primary cache space or a loss prevention cache space.
The native cache space and the loss-prevention cache space are both log temporary storage spaces between a system (or called as a log generation device) for generating logs and a log storage space. Firstly, the logs to be cached generated by the system can be written into the original cache space, and the loss-prevention cache space is used as a candidate temporary storage space of the logs to be cached; or system generated logs may be selectively written into native or anti-loss cache space. The log to be cached may be referred to as a "log" after being stored for the first time.
At least part of the log to be cached which is not stored in the native cache space is stored in the loss prevention cache space. Therefore, at least part of the logs to be cached in the logs to be cached, which are stored in the original cache space in a failure mode, can be stored in the loss prevention cache space, the log loss probability is favorably reduced, and the problem of log loss prevention is solved.
Optionally, the logs to be cached that are failed to be stored in the primary cache space may be all stored in the loss-prevention cache space, so that after the logs are integrated, a complete log corresponding to the system operation process is obtained, the problem of log loss is avoided, and the system operation is effectively monitored in the whole process.
S130, sequentially storing the logs stored in the original cache space and the logs stored in the loss-prevention cache space into a log storage space.
The log storage space is a space for stably storing the logs to be cached for a long time, and the storage duration of the log storage space is relative to the temporary storage space of the logs. The logs to be cached which are written in the native cache space in a failure mode can exist in the loss-prevention cache space, and therefore the logs in the loss-prevention cache space can be used as supplements to the logs in the native cache space; by integrating the log files in the two log temporary storage spaces into the log storage space, a relatively complete log corresponding to the whole operation process of the system can be formed in the log storage space.
Illustratively, this step may include sorting the logs stored in the log storage space according to a chronological order of the logs, or sorting the logs based on multidimensional information such as time, type, content, and the like, which is not limited in this disclosure.
In the system log preservation method provided by the embodiment of the disclosure, the log to be cached can be stored in the native cache space or the loss prevention cache space, and at least part of the log to be cached which is not stored in the native cache space can be stored in the loss prevention cache space. Therefore, the logs lost by the native cache space can be stored in the loss-prevention cache space, the log loss probability is reduced, and the problem of serious log loss is solved. Furthermore, the logs in the original cache space and the logs in the loss-prevention cache space can be sequentially stored in the log storage space, so that the integration of the logs is realized, and a relatively complete log file corresponding to the operation process of the system is obtained, thereby being beneficial to realizing the effective monitoring of the whole operation process of the system.
It is understood that the number of the native cache space and the anti-loss cache space herein may be one, two or more, and the number of the native cache space and the anti-loss cache space may be the same or different; the cache spaces may be the same or different in size, which is not limited in this disclosure.
Based on the foregoing embodiments, in some embodiments, S120 may include:
the method comprises the following steps: and transmitting the log to be cached to the native cache space.
Illustratively, the to-be-cached log is preferably written into the native cache space.
Step two: and detecting the storage state of the log to be cached in the native cache space.
The storage status may include write success and write failure, among others. In the step, whether the log to be cached completely exists in the native cache space can be detected; if yes, writing is successful; otherwise, the write fails.
Illustratively, this step may be implemented by receiving code returned by the system characterizing the status of the log write. When the log to be cached fails to be written in the native cache space, the system returns an error code; it may be determined based on the error code that the log to be cached was not successfully written to the native cache space.
In other embodiments, other manners known to those skilled in the art may also be adopted to implement the detection of the storage state of the log to be cached in this step, which is neither described nor limited in this embodiment of the present disclosure.
Step three: and if the log to be cached fails to be stored in the native cache space, storing the log to be cached in the loss-prevention cache space.
For example, the log to be cached fails to be stored in the native cache space, which may include a case that the log to be cached does not exist in the native cache space, and also includes a case that the native cache space only includes a part of the log to be cached, that is, the log to be cached exists but its content is missing, and also includes other cases that the log to be cached fails to be stored, which is not limited in the embodiment of the present disclosure.
In this step, if the log to be cached fails to be written in the native cache space, the log to be cached is stored in the loss-prevention cache space. Therefore, the log to be cached still exists in the log temporary storage space between the log generation device and the log storage space, so that the more complete log corresponding to the whole operation process of the system can be conveniently obtained through subsequent integration.
The system log preservation method provided by the embodiment of the disclosure can write the log generated by the system into the native cache space firstly, and detect the storage state of the log to be cached, that is, detect whether the log to be cached is successfully written into the native cache space; if the log to be cached fails to be written in the native cache space, storing the log to be cached in the loss-prevention cache space; so far, in the logs to be cached generated by the system, the logs to be cached which are not successfully written into the native cache space can be stored into the loss-prevention cache space; then, the logs in the original cache space and the logs in the loss-prevention cache space can be sequentially stored in the log storage space, so that the logs stored in the original cache space and the logs stored in the loss-prevention cache space can be integrated, a complete log corresponding to the system operation process is formed in the log storage space, and the log loss problem is favorably improved; and can provide relatively complete logs for research personnel, and is convenient for realizing the effective monitoring of the whole running process of the system.
In this embodiment, the nature of the native cache space and the loss-prevention cache space is both cache spaces capable of storing the log to be cached, and the native cache space and the loss-prevention cache space can be distinguished based on the time for writing the log. Specifically, the cache space corresponding to the first write of the log is a native cache space, and the cache space corresponding to the alternative write of the log is a loss prevention cache space. Based on this, the anti-loss cache space is an alternative cache space. When the log is successfully written into the native cache space, it is not necessary to write it into the loss-prevention cache space again.
In other embodiments, at least a part of the logs which have been successfully written into the native cache space may be synchronously written into the loss-prevention cache space according to a certain selection mode, and the logs are used as backup logs, so as to improve the stability and the security of the log file.
For example, the selection method may be: if the amount of the currently generated logs in a single time or a set time period (such as unit time) is large, the currently generated logs are backed up.
In other embodiments, the log may also be backed up based on other selection manners, which is not limited in this disclosure.
In the above embodiment, the log to be cached is firstly stored in the native cache space, and the log to be cached which fails to be stored in the native cache space is stored in the loss-prevention cache space, so that the log loss probability can be reduced, and the problem of serious log loss is solved. In other embodiments, it may also be determined in advance whether the log to be cached is stored in the native cache space or the loss prevention cache space by detecting at least the remaining space of the native cache space, which is exemplified below.
In some embodiments, S120 may include:
the method comprises the following steps: the remaining space of the native cache space is determined.
When the log to be cached is stored in the native cache space, a certain cache space needs to be occupied; the remaining space is the unoccupied buffer space. When the log is not written in the native cache space, the residual space is the largest; with the writing of the log, occupied cache space is more and more, and the residual space is less and less; when the residual space of the native cache space is small to a certain extent, namely, the log cannot be continuously written into the native cache space, the residual space is minimum.
That is, the remaining space of the native cache space is a space that can be used for storing the log to be cached, and the step of determining the remaining space of the native cache space may be implemented in any manner known to those skilled in the art, and may be implemented based on direct detection or indirect calculation, and the subsequent same or similar steps are not repeatedly explained. This step provides data support for the subsequent prequalification step.
Step two: and determining the occupied space of the log to be cached.
The occupied space of the log to be cached is the cache space occupied by the log to be cached, the size of the space occupied by the log to be cached can be obtained by detecting the file size of the log to be cached, and the step also provides data support for the subsequent prejudging step.
Step three: the remaining space of the loss-prevention cache space is determined.
And the step also provides data support for the subsequent prejudging step.
Step four: and if the size of the occupied space of the log to be cached is smaller than or equal to the size of the residual space of the native cache space, storing the log to be cached in the native cache space.
Based on the above explanation, the log to be cached needs to occupy a certain size of cache space, the relative size of the occupied space of the log to be cached and the remaining space of the native cache space is compared, if the occupied space of the log to be cached is smaller than or equal to the remaining space of the native cache space, it is indicated that the remaining space of the native cache space can meet the storage requirement of the log to be cached, and at this time, the log to be cached can be stored in the native cache space.
Step five: and if the size of the occupied space of the log to be cached is larger than the size of the residual space of the native cache space and is smaller than or equal to the size of the residual space of the loss-prevention cache space, storing the log to be cached in the loss-prevention cache space.
Based on the above explanation, if the size of the occupied space of the log to be cached is larger than the size of the remaining space of the native cache space, it indicates that the remaining space of the native cache space cannot meet the storage requirement of the log to be cached. At this time, the relative size of the occupied space of the log to be cached and the residual space of the loss prevention cache space is compared, if the occupied space of the log to be cached is smaller than or equal to the residual space of the loss prevention cache space, it is indicated that the residual space of the loss prevention cache can meet the storage requirement of the log to be cached, and at this time, the log to be cached, which cannot be stored in the original cache space, can be stored in the loss prevention cache space.
Therefore, the loss-prevention cache space can be used as a supplementary cache space of the original cache space and used for storing the logs to be cached, which cannot be stored continuously in the original cache space, namely storing the logs to be cached, which are lost by the original cache space, so that the log loss probability can be reduced, and the problem of serious log loss can be solved.
It should be noted that, the comparison between the remaining space and the occupied space of the log to be cached in the foregoing may be implemented based on a comparison between a difference value of the two and 0, or based on a comparison between a ratio of the two and 1, or implemented in other ways known to those skilled in the art, which is not limited in this disclosure.
On the basis of the above embodiment, the steps of comparison and judgment can be reduced, and the pre-judgment process can be simplified. In some embodiments, S120 may include:
the method comprises the following steps: the remaining space of the native cache space is determined.
In this step, a space available for continuously storing the log to be cached in the current native cache space, that is, a remaining space of the native cache space is determined.
Step two: and if the native cache space is not full, storing the log to be cached in the native cache space.
In combination with the above explanation, if the native cache space is not full, that is, there is still remaining space in the native cache space, and the remaining space can be used to continue storing the log to be cached. At this time, the log to be cached may be stored into the native cache space.
Step three: and if the native cache space is full, storing the log to be cached in the loss-prevention cache space.
If the native cache space is full, it indicates that the native cache space cannot store the log to be cached continuously. At this time, the log to be cached needs to be stored in the loss prevention cache space.
Illustratively, whether the native cache space is full may be achieved by determining whether a remaining space of the native cache space reaches a remaining space lower limit.
And the lower limit of the residual cache space is used for representing that the cache space of the original cache space is full and other logs to be cached cannot be continuously written. Based on the above, the residual cache space is compared with the lower limit of the residual cache space, if the residual cache space is larger than the lower limit of the residual cache space or the residual cache space and the lower limit of the residual cache space are equal to each other, the residual cache space does not reach the lower limit of the residual cache space, and at the moment, the log to be cached can be continuously stored; if the residual cache space reaches the lower limit of the residual cache space, the log to be cached cannot be stored continuously, namely the log to be cached is written in the original cache space and is not written into the original cache space, and the log to be cached can be directly stored in the lost cache space.
Therefore, the shunting cache of the log to be cached can be realized.
In the system log preservation method provided by the embodiment of the disclosure, only the remaining space of the native cache space needs to be detected, and whether the native cache space is full is judged based on the size of the remaining space; and when the native cache space is full, storing the log to be cached in the loss-prevention cache space. Therefore, the loss-prevention cache space can be used as a supplementary cache space of the native cache space and used for storing the logs to be cached, which cannot be stored continuously in the native cache space, namely storing the logs to be cached, which are likely to be lost due to insufficient storage space of the native cache space, so that the log loss probability can be reduced, and the problem of serious log loss is solved. Meanwhile, the method has the advantages that the step of prejudging whether the log to be cached is stored in the original cache space or the loss prevention cache space is simple and easy to realize.
On the basis of the above embodiment, the number of the loss-prevention cache spaces may be one, two or more, and at this time, the log to be cached may be stored in any loss-prevention cache space that meets the storage requirement, so as to improve the storage flexibility of the log to be cached. On this basis, different types of logs to be cached can be correspondingly stored in different anti-loss cache spaces, so that the logs to be cached can be stored in different categories according to the types of the logs to be cached, which is described in an exemplary manner below.
In some embodiments, when the number of the anti-loss cache spaces is equal to or greater than two, storing the log to be cached to the anti-loss cache space may include:
the method comprises the following steps: the remaining space of each loss-prevention cache space is determined.
Illustratively, this step may include directly detecting or indirectly computationally determining the size of the remaining space of each loss prevention cache space.
Step two: and storing the logs to be cached to the target loss-prevention cache space based on the size of the residual space of each loss-prevention cache space and the size of the logs to be cached.
The target anti-loss cache space is an anti-loss cache space with the size of any remaining space equal to or larger than that of the log to be cached.
In the step, the size of the occupied space of the log to be cached is compared with the size of the residual space of each loss-prevention cache space, and if the occupied space of the log to be cached is smaller than or equal to the size of the residual space of each loss-prevention cache space, the residual space of the loss-prevention cache space can meet the storage requirement of the log to be cached; when the number of the anti-loss cache spaces capable of meeting the storage requirements of the logs to be cached is two or more, one of the anti-loss cache spaces meeting the storage requirements can be selected as the log temporary storage space of the logs to be cached.
For example, taking a car machine system as an example, each anti-loss cache space may be set in a different space, and for example, may be set in a car, and may also be set in a remote control center.
On the basis of the above embodiment, if the number of the loss-prevention cache spaces is at least two, when the log to be cached fails to be stored in one of the loss-prevention cache spaces, the log to be cached can be further stored in other loss-prevention cache spaces, so that the log loss probability is further reduced, and the integrity of the system log is favorably improved.
As an implementation manner, when the log to be cached fails to be stored in the native cache space, storing the log to be cached in a loss-prevention cache space; and if the storage fails, continuing to store the log to be cached in other loss-prevention cache spaces until the storage is successful. Based on this, in the subsequent steps, the logs in the original cache space and the loss-prevention cache spaces are integrated, so that a complete log corresponding to the system operation process can be obtained, and the whole process of the system operation process is effectively monitored.
Based on the foregoing embodiments, in some embodiments, S130 may include:
the method comprises the following steps: and acquiring the time stamp of each log in the native cache space and the time stamp of each log in the loss-prevention cache space.
Wherein the timestamp may characterize the time of log generation.
Based on the time stamps obtained in the step, the logs in the native log cache and the logs in the loss-prevention cache space can be sequenced according to the time sequence, so that log integration is realized.
Illustratively, the timestamp may be obtained by analyzing a field indicating time in the log by using an analysis function; or in other alternative ways, and the embodiments of the present disclosure are not limited.
Step two: and sequentially storing the logs into a log storage space according to the sequence of the timestamps.
Therefore, the logs to be cached can be sorted according to the generation time sequence of the logs and sequentially stored in the log storage space.
Therefore, a relatively complete log which is sequentially stored based on the time line of system operation is formed, the log integrity is good, and the effective monitoring of the system operation process is favorably realized.
In the foregoing embodiment, storing the log to be cached in the native cache space may include:
the method comprises the following steps: and collecting and processing the logs to be cached by using a log collection process.
The processing of the log to be cached comprises the operation of counting, classifying, filtering or sorting the log to be cached.
Illustratively, the counting of the logs to be cached comprises performing single-dimensional or multi-dimensional counting on the logs to be cached based on at least one parameter of time, log type, log content, log size and the like generated by the logs to be cached, the logs generated in the system operation process can be classified into logs with different grades, different types, different quantities, different time periods or specific different contents, and the log files are arranged according to the time sequence, so that subsequent searching and combing monitoring on the system operation process are facilitated. Exemplarily, the following steps are carried out: classifying the log to be cached may include classifying the log to be cached based on tasks, log types, and the like associated with the log to be cached; the filtering of the logs to be cached can comprise filtering partial grades of the logs to be cached based on different grades of the logs to be cached; sorting the logs to be cached may include sorting the logs to be cached based on a chronological order.
In this step, the log collection process processes the collected logs to be cached, and the collected logs to be cached can be processed based on the single-dimensional or multi-dimensional parameters, so that the log storage process in the subsequent step can conveniently read the logs to be cached, which are related to a certain task, of a certain type, a certain grade, include specific content or in a certain time period, thereby meeting different storage requirements of the logs to be cached, and simplifying the storage process.
Step two: based on the log storage requirement, the log storage process is used for reading the processed logs to be cached according to the preset grade, the preset type, the preset number, the preset time period or the target content, and transmitting the logs to be cached to the original cache space.
After being processed by the log collection process, the logs to be cached can form a plurality of logs to be cached with different grades, different types, different numbers or series comprising different target contents, which are sequentially ordered according to time sequence and are based on single-dimensional or multi-dimensional parameters; and the log storage process extracts the logs to be cached, which are processed in the log collection process, in preset grades, preset types, preset numbers, preset time periods or target contents according to the log storage requirements, and stores the logs to be cached in the native cache space, namely, the logs to be cached can be stored in the native cache space as required.
Therefore, the log to be cached can be stored into the native cache space as required by utilizing the log collection process and the log storage process.
In the above embodiment, the loss-prevention cache space may be a local space in the central processing unit, that is, the log to be cached stored in the native cache space may be directly stored locally. At this time, storing the log to be cached in the loss prevention cache space may include:
the method comprises the following steps: and analyzing the log to be cached.
The system generates the log to be cached in a binary format, and binary information is identified in the step so that the log to be cached is converted into the log to be cached in a text format formed by long character strings in the subsequent step two. The log format analysis may be implemented by using a corresponding analysis tool or an analysis function, which is not limited in this embodiment.
Step two: and converting the format of the analyzed log to be cached into a target log format based on the target log format associated with the loss prevention cache space.
Illustratively, the target log format may be any text format of the log. In the step, the logs to be cached in the binary format are converted into the logs to be cached in the target log format, which can be stored in the anti-loss cache space, that is, the analyzed logs to be cached are formatted, and the formats of the logs to be cached are unified into the target log format.
Step three: and storing the log to be cached with the target log format to the loss-prevention cache space.
Illustratively, in this step, the formatted log to be cached is stored in the loss prevention cache space.
Therefore, after the log to be cached is analyzed and converted (i.e. formatted), the log is stored into the loss prevention cache space.
In other embodiments, the logs stored in the log storage space may also be managed, for example, the operations may include sorting, rolling back, and the like, which is not limited in this disclosure.
In some embodiments, before storing the log to be cached in the native cache space, the method may further include: and establishing a log transmission channel between the native cache space and the log generation device by utilizing the first network socket.
Illustratively, a socket can be used as a first network socket to establish a connection channel between the native cache space and the log generation device for the transmission of the log to be cached.
Similarly to the above-mentioned establishing a log transmission channel between the native cache space and the log generating device, before storing the log to be cached in the loss prevention cache space, the method may further include: and establishing a log transmission channel between the loss-prevention cache space and the log generation device by utilizing the second network socket.
Illustratively, the log _ backup can be used as a second network socket to establish a connection channel between the loss-prevention cache space and the log generation device to transmit the log to be cached.
On the basis of the above embodiment, a log transmission channel between the native cache space and the log storage space can be established by using the network socket, and a log transmission channel between the loss-prevention cache space and the log storage space can be established by using the network socket, so that the logs stored in the native cache space and the logs stored in the loss-prevention cache space are respectively transmitted to the log storage space, thereby facilitating the realization of subsequent log integration and obtaining a more complete log corresponding to the operation process of the system.
Specifically, in some embodiments, there is a first channel between the log storage space and the native cache space, and a second channel between the log storage space and the loss-prevention cache space.
The first channel is a log transmission channel between the native cache space and the log storage space, and the second channel is a log transmission channel between the loss-prevention cache space and the log storage space. Therefore, the logs in the native cache space and the logs in the loss-prevention cache space can be stored into the log storage space respectively based on the respective log transmission channels.
In the above embodiment, S130 may specifically include: and the logs in the native cache space are stored to a log storage space through a first channel, and the logs in the loss-preventing cache space are stored to a log storage space through a second channel.
In other embodiments, the log transmission process may be implemented in other ways known to those skilled in the art, and the embodiments of the present disclosure are not limited thereto.
In some embodiments, the system log preservation method may include: when the system prints the first log to be cached, the loss-proof network socket is initialized, and the system can be named log _ backup. And then, detecting whether the native cache space is full, and if the native cache space is full, sending the log to be cached to a log loss prevention server (including a loss prevention cache space) through log _ backup. When the log loss prevention server receives the log to be cached lost in the original cache space, the log to be cached is analyzed and subjected to format conversion and then is stored in a local file. And then executing log integration service, namely sequentially inserting the logs stored in the local file into the logs in the primary cache space according to the sequence of the timestamps.
The system log preservation method provided by the embodiment of the disclosure can store the log to be cached generated by the system into the original cache space or the loss prevention cache space, wherein if the log to be cached fails to be stored in the original cache space, namely the log to be cached is lost in the original cache space, the log to be cached is stored into the loss prevention cache space; so far, in the logs to be cached generated by the system, part of the logs to be cached is normally stored in the original cache space, and part of the logs to be cached (namely, the logs lost by the original cache space) is stored in the anti-loss cache space; then, the logs in the native cache space and the logs in the loss-prevention cache space can be sequentially stored into the log storage space. The log file integration method is characterized in that the log file integration method comprises the steps of inserting a log which is lost in a primary cache space into a time at which the log is supposed to be in according to a time line, integrating the log files cached in two log cache spaces, and storing a relatively complete log which corresponds to the whole time line of system operation in a log storage space.
On the basis of the above embodiment, the embodiment of the present disclosure further provides a system log saving device. The system log saving device can be used for executing any system log saving method in the above embodiments, and therefore, the system log saving device also has the beneficial effects of any system log saving method, and the same points can be understood by referring to the explanation of the system log saving method in the above, and will not be described again in the following.
Exemplarily, fig. 2 is a schematic structural diagram of a system log security apparatus according to an embodiment of the present disclosure. Referring to fig. 2, the system log saving apparatus (hereinafter also simply referred to as apparatus) includes: a log obtaining module 310, configured to obtain a log to be cached; the log storage module 320 is used for storing the log to be cached to a native cache space or a loss prevention cache space; at least part of the logs to be cached which are not stored in the original cache space are stored in the loss-prevention cache space; the log integration module 330 is configured to sequentially store the logs stored in the native cache space and the logs stored in the loss-prevention cache space into a log storage space.
In the system log saving device provided by the embodiment of the present disclosure, the log obtaining module 310 may obtain a log to be cached; the log storage module 320 may store the log to be cached in the native cache space or the loss prevention cache space; at least part of the logs to be cached which are not stored in the original cache space are stored in the loss-prevention cache space; the log integration module 330 may sequentially store the logs stored in the native cache space and the logs stored in the loss-prevention cache space into the log storage space. Therefore, by setting the anti-loss cache space, the logs to be cached which are written in failure in the original cache space can be stored in the anti-loss cache space, and subsequently, the original cache space and the logs in the anti-loss cache space are integrated, namely, the logs in the two cache spaces are sequentially stored in the log storage space, so that complete logs corresponding to the operation process of the system can be formed in the log storage space, the problem of log loss is favorably solved, and the effective monitoring on the operation process of the system is convenient to realize.
In some embodiments, the log storage module may include: the first storage submodule is used for storing the log to be cached to a native cache space; and the second storage submodule is used for storing the log to be cached to the loss-prevention cache space.
Therefore, the logs to be cached generated by the log generation device can be stored in the original cache space and the loss prevention cache space respectively.
In some embodiments, the log storage module may further include: the log transmission submodule is used for transmitting the log to be cached to the original cache space; the state detection submodule is used for detecting the storage state of the log to be cached in the native cache space; the second storage submodule is also used for storing the log to be cached to the loss-prevention cache space if the log to be cached fails to be stored in the native cache space.
Therefore, the log to be cached can be stored to the original cache space firstly; and when the log to be cached fails to be stored in the primary cache space, the log to be cached is stored in the loss-prevention cache space, so that the loss-prevention cache space is used as a candidate temporary storage space, log loss is reduced, and the problem of serious log loss is solved.
In some embodiments, the log storage module may further include: the first residual space determining submodule is used for determining the residual space of the native cache space; the log occupation space determining submodule is used for determining the occupation space of the log to be cached; the second residual space determining submodule is used for determining the residual space of the loss-prevention cache space; the first storage submodule is also used for storing the log to be cached to the native cache space if the size of the occupied space of the log to be cached is smaller than or equal to the size of the residual space of the native cache space; the second storage submodule is also used for storing the log to be cached to the loss-prevention cache space if the size of the occupied space of the log to be cached is larger than the size of the residual space of the native cache space and smaller than or equal to the size of the residual space of the loss-prevention cache space.
Therefore, whether the log to be cached is to be stored in the native cache space or the loss prevention cache space can be judged in advance based on the relative sizes of the residual space of the native cache space, the occupied space of the log to be cached and the residual space of the loss prevention cache space, and therefore the shunt storage of the log to be cached is achieved.
In some embodiments, the log storage module is configured to: the first residual space determining submodule is used for determining the residual space of the native cache space; the first storage submodule is also used for storing the log to be cached to the native cache space if the native cache space is not full; the second storage submodule is also used for storing the log to be cached to the loss-prevention cache space if the native cache space is full.
Therefore, whether the native cache space is full or not can be determined based on the residual space of the native cache space, and the log to be cached is stored in the loss-prevention cache space when the native cache space is full, so that the storage prejudgment of the log to be cached is realized, meanwhile, the steps included in the prejudgment process are reduced, and the prejudgment process is simplified.
In some embodiments, the number of loss-prevention cache spaces is equal to or greater than two; the second remaining space determining submodule is also used for determining the remaining space of each anti-loss cache space when the log to be cached is stored in the anti-loss cache space; the second storage submodule is also used for storing the logs to be cached to the target loss-prevention cache space based on the size of the residual space of each loss-prevention cache space and the size of the logs to be cached; the target anti-loss cache space is an anti-loss cache space with the size of any remaining space equal to or larger than that of the log to be cached.
Therefore, the log to be cached, which is lost in the native cache space, can be conveniently and flexibly stored in the loss-prevention cache space.
In some embodiments, the log consolidation module comprises: the time stamp obtaining submodule is used for obtaining the time stamp of each log in the primary cache space and the time stamp of each log in the loss-preventing cache space; and the log integration sub-module is used for sequentially storing all logs to the log storage space according to the sequence of the timestamps.
Therefore, the logs in the loss-prevention cache space can be inserted into the corresponding moments in the original cache space based on the time sequence, so that the logs integrated and stored in the log storage space are better in time continuity, namely the logs are more complete; therefore, the relatively complete log is favorably utilized, and the effective monitoring of the whole running process of the vehicle machine system is realized.
In some embodiments, the first storage submodule comprises: the log collection process is used for collecting and processing the logs to be cached; the log to be cached is processed by counting, classifying, filtering or sorting; and the log storage process is used for reading the processed logs to be cached according to the time sequence, the preset grades, the preset types, the preset numbers, the preset time intervals or the target content based on the log storage requirements, and transmitting the logs to be cached to the original cache space.
Therefore, the log to be cached can be stored in the native cache space by utilizing the log collection process and the log storage process.
In some embodiments, the second storage submodule comprises: the log analyzing unit is used for analyzing the log to be cached; the log formatting unit is used for converting the format of the analyzed log to be cached into a target log format based on the target log format associated with the loss prevention cache space; and the log storage unit is used for storing the log to be cached with the target log format to the loss-prevention cache space.
Therefore, the log to be cached can be stored in the loss-prevention cache space.
In some embodiments, the apparatus further comprises a log transmission channel, wherein: establishing a log transmission channel between a native cache space and a log generation device by utilizing a first network socket; and establishing a log transmission channel between the loss-prevention cache space and the log generation device by utilizing the second network socket.
Thus, the native cache space and the loss-prevention cache space can respectively receive the log to be cached by utilizing respective channels.
It should be noted that fig. 2 only illustrates, by way of example, the system log loss prevention apparatus provided by the embodiment of the present disclosure in a combination of functional modules. In the actual form of the product, each functional module may be separately or integrally disposed, and may exist in the same space (for example, a vehicle), or be disposed in different spaces, and data transmission is realized by way of wireless communication, which is not limited in the embodiment of the present disclosure.
On the basis of the foregoing embodiment, an embodiment of the present disclosure further provides an on-board system, which may include: a processor and a memory; wherein the processor is adapted to perform the steps of any of the above methods by calling a program or instructions stored in the memory. Therefore, the vehicle-mounted system also has the advantages of any method and device in the above embodiments, and the same points can be understood by referring to the explanation of the method and device in the above description, which is not repeated herein.
For example, the vehicle-mounted system may include a vehicle control unit, a driving system controller, a video and audio system controller, a driving assistance system controller, a vehicle-mounted device system, or other device or component components in the vehicle that may execute a software program, which is not limited in this disclosure.
In some embodiments, fig. 3 is a schematic structural diagram of an on-board system according to an embodiment of the present disclosure. Referring to fig. 3, the in-vehicle system may include: a memory 401, one or more processors 402 (one processor 402 is illustrated in fig. 3 for example); the in-vehicle system may further include: an input device 403 and an output device 404.
The processor 401, the memory 402, the input device 403, and the output device 404 in the in-vehicle system may be connected by a bus or in other manners, and fig. 3 exemplarily illustrates a connection manner by a bus.
The memory 402 may be a non-transitory computer-readable storage medium, which may be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the system log saving method for reducing log loss rate in the embodiment of the present disclosure (for example, the log obtaining module 310, the log storing module 320, and the log integrating module 330 shown in fig. 2). The processor 401 executes various functional applications of the server and data processing by executing software programs, instructions and modules stored in the memory 402, namely, implements the system log saving method of the above-mentioned method embodiment.
The memory 402 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device, and the like.
Further, the memory 402 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device.
In some embodiments, memory 402 may optionally include memory located remotely from processor 401, which may be connected to the terminal device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The input device 403 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus. The output device 404 may include a display device such as a display screen.
In some embodiments, the native cache space and the loss prevention cache space are provided in the same in-vehicle system.
Illustratively, the native cache space and the anti-loss cache space are provided in the same vehicle machine.
In some embodiments, the native cache space and the loss prevention cache space are provided in different in-vehicle systems.
Illustratively, the native cache space is arranged in the car machine, and the loss-prevention cache space is arranged in other devices for storage or having a storage function in the car besides the car machine.
In other embodiments, the native cache space may be further disposed in the vehicle, and the loss-prevention cache space is disposed at a remote end (for example, a remote server end), which is not limited in this disclosure.
The embodiment of the disclosure also provides a vehicle, which comprises the vehicle-mounted system. The vehicle includes the onboard system of the disclosed embodiment, and the processor in the onboard system may execute the steps of any of the above-described methods of the disclosed embodiment by calling a program or instructions stored in the memory. Therefore, the vehicle-mounted system log in the vehicle is complete, and the vehicle state can be monitored in all directions in the whole process.
In other embodiments, the vehicle may further include other hardware structures and software programs configured on the hardware structures, which are known to those skilled in the art, and the embodiments of the present disclosure are not described or limited herein.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (15)

1. A method for preserving a system log, comprising:
acquiring a log to be cached;
storing the log to be cached to a native cache space or a loss prevention cache space; wherein at least part of the to-be-cached logs which are not stored in the native cache space are stored in the loss prevention cache space;
and sequentially storing the logs stored in the native cache space and the logs stored in the loss-prevention cache space into a log storage space.
2. The method of claim 1, wherein storing the log to be cached in a native cache space or a loss-prevention cache space comprises:
transmitting the log to be cached to the native cache space;
detecting the storage state of the log to be cached in the native cache space;
and if the log to be cached fails to be stored in the native cache space, storing the log to be cached in the loss-prevention cache space.
3. The method of claim 1, wherein storing the log to be cached in a native cache space or a loss-prevention cache space comprises:
determining a remaining space of the native cache space;
determining the occupied space of the log to be cached;
determining the residual space of the loss prevention cache space;
if the size of the occupied space of the log to be cached is smaller than or equal to the size of the residual space of the native cache space, storing the log to be cached in the native cache space;
and if the size of the occupied space of the log to be cached is larger than the size of the residual space of the native cache space and is smaller than or equal to the size of the residual space of the loss-prevention cache space, storing the log to be cached in the loss-prevention cache space.
4. The method of claim 1, wherein storing the log to be cached in a native cache space or a loss-prevention cache space comprises:
determining a remaining space of the native cache space;
if the native cache space is not full, storing the log to be cached in the native cache space;
and if the native cache space is full, storing the log to be cached in the loss-prevention cache space.
5. The method according to any of claims 1-4, wherein the number of said loss prevention cache spaces is equal to or greater than two;
when the log to be cached is stored in the loss prevention cache space, determining the residual space of each loss prevention cache space;
storing the logs to be cached to the target loss prevention cache space based on the size of the remaining space of each loss prevention cache space and the size of the logs to be cached; the target anti-loss cache space is the anti-loss cache space in which the size of any remaining space is equal to or larger than that of the log to be cached.
6. The method of claim 1, wherein sequentially storing the log in the native cache space and the log in the loss-prevention cache space to a log storage space comprises:
acquiring the time stamp of each log in the native cache space and the time stamp of each log in the loss-prevention cache space;
and sequentially storing each log into the log storage space according to the sequence of the timestamps.
7. The method of claim 1, wherein storing the log to be cached in the native cache space comprises:
collecting and processing the log to be cached by using a log collection process; processing the log to be cached comprises carrying out statistics, classification, filtration or sequencing operation on the log to be cached;
based on the log storage requirement, reading the processed logs to be cached according to the time sequence, the preset grades, the preset types, the preset numbers, the preset time intervals or the target content by using a log storage process, and transmitting the logs to be cached to the native cache space.
8. The method of claim 1, wherein storing the log to be cached in the loss-prevention cache space comprises:
analyzing the log to be cached;
converting the format of the analyzed log to be cached into a target log format based on the target log format associated with the loss prevention cache space;
and storing the log to be cached with the target log format to the loss prevention cache space.
9. The method of claim 8, wherein before storing the to-be-cached log in the native cache space, further comprising:
establishing a log transmission channel between the native cache space and the log generation device by using a first network socket;
before storing the log to be cached in the loss prevention cache space, the method further includes:
and establishing a log transmission channel between the loss-prevention cache space and the log generation device by utilizing a second network socket.
10. A system log preservation apparatus, comprising:
the log obtaining module is used for obtaining a log to be cached;
the log storage module is used for storing the log to be cached to a primary cache space or a loss prevention cache space; wherein at least part of the to-be-cached logs which are not stored in the native cache space are stored in the loss prevention cache space;
and the log integration module is used for sequentially storing the logs stored in the native cache space and the logs stored in the loss-prevention cache space into a log storage space.
11. The apparatus of claim 10, wherein the log storage module comprises:
the first storage submodule is used for storing the log to be cached to the native cache space;
and the second storage submodule is used for storing the log to be cached to the loss-prevention cache space.
12. The apparatus of claim 10, wherein the log integration module comprises:
the time stamp obtaining submodule is used for obtaining the time stamp of each log in the native cache space and the time stamp of each log in the loss-prevention cache space;
and the log integration sub-module is used for sequentially storing each log to the log storage space according to the sequence of the timestamps.
13. An in-vehicle system, comprising:
a processor and a memory;
the processor is adapted to perform the steps of the method of any one of claims 1-9 by calling a program or instructions stored in the memory.
14. The in-vehicle system of claim 13, wherein the native cache space and the loss prevention cache space are provided in the same in-vehicle system; or
The native cache space and the loss prevention cache space are arranged in different vehicle-mounted systems.
15. A vehicle characterized by comprising the on-board system of claim 13 or 14.
CN202011228254.0A 2020-11-06 2020-11-06 System log security method and device, vehicle-mounted system and vehicle Active CN112527612B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011228254.0A CN112527612B (en) 2020-11-06 2020-11-06 System log security method and device, vehicle-mounted system and vehicle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011228254.0A CN112527612B (en) 2020-11-06 2020-11-06 System log security method and device, vehicle-mounted system and vehicle

Publications (2)

Publication Number Publication Date
CN112527612A true CN112527612A (en) 2021-03-19
CN112527612B CN112527612B (en) 2024-01-02

Family

ID=74979743

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011228254.0A Active CN112527612B (en) 2020-11-06 2020-11-06 System log security method and device, vehicle-mounted system and vehicle

Country Status (1)

Country Link
CN (1) CN112527612B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101534213A (en) * 2009-04-09 2009-09-16 成都市华为赛门铁克科技有限公司 Acquisition method of log and log server
CN103064779A (en) * 2012-12-26 2013-04-24 北京思特奇信息技术股份有限公司 Method for processing log information rapidly
CN106407028A (en) * 2016-08-26 2017-02-15 佛山智能装备技术研究院 Double-buffering type robot software log storage method
CN107979490A (en) * 2017-11-17 2018-05-01 北京联想超融合科技有限公司 The recording method of daily record data and server cluster
CN109643268A (en) * 2016-08-25 2019-04-16 歌乐株式会社 Car-mounted device, result collection system
CN110389933A (en) * 2019-07-01 2019-10-29 京信通信系统(中国)有限公司 Blog management method and device between a kind of process

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101534213A (en) * 2009-04-09 2009-09-16 成都市华为赛门铁克科技有限公司 Acquisition method of log and log server
CN103064779A (en) * 2012-12-26 2013-04-24 北京思特奇信息技术股份有限公司 Method for processing log information rapidly
CN109643268A (en) * 2016-08-25 2019-04-16 歌乐株式会社 Car-mounted device, result collection system
CN106407028A (en) * 2016-08-26 2017-02-15 佛山智能装备技术研究院 Double-buffering type robot software log storage method
CN107979490A (en) * 2017-11-17 2018-05-01 北京联想超融合科技有限公司 The recording method of daily record data and server cluster
CN110389933A (en) * 2019-07-01 2019-10-29 京信通信系统(中国)有限公司 Blog management method and device between a kind of process

Also Published As

Publication number Publication date
CN112527612B (en) 2024-01-02

Similar Documents

Publication Publication Date Title
CN110688280B (en) Management system, method, equipment and storage medium for alarm event
CN103607697A (en) Terminal anti-theft method and system based on SIM card
CN113409488A (en) Data processing method and device, vehicle-mounted terminal and automobile
CN112199249A (en) Monitoring data processing method, device, equipment and medium
CN109542385B (en) Multi-data-stream on-screen display method, system and device and readable storage medium
CN105635241A (en) Method, system and computer-readable recording medium for managing abnormal state of vehicle
CN104750814B (en) The automatic storage method of polynary heterogeneous data flow based on multisensor
CN113568878A (en) Method and device for collecting and exporting system logs and vehicle
CN112527612A (en) System log preservation method and device, vehicle-mounted system and vehicle
CN113505056A (en) Vehicle diagnosis method, system, device and storage medium
CN113179195A (en) CAN message embedded point detection method, system, device and computer readable storage medium
CN114968637B (en) Automatic driving abnormality analysis system
CN112242917A (en) Internet of vehicles service quality detection method and system
Čabala et al. Wireless real-time vehicle monitoring based on android mobile device
CN111694766B (en) CAN data acquisition method and device
CN114691455A (en) Method and device for monitoring alarm data and dynamically pushing multiple platforms
CN113342430A (en) Fault code processing method and device, terminal equipment and readable storage medium
CN112860469A (en) Method, device, equipment and storage medium for collecting information of katon log
JP2010188913A (en) Device and method for accumulating vehicle information
AU2023285924A1 (en) Data processing method and apparatus, communication device, storage medium, and vehicle
CN111381994B (en) Mirror image bad layer repairing method, device, equipment and medium
CN112612766A (en) Log management method, system, equipment and computer readable storage medium
CN113572854B (en) Data transmission method and system based on Kafka component
CN117608894B (en) Log storage method and device, computer equipment and storage medium
CN109523990B (en) Voice detection method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant