CN115174554B - Log uploading method and system of controller - Google Patents

Log uploading method and system of controller Download PDF

Info

Publication number
CN115174554B
CN115174554B CN202210723806.8A CN202210723806A CN115174554B CN 115174554 B CN115174554 B CN 115174554B CN 202210723806 A CN202210723806 A CN 202210723806A CN 115174554 B CN115174554 B CN 115174554B
Authority
CN
China
Prior art keywords
log
uploading
uploaded
controller
server
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.)
Active
Application number
CN202210723806.8A
Other languages
Chinese (zh)
Other versions
CN115174554A (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 Jingwei Hirain Tech Co Ltd
Original Assignee
Beijing Jingwei Hirain Tech 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 Jingwei Hirain Tech Co Ltd filed Critical Beijing Jingwei Hirain Tech Co Ltd
Priority to CN202210723806.8A priority Critical patent/CN115174554B/en
Publication of CN115174554A publication Critical patent/CN115174554A/en
Application granted granted Critical
Publication of CN115174554B publication Critical patent/CN115174554B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • 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
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Medical Informatics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a log uploading method and a log uploading system of a controller, wherein the method applied to a master controller capable of accessing a public network comprises the following steps: receiving a log uploading request which is sent by a slave controller and cannot access a public network through a vehicle-mounted local area network; under the condition that the log grade represents that the log to be uploaded is a normal log, sending a normal log generation notice comprising the log grade and a log identifier to a server, copying the log to be uploaded corresponding to the log identifier from a log storage path of a slave controller after receiving a first uploading command sent by the server, and uploading the log to be uploaded to the server; and under the condition that the log grade represents that the log to be uploaded is an abnormal log, copying the log to be uploaded corresponding to the log identification from the lower part of the log storage path of the slave controller, and uploading the log to be uploaded to the server. The method and the device can automatically return the log of the controller, and upload the log according to the log grade and uploading requirements, so that the efficiency of acquiring the log by a responsible person is improved.

Description

Log uploading method and system of controller
Technical Field
The application relates to the technical field of log processing, in particular to a log uploading method and system of a controller.
Background
With the improvement of living standard, the automobile is more and more high in keeping quantity, and the automobile safety is more and more important. One of the most important components in an automobile is the ECU (Electronic Control Unit ). It is composed of micro controller, memory, input/output interface, A/D converter and driver. The term "ECU" is simply the brain of the vehicle ". Therefore, abnormality diagnosis of the ECU is important.
In the related art, in order to diagnose an abnormality existing in an ECU, for the ECU capable of accessing the public network, the generated log is directly uploaded to a server for a responsible person (generally, a technician responsible for log analysis) to view, while for the ECU incapable of accessing the public network, it is generally required for a problem finder to report a problem phenomenon to the responsible person layer by layer, and then the responsible person contacts a site to derive an ECU log, and the cause of the problem is located by analyzing the ECU log. Similarly, when the responsible person wants to further improve the ECU program by analyzing the normal log of the ECU, the ECU that cannot access the public network is also manually derived. However, many ECUs in a car cannot access the public network, and if a manual log-out mode is adopted, the efficiency of acquiring the log by a responsible person is quite low.
Disclosure of Invention
The application provides a log uploading method and system of a controller, which can solve the problem that the efficiency of manually exporting the controller log is low when a responsible person obtains the controller log in the related technology.
The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a method for uploading a log of a controller, where the method is applied to a master controller capable of accessing a public network, and the method includes:
receiving a log uploading request sent by a slave controller through a vehicle-mounted local area network, wherein the slave controller is a controller incapable of accessing a public network, and the log uploading request comprises a log grade and a log identifier of a log to be uploaded;
when the log grade characterizes that the log to be uploaded is a normal log, sending a normal log generation notification comprising the log grade and the log identifier to a server, copying the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller after receiving a first uploading command sent by the server, and uploading the log to be uploaded to the server, wherein the first uploading command is a log generated under the condition that the controller operates normally after acquiring at least one normal log generation notification for the server, and the normal log is a log generated under the condition that the controller operates normally according to each normal log generation notification selected from the at least one normal log generation notification;
And copying the log to be uploaded corresponding to the log identifier from the lower side of the log storage path of the slave controller under the condition that the log grade represents that the log to be uploaded is an abnormal log, and uploading the log to be uploaded to the server according to the log grade, wherein the abnormal log is generated under the condition that the controller runs abnormally.
In one embodiment, uploading the log to be uploaded to the server according to the log rank includes:
under the condition that the log grade is the first grade, directly uploading the log to be uploaded to the server;
and under the condition that the log grade is the second grade, sending an abnormal log generation notification comprising the log grade and the log identification to the server, and uploading the log to be uploaded to the server according to a second uploading command after receiving the second uploading command issued by the server, wherein the second uploading command is an uploading command generated according to the abnormal log generation notification, and the degree of abnormality represented by the first grade is larger than the second grade.
In one embodiment, the log uploading request further includes log file attribute information and/or request times of the log to be uploaded;
the normal log generation notification and/or the abnormal log generation notification further comprise at least one of log file attribute information, a time stamp and a log uploading state, wherein the time stamp is the time when the master controller receives the log uploading request for the first time.
In one embodiment, the method further comprises:
under the condition of generating a normal log by itself, sending a normal log generation notification corresponding to the generated normal log by itself to the server, and uploading the generated normal log by itself to the server after receiving a first uploading command for the generated normal log by itself sent by the server;
directly uploading the self-generated exception log to the server under the condition that the self-generated exception log is generated and the log grade of the self-generated exception log is the first grade;
and when the self-generated abnormal log is generated and the log grade of the self-generated abnormal log is the second grade, sending an abnormal log generation notification corresponding to the self-generated abnormal log to the server, and uploading the self-generated abnormal log to the server according to a second uploading command after receiving the second uploading command for the self-generated abnormal log issued by the server.
In one embodiment, after copying the log to be uploaded corresponding to the log identifier from the log storage path of the slave controller, the method further includes:
and sending a log copy result response corresponding to the log uploading request to the slave controller through the vehicle-mounted local area network.
In one embodiment, the method further comprises:
receiving a retransmission instruction for the log to be uploaded sent by the server under the condition that the log to be uploaded fails to be uploaded, and retransmitting the log to be uploaded to the server;
and deleting the copied log to be uploaded under the condition that the log to be uploaded is successfully uploaded.
In a second aspect, an embodiment of the present application provides a method for uploading a log of a controller, where the method is applied to a slave controller that cannot access a public network, and the method includes:
after generating a log to be uploaded, storing the log to be uploaded to a log storage path of the slave controller;
generating a log uploading request corresponding to the log to be uploaded, wherein the log uploading request comprises a log grade and a log identifier of the log to be uploaded;
and sending the log uploading request to a main controller through a vehicle-mounted local area network, so that the main controller copies the log to be uploaded from the log storage path according to the log grade and the log identifier in the log uploading request, and then uploads the copied log to be uploaded to the server according to the log grade, wherein the main controller is a controller capable of accessing a public network.
In one embodiment, the method further comprises:
and receiving a log copy result response corresponding to the log uploading request sent by the main controller through the vehicle-mounted local area network.
In one embodiment, the method further comprises:
when the log uploading request further comprises the request times of the log to be uploaded, after sending the log uploading request to the main controller for a preset time period, if the log copying result response is not received, adding 1 to the request times in the log uploading request, and sending an updated log uploading request to the main controller through the vehicle-mounted local area network, so that the main controller copies the log to be uploaded from the log storage path again according to the updated log uploading request;
under the condition that the destination address in the log copy result response is not the self address or the log identifier in the log copy result response is not the log identifier sent before the self address, ignoring the log copy result response;
and under the condition that the log copying result response comprises invalid log identification, sending a log identification resetting request to the main controller through the vehicle-mounted local area network, and sending a log uploading request to the main controller again, so that after deleting the locally stored log identification to be reset according to the log identification resetting request, the main controller copies the log to be uploaded from the log storage path according to the re-received log uploading request, wherein the log identification resetting request comprises the log identification to be reset.
In a third aspect, an embodiment of the present application provides a log uploading device of a controller, where the device is applied to a master controller capable of accessing a public network, and the device includes:
the system comprises a receiving unit, a receiving unit and a processing unit, wherein the receiving unit is used for receiving a log uploading request sent by a slave controller through a vehicle-mounted local area network, the slave controller is a controller which cannot access a public network, and the log uploading request comprises a log grade and a log identifier of a log to be uploaded;
the sending unit is used for sending a normal log generation notification comprising the log grade and the log identification to the server under the condition that the log grade represents that the log to be uploaded is a normal log, wherein the normal log is generated under the condition that the controller operates normally;
the first copying unit is used for copying the log to be uploaded corresponding to the log identifier from the log storage path of the slave controller after receiving a first uploading command sent by the server, wherein the first uploading command is an uploading command respectively generated according to each normal log generation notification selected from at least one normal log generation notification after acquiring at least one normal log generation notification for the server;
The first uploading unit is used for uploading the log to be uploaded, which is copied by the first copying unit, to the server;
the second copying unit is used for copying the log to be uploaded corresponding to the log identifier from the lower side of the log storage path of the slave controller under the condition that the log grade represents that the log to be uploaded is an abnormal log, wherein the abnormal log is generated under the condition that the controller operates abnormally;
and the second uploading unit is used for uploading the log to be uploaded, which is copied by the second copying unit, to the server according to the log grade.
In one embodiment, the second uploading unit comprises:
the first uploading module is used for directly uploading the log to be uploaded to the server under the condition that the log grade is the first grade;
the sending module is used for sending an abnormal log generation notification comprising the log grade and the log identification to the server under the condition that the log grade is the second grade;
and the second uploading module is used for uploading the log to be uploaded to the server according to the second uploading command after receiving the second uploading command issued by the server, wherein the second uploading command is an uploading command generated by generating notification according to the abnormal log, and the degree of abnormality represented by the first level is larger than that of the second level.
In one embodiment, the log uploading request further includes log file attribute information and/or request times of the log to be uploaded;
the normal log generation notification and/or the abnormal log generation notification further comprise at least one of log file attribute information, a time stamp and a log uploading state, wherein the time stamp is the time when the master controller receives the log uploading request for the first time.
In one embodiment, the sending unit is further configured to send, to the server, a normal log generation notification corresponding to the normal log generated by the sending unit when the sending unit generates the normal log;
the first uploading unit is further used for uploading the self-generated normal log to the server after receiving a first uploading command for the self-generated normal log sent by the server;
the second uploading unit is further used for directly uploading the self-generated exception log to the server under the condition that the self-generated exception log is generated and the log grade of the self-generated exception log is the first grade; when the self-generated abnormal log and the log level of the self-generated abnormal log are the second level, sending an abnormal log generation notification corresponding to the self-generated abnormal log to the server; and after receiving a second uploading command aiming at the self-generated exception log and issued by the server, uploading the self-generated exception log to the server according to the second uploading command.
In an embodiment, the sending unit is further configured to send, to the slave controller through the vehicle-mounted local area network, a log copy result response corresponding to the log upload request after copying the log to be uploaded corresponding to the log identifier from the slave controller under a log storage path.
In one embodiment, the apparatus further comprises:
the receiving unit is used for receiving a retransmission instruction aiming at the log to be uploaded, which is sent by the server, under the condition that the uploading of the log to be uploaded fails;
a retransmission unit, configured to retransmit the log to be uploaded to the server;
and the deleting unit is used for deleting the copied log to be uploaded under the condition that the log to be uploaded is successfully uploaded.
In a fourth aspect, an embodiment of the present application provides a log uploading device of a controller, where the device is applied to a slave controller that cannot access a public network, and the device includes:
the storage unit is used for storing the log to be uploaded to the log storage path of the slave controller after generating the log to be uploaded;
the generation unit is used for generating a log uploading request corresponding to the log to be uploaded, wherein the log uploading request comprises a log grade and a log identifier of the log to be uploaded;
And the sending unit is used for sending the log uploading request to the main controller through the vehicle-mounted local area network, so that the main controller copies the log to be uploaded from the log storage path according to the log grade and the log identifier in the log uploading request, and then uploads the copied log to be uploaded to the server according to the log grade, wherein the main controller is a controller capable of accessing a public network.
In one embodiment, the apparatus further comprises:
and the receiving unit is used for receiving a log copy result response corresponding to the log uploading request sent by the main controller through the vehicle-mounted local area network.
In an embodiment, the sending unit is further configured to, when the log upload request further includes the number of requests for the log to be uploaded, after sending the log upload request to the host controller for a preset duration, if the log copy result response is not received, add 1 to the number of requests in the log upload request, send an updated log upload request to the host controller through the vehicle-mounted local area network, so that the host controller copies the log to be uploaded from the log storage path again according to the updated log upload request;
The apparatus further comprises:
the ignoring unit is used for ignoring the log copy result response under the condition that the destination address in the log copy result response is not an own address or the log identifier in the log copy result response is not the log identifier sent before the log identifier is sent by the user;
and the sending unit is further used for sending a log identifier resetting request to the main controller through the vehicle-mounted local area network under the condition that the log identifier response comprises invalid log identifiers, and sending a log uploading request to the main controller again, so that the main controller deletes the locally stored log identifier to be reset according to the log identifier resetting request, and copies the log to be uploaded from the log storage path according to the re-received log uploading request, wherein the log identifier resetting request comprises the log identifier to be reset.
In a fifth aspect, an embodiment of the present application provides a log uploading system of a controller, where the system includes a master controller and a slave controller, where the master controller is a controller capable of accessing a public network, and the slave controller is a controller incapable of accessing the public network, and the master controller and the slave controller communicate through a vehicle-mounted local area network;
The slave controller is configured to store a log to be uploaded in a log storage path of the slave controller after generating the log to be uploaded, generate a log uploading request corresponding to the log to be uploaded, and send the log uploading request to the master controller, where the log uploading request includes a log grade and a log identifier of the log to be uploaded;
the master controller is configured to send a normal log generation notification including the log level and the log identifier to a server when the log level characterizes that the log to be uploaded is a normal log, copy the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller after receiving a first upload command sent by the server, upload the log to be uploaded to the server, where the first upload command is an upload command generated by the server according to each normal log generation notification selected from the at least one normal log generation notification after the server acquires at least one normal log generation notification, where the normal log is a log generated under a condition that the controller is running normally, copy the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller when the log level characterizes that the log to be uploaded is an abnormal log, and upload the log to be uploaded to the server according to the log level, where the normal log is generated under a condition that the log is running abnormally.
In one embodiment, the master controller is configured to copy, when the log level characterizes that the log to be uploaded is an abnormal log and the log level is a first level, the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller, and directly upload the log to be uploaded to the server; and copying the log to be uploaded corresponding to the log identifier from the lower part of a log storage path of the slave controller under the condition that the log grade represents that the log to be uploaded is an abnormal log and the log grade is a second grade, sending an abnormal log generation notification comprising the log grade and the log identifier to the server, and uploading the log to be uploaded to the server according to the second uploading command after receiving the second uploading command issued by the server, wherein the second uploading command is an uploading command generated by generating the notification according to the abnormal log, and the abnormal degree represented by the first grade is larger than the second grade.
In one embodiment, the log uploading request further includes log file attribute information and/or request times of the log to be uploaded;
The normal log generation notification and/or the abnormal log generation notification further comprise at least one of log file attribute information, a time stamp and a log uploading state, wherein the time stamp is the time when the master controller receives the log uploading request for the first time.
In one embodiment, the main controller is configured to send, to the server, a normal log generation notification corresponding to the normal log generated by the main controller when the main controller generates the normal log, and upload the normal log generated by the main controller to the server after receiving a first upload command sent by the server; directly uploading the self-generated exception log to the server under the condition that the self-generated exception log is generated and the log grade of the self-generated exception log is the first grade; and when the self-generated abnormal log is generated and the log grade of the self-generated abnormal log is the second grade, sending an abnormal log generation notification corresponding to the self-generated abnormal log to the server, and uploading the self-generated abnormal log to the server according to the second uploading command after receiving the second uploading command issued by the server.
In one embodiment, the master controller is configured to send a log copy result response corresponding to the log upload request to the slave controller after copying the log to be uploaded corresponding to the log identifier under a log storage path of the slave controller;
the slave controller is configured to receive the log copy result response.
In one embodiment, the slave controller is configured to, when the log upload request further includes the number of requests for the log to be uploaded, send an updated log upload request to the master controller after sending the log upload request to the master controller for a preset period of time, and if the log copy result response is not received, add 1 to the number of requests in the log upload request;
and the master controller is used for receiving the updated log uploading request sent by the slave controller and copying the log to be uploaded from the log storage path again according to the updated log uploading request.
In one embodiment, the slave controller is configured to ignore the log copy result response if the destination address in the log copy result response is not a self address, or if the log identifier in the log copy result response is not a log identifier sent before the slave controller itself.
In one embodiment, the slave controller is configured to send a log identifier resetting request to the master controller and resend a log uploading request to the master controller when the log copy result response includes that the log identifier is invalid, where the log identifier resetting request includes a log identifier to be reset;
the master controller is used for receiving a log identifier resetting request, deleting the locally stored log identifier to be reset, receiving a log uploading request resent by the slave controller, and copying the log to be uploaded from the log storage path according to the re-received log uploading request.
In one embodiment, the master controller is configured to receive a retransmission instruction for the log to be uploaded sent by the server, and retransmit the log to be uploaded to the server, where the uploading of the log to be uploaded fails; and deleting the copied log to be uploaded under the condition that the log to be uploaded is successfully uploaded.
In a sixth aspect, embodiments of the present application provide a vehicle comprising a system according to any one of the embodiments of the fifth aspect.
In a seventh aspect, embodiments of the present application provide a storage medium having stored thereon executable instructions that when executed by a processor cause the processor to implement a method according to any embodiment of the first aspect, or a method according to any embodiment of the second aspect.
As can be seen from the foregoing, in the log uploading method and system of the controller provided in the embodiments of the present application, the controller capable of accessing the public network may be used as the master controller, the controller incapable of accessing the public network may be used as the slave controller, after the slave controller generates the log, the log uploading request including the log level and the log identifier may be sent to the master controller through the vehicle-mounted lan, in the case that the log level represents the log to be uploaded as the normal log, since the normal log data size is larger and the attention of the responsible person to different normal logs is different in different periods, the master controller may not blindly copy all the log to be uploaded requested from the log storage path of the slave controller, but first send a normal log generation notification including the log level and the log identifier to the server, after receiving the first uploading command sent by the server, copy the log to be uploaded corresponding to the log identifier from the slave controller, and upload the log to the server, in the case that the log level represents the log to be uploaded as the normal log is represented, copy the log to be uploaded from the slave controller, and then copy the log to the log identifier from the slave controller to the slave controller. Therefore, according to the embodiment of the application, the logs can be automatically returned to the server, so that the efficiency of acquiring the logs by the responsible person is improved, the logs can be selectively uploaded according to the requirement of the responsible person, the data volume of log copying and uploading is reduced, and the efficiency of acquiring the required logs from a large number of logs by the responsible person is improved.
The technical effects that may be achieved by the embodiments of the present application further include, but are not limited to, the following:
1. and the main controller can upload the log to be uploaded to the server by adopting a corresponding uploading strategy according to the abnormal degree characterized by the log grade. Specifically, when the log level is the first level, the exception degree is the highest, and is usually an unexpected exception condition which is not encountered, the log to be uploaded can be directly uploaded to the server, so that a responsible person can perform exception analysis as soon as possible.
2. In order to reduce the data volume of log copying and uploading, the efficiency of a responsible person for acquiring a required log from a large number of logs is improved, and the logs generated by the main controller can also be uploaded by adopting a corresponding uploading strategy through log grading.
3. In order to prevent the fact that the logs to be uploaded cannot be accurately positioned due to different log data corresponding to the same log identifier caused by the reason of re-electrifying and the like, the time stamp when the master controller receives the log uploading request for the first time can be added in the normal log generation notification, and the logs to be uploaded are uniquely identified by adding the dimension of the time stamp. In order to add a reference dimension to the responsible person, the log upload request may further include log file attribute information such that the normal log generation notification/abnormal log generation notification transmitted to the responsible person also includes log file attribute information.
4. The master controller can send a log copying result response to the slave controller through the vehicle-mounted local area network, so that the slave controller can timely acquire the log copying condition.
5. In order to improve the uploading success rate, the main controller can re-upload to the server under the condition of uploading failure.
6. In order to save the storage space of the main controller, the log to be uploaded can be deleted when the log to be uploaded is successfully uploaded.
7. And for the log copy result response related abnormal conditions, the slave controller can perform corresponding processing so as to enable the master controller to copy successfully as much as possible.
Of course, not all of the above-described advantages need be achieved simultaneously in practicing any one of the products or methods of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following description will briefly introduce the drawings that are required to be used in the description of the embodiments or the prior art. It is apparent that the drawings in the following description are only some of the embodiments of the present application. Other figures can be obtained from these figures without inventive effort for a person of ordinary skill in the art.
Fig. 1 is a flow chart of a log uploading method of a controller according to an embodiment of the present application;
fig. 2 is a flowchart of another log uploading method of a controller according to an embodiment of the present application;
fig. 3 is an exemplary diagram of a log uploading method of a controller according to an embodiment of the present application;
FIG. 4 is a diagram illustrating another example log uploading method of a controller according to an embodiment of the present application;
FIG. 5 is a diagram illustrating an example log uploading method of a controller according to an embodiment of the present application;
fig. 6 is a block diagram of a log uploading device of a controller according to an embodiment of the present application;
fig. 7 is a block diagram of another log uploading device of a controller according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments obtained by persons of ordinary skill in the art without inventive effort based on the embodiments herein are within the scope of the present application.
It should be noted that the terms "comprising" and "having" and any variations thereof in the embodiments and figures herein are intended to cover a non-exclusive inclusion. A process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed but may alternatively include other steps or elements not listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a log uploading method of a controller, provided in an embodiment of the present application, where the method is applied to a master controller capable of accessing a public network, and the method includes:
s110: the master controller receives a log uploading request sent by the slave controller through the vehicle-mounted local area network.
Wherein the slave controller is a controller which cannot access the public network. The slave controllers at least comprise one slave controller, and all the slave controllers and the master controller are in a vehicle local area network. The master controller and the slave controller may be ECU, or may be other controllers in any field, which is not limited in the embodiments of the present application. When there are multiple controllers in the vehicle LAN that can access the public network, one controller can be selected randomly as the main controller, or the controller with the best performance can be selected as the main controller.
After the slave controller generates the log, the log to be uploaded can be stored under a log storage path of the slave controller, then a log uploading request is generated, and the log uploading request is sent to the master controller, so that the master controller uploads the log to be uploaded of the slave controller to the server according to the log uploading request. The log uploading request comprises a log grade and a log identifier of a log to be uploaded. The log grade at least comprises two grades, one grade is used for representing that the log to be uploaded is a normal log, and the other grade is used for representing that the log to be uploaded is an abnormal log. The log upload request may also include a first source address, a message type. The first source address is an address of a slave controller sending a log upload request, and the address is only a generalized address, so long as different controllers can be distinguished, and the address includes, but is not limited to, an IP (Internet Protocol ) address, a MAC (Media Access Control Address, media access control address) address, an address written according to a preset rule, and the like, and the message type is used for distinguishing a log upload request sent for the first time, a log copy result response, and a log upload request after log identification is reset (see related content of a subsequent log identification reset request for details). In general, the controller will generate a log uploading request corresponding to each log file by taking the log file as a unit. The log identification can be used to identify a unique log file in a power-on cycle, and can also serve as a session ID in the interaction process between the master and slave controllers, so as to distinguish different sessions.
S120: and under the condition that the log grade represents that the log to be uploaded is a normal log, the master controller sends a normal log generation notice comprising the log grade and the log identification to the server, and copies the log to be uploaded corresponding to the log identification from the log storage path of the slave controller to upload the log to the server after receiving the first uploading command sent by the server.
The normal log is a log generated under the condition that the controller operates normally. After the first uploading command obtains at least one normal log generation notification for the server, the uploading command is respectively generated according to each normal log generation notification selected from the at least one normal log generation notification. That is, the server may determine whether to generate the first upload command by the responsible person every time a normal log generation notification is received, or may determine which normal log generation notifications to generate the first upload command by the responsible person at intervals or every time a certain number of normal log generation notifications are received. When the log storage path of each slave controller is a fixed path, the master controller can directly copy the log to be uploaded corresponding to the log identification from the lower part of the log storage path of the slave controller; when the log storage path of each slave controller is not a fixed path, the log uploading request can further comprise a log storage path corresponding to the log identifier, so that the master controller copies the log to be uploaded according to the log storage path in the log uploading request. The log storage path may be an NFS (Network File System ) path.
In one embodiment, the log upload request further includes log file attribute information and/or the number of requests for the log to be uploaded. The log file attribute information includes the data size, log file name, log type, etc. of the log to be uploaded, and the number of requests is the number of log uploading requests sent for the same log identifier. The normal log generation notification further includes at least one of log file attribute information, a time stamp, and a log upload status, thereby giving the responsible person more reference dimensions to determine whether to generate the corresponding first upload command. The time stamp is the time when the master controller receives the log uploading request for the first time, and the log uploading state comprises uploading success, uploading failure, uploading, copying failure, uploading, not finding data and the like. When the device (such as a vehicle) to which the master-slave controller belongs is restarted, the generated logs may be numbered again to generate log identifiers, so that the log identifiers before restarting and the log files marked by the log identifiers after restarting may be non-unique, and in order to uniquely identify the log files, the time stamp may be added to the normal log generation notification, so that the first source address, the log identifiers and the time stamp uniquely identify the log to be uploaded.
S130: and under the condition that the log grade represents that the log to be uploaded is an abnormal log, the master controller copies the log to be uploaded corresponding to the log identification from the lower part of the log storage path of the slave controller, and uploads the log to be uploaded to the server according to the log grade.
The abnormal log is a log generated when the controller runs abnormally. Because the data volume of the abnormal log is generally smaller than the data volume of the normal log, and the probability that the abnormal log needs to be uploaded to the server is high, the master control can copy the log to be uploaded corresponding to the log mark to the local under the log storage path of the slave controller, and then upload the log to be uploaded to the server according to the log grade.
In practical applications, the exception log includes, but is not limited to, the following two cases: (1) The controller encounters unexpected abnormal conditions, log data generated when normal production activities are adversely affected is highest in urgency and highest in uploading priority. (2) The controller encounters an abnormal condition, but after processing according to the self-plan, log data generated when no influence or little influence is caused on production activities is generated, the emergency is high, and the uploading priority is general.
The main controller can upload the log to be uploaded to the server according to the emergency degree of the two abnormal logs, and the specific scheme comprises the following steps: under the condition that the log grade is the first grade, the main controller directly uploads the log to be uploaded to the server; and under the condition that the log level is the second level, the main controller sends an abnormal log generation notification comprising the log level and the log identifier to the server, and uploads the log to be uploaded to the server according to the second uploading command after receiving the second uploading command issued by the server, wherein the second uploading command is an uploading command generated according to the abnormal log generation notification, and the degree of abnormality represented by the first level is larger than that of the second level. The exception log generation notification may further include at least one of log file attribute information, a time stamp, and a log upload state, thereby giving the responsible person more reference dimensions to determine whether to generate the corresponding second upload command. The first upload command and the second upload command include at least a log identification and a first source address, and may further include a timestamp.
It should be noted that, the server in the embodiments of the present application may include one or a plurality of servers. When the server is one, the server has two functions of interacting with responsible persons and storing logs; when there are a plurality of servers, a server having a function of interacting with a person (so-called background server) and a server having a log storage function are two independent servers, and the server having a log storage function may be an FTP (File Transfer Protocol ) server.
According to the method for uploading the logs of the controller, the controller which can access the public network can be used as the master controller, the controller which cannot access the public network can be used as the slave controller, after the slave controller generates the logs, the log uploading request comprising the log grade and the log identification can be sent to the master controller through the vehicle-mounted local area network, under the condition that the log grade represents that the logs to be uploaded are normal, as the normal log data amount is large and the attention of a responsible person to different normal logs in different time periods is different, the master controller cannot blindly copy all logs requested by the log uploading request from the log storage path of the slave controller, but firstly sends a normal log generating notice comprising the log grade and the log identification to the server, after receiving a first uploading command sent by the server, copies the logs to be uploaded corresponding to the log identification from the log storage path of the slave controller, and under the condition that the log grade represents that the logs to be uploaded are abnormal logs, the logs to be uploaded can be copied from the log storage path of the slave controller to the corresponding log to be uploaded according to the log grade. Therefore, according to the embodiment of the application, the logs can be automatically returned to the server, so that the efficiency of acquiring the logs by the responsible person is improved, the logs can be selectively uploaded according to the requirement of the responsible person, the data volume of log copying and uploading is reduced, and the efficiency of acquiring the required logs from a large number of logs by the responsible person is improved.
In one embodiment, after the master controller generates the log, in order to improve the resource utilization rate, improve the efficiency of the responsible person obtaining the required log from a large number of logs, the master controller may upload the log to be uploaded generated by itself to the server according to the log level.
Under the condition of generating the normal log, sending a normal log generation notification corresponding to the generated normal log to a server, and uploading the generated normal log to the server after receiving a first uploading command for the generated normal log sent by the server; under the condition that the self-generated abnormal log is generated and the log grade of the self-generated abnormal log is the first grade, directly uploading the self-generated abnormal log to a server; and when the self-generated abnormal log is in the second level, sending an abnormal log generation notification corresponding to the self-generated abnormal log to the server, and uploading the self-generated abnormal log to the server according to the second uploading command after receiving the second uploading command aiming at the self-generated abnormal log and issued by the server.
In one embodiment, in order to enable the slave controller to timely acquire the log copying condition of the master controller, after the slave controller copies the log to be uploaded corresponding to the log identification under the log storage path of the slave controller, the master controller can send a log copying result response corresponding to the log uploading request to the slave controller through the vehicle-mounted local area network. The log copy result response includes the second source address, the message type, the destination address, the log identification, the response times, the copy result. The copying result comprises copying success, copying failure, to-be-copied, empty data, copying and invalid log identification. The second source address is the address of the master controller, and the destination address is the address of the slave controller.
In an embodiment, under the condition that the uploading of the log to be uploaded fails, receiving a retransmission instruction for the log to be uploaded sent by the server, and retransmitting the log to be uploaded to the server, wherein when the continuous retransmission fails for N times, the server can not issue the retransmission instruction any more, and N is a positive integer. And deleting the copied log to be uploaded under the condition that the log to be uploaded is successfully uploaded, so that the available storage space of the main controller can be increased.
It should be noted that, when the master controller and the slave controller are ECUs, the interaction information such as the log uploading request, the log copying result response, the normal log generation notification, the abnormal log generation notification and the like may be in a CAN (Controller Area Network ) message format.
Based on the above method embodiment, the embodiment of the present application provides a method for uploading a log of a controller, where the method is applied to a slave controller that cannot access a public network, as shown in fig. 2, and the method includes:
s210: after the slave controller generates the log to be uploaded, the log to be uploaded is stored under a log storage path of the slave controller.
S220: and generating a log uploading request corresponding to the log to be uploaded from the controller.
The log upload request includes a log class and log identification of the log to be uploaded. The log levels at least comprise two levels, one level is used for representing that the log to be uploaded is a normal log, and the other level is used for representing that the log to be uploaded is an abnormal log. The log upload request may also include a first source address, a message type. The first source address is the address of the slave controller sending the log uploading request, and the message type is used for distinguishing the log uploading request sent for the first time, the log copying result response and the log uploading request after resetting the log identifier.
In general, the controller will generate a log uploading request corresponding to each log file by taking the log file as a unit. The log identification can be used to identify a unique log file in a power-on cycle, and can also serve as a session ID in the interaction process between the master and slave controllers, so as to distinguish different sessions.
S230: the slave controller sends a log uploading request to the master controller through the vehicle-mounted local area network, so that the master controller copies the log to be uploaded from the lower part of the log storage path according to the log grade and the log identification in the log uploading request and then uploads the copied log to be uploaded to the server.
The master controller is a controller capable of accessing the public network.
In one embodiment, in order to timely acquire the log copy condition, the slave controller may receive a log copy result response corresponding to the log upload request sent by the master controller. The log copy result response includes the second source address, the message type, the destination address, the log identification, the response times, the copy result. The copying result comprises copying success, copying failure, to-be-copied, empty data, copying and invalid log identification.
In one embodiment, for the exception condition associated with the log copy result response, the slave controller may perform a corresponding process to make the master controller copy as successful as possible. The handling schemes for different exception cases include, but are not limited to, the following:
and under the condition that the log uploading request further comprises the request times of the log to be uploaded, after the log uploading request is sent to the main controller for a preset time period, if the log copying result response is not received, after the request times in the log uploading request are increased by 1, sending an updated log uploading request to the main controller through the vehicle-mounted local area network, so that the main controller copies the log to be uploaded from the log storage path again according to the updated log uploading request. The preset duration is an empirical value, for example, may be 10s. Of course, when the log uploading request does not include the number of requests of the log to be uploaded, after the log uploading request is sent to the main controller for a preset time, if the log copying result response is not received, the log uploading request is directly sent to the main controller again.
In the case that the destination address in the log copy result response is not an own address or the log identifier in the log copy result response is not a log identifier previously sent by itself, the log copy result response is independent of itself, and the log copy result response may be ignored.
And under the condition that the log copying result response comprises invalid log identification, sending a log identification resetting request to the main controller through the vehicle-mounted local area network, and re-sending a log uploading request to the main controller, so that the main controller deletes the locally stored log identification to be reset according to the log identification resetting request, and copies the log to be uploaded from the log storage path according to the re-received log uploading request, wherein the log identification resetting request comprises the log identification to be reset. The log identifier in the resent log uploading request can also be the original log identifier, or the log identifier after the original log identifier is modified.
To illustrate the use scenario of log identity invalidity and log identity reset request, two examples are:
example one: during normal operation of the master controller, a slave controller sends a log upload request to the master controller with a log identifier of 1001. Then the slave controller is powered up again, and a log uploading request with a log identifier of 1001 is sent, but the log uploading requests corresponding to the two log uploading requests are not the same log data, and the log file names are likely to be different. At the master controller side, when a log uploading request with a log identifier of 1001 is received for the second time, the log identifier is judged to have been received before, the log identifier is determined to be an invalid log identifier, and a log copy result response including the invalid log identifier is generated and sent to the slave controller. After receiving the log copy result response, the slave controller firstly sends a log identification reset request to the master controller, and then resends a log uploading request with a log identification of 1001, and the master controller can normally process the log uploading request.
Example two: after receiving the log upload request with log identification 1002, the master controller starts a copy operation. During the copying process, if the slave controller erroneously sends a log upload request with a log identifier 1002 again for various reasons, the newly sent log upload request seriously interferes with the ongoing copying operation and the one-time log data uploading process represented by the same. In this case, the master controller may reply to the log copy result response including the log identifier invalidation, so that the slave controller may first send the log identifier resetting request, and then resend the log uploading request with the log identifier 1002, and the master controller may normally process the log uploading request.
In one embodiment, assuming that the log level includes a first level, a second level, and a third level, where the first level and the second level are respectively used to represent that the log to be uploaded is an abnormal log, the first level is higher than the second level, and the third level is used to represent that the log to be uploaded is a normal log, the specific process of uploading the log to be uploaded from the controller to the server is shown in fig. 3-5 respectively:
first level:
s311: after the slave controller generates the first-level log to be uploaded, the log to be uploaded is stored under a log storage path of the slave controller, and a log uploading request corresponding to the log to be uploaded is generated.
S312: the slave controller sends a log upload request to the master controller.
S313: when the master controller determines that the log grade in the log uploading request is the first grade, the log to be uploaded corresponding to the log identification is copied from the lower part of the log storage path of the slave controller.
S314: the master controller sends a log copy result response to the slave controller.
S315: and uploading the log to be uploaded to the FTP server by the main controller.
S316: and the main controller reports the log uploading result to the background server.
The log uploading result comprises log identification, whether the log is successfully uploaded, log file attribute information and the like.
S317: the background server sends reminding information to the responsible person.
The reminding information comprises log uploading results, and the background server can send the reminding information through mail, short messages and the like.
Second level:
s411: after the secondary controller generates the second-level log to be uploaded, the log to be uploaded is stored under a log storage path of the secondary controller, and a log uploading request corresponding to the log to be uploaded is generated.
S412: the slave controller sends a log upload request to the master controller.
S413: when the master controller determines that the log grade in the log uploading request is the second grade, the log to be uploaded corresponding to the log identification is copied from the lower part of the log storage path of the slave controller.
S414: the master controller sends a log copy result response to the slave controller.
S415: the main controller transmits an abnormality log generation notification to the background server.
S416: the background server transmits an abnormality log generation notification to the responsible person.
S417: and the responsible person sends an uploading instruction to the background server.
S418: the background server issues a second uploading command to the main controller.
S419: and the main controller uploads the log to be uploaded to the FTP server according to the second uploading command.
S4110: and the main controller reports the log uploading result to the background server.
S4111: the background server sends reminding information to the responsible person.
Third level:
s511: after the slave controller generates the third-level log to be uploaded, storing the log to be uploaded under a log storage path of the slave controller, and generating a log uploading request corresponding to the log to be uploaded.
S512: the slave controller sends a log upload request to the master controller.
S513: and when the master controller determines that the log grade in the log uploading request is the third grade, sending a normal log generation notification to the background server.
S514: the background server forwards the normal log generation notification to the responsible person.
S515: and the responsible person sends an uploading instruction to the background server.
S516: the background server issues a first uploading command to the main controller.
S517: and the main controller uploads the log to be uploaded to the FTP server according to the first uploading command.
S518: and the main controller reports the log uploading result to the background server.
S519: the background server sends reminding information to the responsible person.
Based on the above method embodiment, the embodiment of the present application provides a log uploading device of a controller, where the device is applied to a master controller capable of accessing a public network, as shown in fig. 6, and the device includes:
a receiving unit 61, configured to receive a log uploading request sent by a slave controller through a vehicle-mounted local area network, where the slave controller is a controller that cannot access a public network, and the log uploading request includes a log class and a log identifier of a log to be uploaded;
a sending unit 62, configured to send, to a server, a normal log generation notification including the log level and the log identifier, where the normal log is a log generated when the controller operates normally, where the log level characterizes that the log to be uploaded is a normal log;
a first copying unit 63, configured to copy, after receiving a first upload command sent by the server, the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller, where the first upload command is an upload command generated respectively according to each normal log generation notification selected from at least one normal log generation notification after the first upload command obtains at least one normal log generation notification for the server;
A first uploading unit 64, configured to upload the log to be uploaded copied by the first copying unit to the server;
a second copying unit 65, configured to copy, when the log level indicates that the log to be uploaded is an abnormal log, the log to be uploaded corresponding to the log identifier from under a log storage path of the slave controller, where the abnormal log is a log generated when the controller operates abnormally;
and the second uploading unit 66 is configured to upload the log to be uploaded, which is copied by the second copying unit, to the server according to the log level.
In one embodiment, the second uploading unit 66 includes:
the first uploading module is used for directly uploading the log to be uploaded to the server under the condition that the log grade is the first grade;
the sending module is used for sending an abnormal log generation notification comprising the log grade and the log identification to the server under the condition that the log grade is the second grade;
and the second uploading module is used for uploading the log to be uploaded to the server according to the second uploading command after receiving the second uploading command issued by the server, wherein the second uploading command is an uploading command generated by generating notification according to the abnormal log, and the degree of abnormality represented by the first level is larger than that of the second level.
In one embodiment, the log uploading request further includes log file attribute information and/or request times of the log to be uploaded;
the normal log generation notification and/or the abnormal log generation notification further comprise at least one of log file attribute information, a time stamp and a log uploading state, wherein the time stamp is the time when the master controller receives the log uploading request for the first time.
In one embodiment, the sending unit 62 is further configured to send, to the server, a normal log generation notification corresponding to the normal log generated by the sending unit itself, where the normal log is generated by the sending unit itself;
the first uploading unit 64 is further configured to upload the self-generated normal log to the server after receiving a first upload command for the self-normal log sent by the server;
the second uploading unit 66 is further configured to directly upload the self-generated exception log to the server when the self-generated exception log is generated and the log level of the self-generated exception log is the first level; when the self-generated abnormal log and the log level of the self-generated abnormal log are the second level, sending an abnormal log generation notification corresponding to the self-generated abnormal log to the server; and after receiving a second uploading command aiming at the self-generated exception log and issued by the server, uploading the self-generated exception log to the server according to the second uploading command.
In one embodiment, the sending unit 62 is further configured to send, to the slave controller through the on-vehicle lan, a log copy result response corresponding to the log upload request after copying the log to be uploaded corresponding to the log identifier from the slave controller under the log storage path.
In one embodiment, the apparatus further comprises:
the receiving unit is used for receiving a retransmission instruction aiming at the log to be uploaded, which is sent by the server, under the condition that the uploading of the log to be uploaded fails;
a retransmission unit, configured to retransmit the log to be uploaded to the server;
and the deleting unit is used for deleting the copied log to be uploaded under the condition that the log to be uploaded is successfully uploaded.
Based on the above method embodiment, the embodiment of the present application provides a log uploading device of a controller, where the device is applied to a slave controller that cannot access a public network, as shown in fig. 7, and the device includes:
a storage unit 71, configured to store a log to be uploaded under a log storage path of the slave controller after generating the log to be uploaded;
a generating unit 72, configured to generate a log uploading request corresponding to the log to be uploaded, where the log uploading request includes a log grade and a log identifier of the log to be uploaded;
And a sending unit 73, configured to send the log uploading request to a host controller through a vehicle-mounted local area network, so that after the host controller copies the log to be uploaded from the log storage path according to the log grade and the log identifier in the log uploading request, the host controller uploads the copied log to be uploaded to the server according to the log grade, where the host controller is a controller capable of accessing a public network.
In one embodiment, the apparatus further comprises:
and the receiving unit is used for receiving a log copy result response corresponding to the log uploading request sent by the main controller through the vehicle-mounted local area network.
In one embodiment, the sending unit 73 is further configured to, when the log upload request further includes the number of requests for the log to be uploaded, send, after sending the log upload request to the host controller for a preset period of time, after adding 1 to the number of requests in the log upload request if the log copy result response is not received, send an updated log upload request to the host controller through the vehicle-mounted lan, so that the host controller copies the log to be uploaded from the log storage path again according to the updated log upload request;
The apparatus further comprises:
the ignoring unit is used for ignoring the log copy result response under the condition that the destination address in the log copy result response is not an own address or the log identifier in the log copy result response is not the log identifier sent before the log identifier is sent by the user;
and the sending unit 73 is further configured to send, when the log copy result response includes that the log identifier is invalid, a log identifier resetting request to the host controller through the vehicle-mounted lan, and resend a log uploading request to the host controller, so that after the host controller deletes the locally stored log identifier to be reset according to the log identifier resetting request, copy the log to be uploaded from the log storage path according to the re-received log uploading request, where the log identifier resetting request includes the log identifier to be reset.
Based on the above embodiments, the embodiments of the present application provide a log uploading system of a controller, where the system includes a master controller and a slave controller, where the master controller is a controller capable of accessing a public network, and the slave controller is a controller incapable of accessing the public network, and the master controller and the slave controller communicate through a vehicle-mounted local area network;
The slave controller is configured to store a log to be uploaded in a log storage path of the slave controller after generating the log to be uploaded, generate a log uploading request corresponding to the log to be uploaded, and send the log uploading request to the master controller, where the log uploading request includes a log grade and a log identifier of the log to be uploaded;
the master controller is configured to send a normal log generation notification including the log level and the log identifier to a server when the log level characterizes that the log to be uploaded is a normal log, copy the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller after receiving a first upload command sent by the server, upload the log to be uploaded to the server, where the first upload command is an upload command generated by the server according to each normal log generation notification selected from the at least one normal log generation notification after the server acquires at least one normal log generation notification, where the normal log is a log generated under a condition that the controller is running normally, copy the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller when the log level characterizes that the log to be uploaded is an abnormal log, and upload the log to be uploaded to the server according to the log level, where the normal log is generated under a condition that the log is running abnormally.
In one embodiment, the master controller is configured to copy, when the log level characterizes that the log to be uploaded is an abnormal log and the log level is a first level, the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller, and directly upload the log to be uploaded to the server; and copying the log to be uploaded corresponding to the log identifier from the lower part of a log storage path of the slave controller under the condition that the log grade represents that the log to be uploaded is an abnormal log and the log grade is a second grade, sending an abnormal log generation notification comprising the log grade and the log identifier to the server, and uploading the log to be uploaded to the server according to the second uploading command after receiving the second uploading command issued by the server, wherein the second uploading command is an uploading command generated by generating the notification according to the abnormal log, and the abnormal degree represented by the first grade is larger than the second grade.
In one embodiment, the log uploading request further includes log file attribute information and/or request times of the log to be uploaded;
The normal log generation notification and/or the abnormal log generation notification further comprise at least one of log file attribute information, a time stamp and a log uploading state, wherein the time stamp is the time when the master controller receives the log uploading request for the first time.
In one embodiment, the main controller is configured to send, to the server, a normal log generation notification corresponding to the normal log generated by the main controller when the main controller generates the normal log, and upload the normal log generated by the main controller to the server after receiving a first upload command sent by the server; directly uploading the self-generated exception log to the server under the condition that the self-generated exception log is generated and the log grade of the self-generated exception log is the first grade; and when the self-generated abnormal log is generated and the log grade of the self-generated abnormal log is the second grade, sending an abnormal log generation notification corresponding to the self-generated abnormal log to the server, and uploading the self-generated abnormal log to the server according to the second uploading command after receiving the second uploading command issued by the server.
In one embodiment, the master controller is configured to send a log copy result response corresponding to the log upload request to the slave controller after copying the log to be uploaded corresponding to the log identifier under a log storage path of the slave controller;
the slave controller is configured to receive the log copy result response.
In one embodiment, the slave controller is configured to, when the log upload request further includes the number of requests for the log to be uploaded, send an updated log upload request to the master controller after sending the log upload request to the master controller for a preset period of time, and if the log copy result response is not received, add 1 to the number of requests in the log upload request;
and the master controller is used for receiving the updated log uploading request sent by the slave controller and copying the log to be uploaded from the log storage path again according to the updated log uploading request.
In one embodiment, the slave controller is configured to ignore the log copy result response if the destination address in the log copy result response is not a self address, or if the log identifier in the log copy result response is not a log identifier sent before the slave controller itself.
In one embodiment, the slave controller is configured to send a log identifier resetting request to the master controller and resend a log uploading request to the master controller when the log copy result response includes that the log identifier is invalid, where the log identifier resetting request includes a log identifier to be reset;
the master controller is used for receiving a log identifier resetting request, deleting the locally stored log identifier to be reset, receiving a log uploading request resent by the slave controller, and copying the log to be uploaded from the log storage path according to the re-received log uploading request.
In one embodiment, the master controller is configured to receive a retransmission instruction for the log to be uploaded sent by the server, and retransmit the log to be uploaded to the server, where the uploading of the log to be uploaded fails; and deleting the copied log to be uploaded under the condition that the log to be uploaded is successfully uploaded.
Based on the above embodiments, the embodiments of the present application provide a vehicle, which includes the log uploading system of the controller included in any of the above embodiments.
Based on the above embodiments, the present embodiments provide a storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to implement the method as described above.
The system and device embodiments correspond to the method embodiments, and have the same technical effects as the method embodiments, and specific description refers to the method embodiments. The apparatus embodiments are based on the method embodiments, and specific descriptions may be referred to in the method embodiment section, which is not repeated herein. The person of ordinary skill in the art can understand that: the figures are schematic representations of one embodiment only and the modules or flows in the figures are not necessarily required to practice the present application.
The person of ordinary skill in the art can understand that: the modules in the apparatus of the embodiments may be distributed in the apparatus of the embodiments according to the description of the embodiments, or may be located in one or more apparatuses different from the present embodiments with corresponding changes. The modules of the above embodiments may be combined into one module, or may be further split into a plurality of sub-modules.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (8)

1. A method for uploading logs of a controller, wherein the method is applied to a master controller capable of accessing a public network, the method comprising:
receiving a log uploading request sent by a slave controller through a vehicle-mounted local area network, wherein the slave controller is a controller incapable of accessing a public network, and the log uploading request comprises a log grade and a log identifier of a log to be uploaded;
when the log grade characterizes that the log to be uploaded is a normal log, sending a normal log generation notification including the log grade and the log identifier to a server, copying the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller after receiving a first uploading command sent by the server, uploading the log to the server, wherein the first uploading command is an uploading command generated by the server according to each normal log generation notification selected from the at least one normal log generation notification after acquiring at least one normal log generation notification, the normal log is generated under the condition that a controller operates normally, the normal log generation notification includes a timestamp, the timestamp is a time when the master controller receives the uploading request for the first time, the log uploading request also includes a first source address, the first source address is an uploading command of the slave controller sending the log uploading request, and the slave controller newly start up the address and the first log identifier, and the first source address are generated again after the master controller and the master controller newly start up the log identifier;
Copying the log to be uploaded corresponding to the log identifier from the lower side of a log storage path of the slave controller under the condition that the log grade represents that the log to be uploaded is an abnormal log, and uploading the log to be uploaded to the server according to the log grade, wherein the abnormal log is generated under the condition that the controller runs abnormally;
after copying the log to be uploaded corresponding to the log identifier from the log storage path of the slave controller, the method further comprises: transmitting a log copy result response corresponding to the log uploading request to the slave controller through the vehicle-mounted local area network;
and under the condition that the log copying result response comprises invalid log identification, after the slave controller sends a log identification resetting request to the master controller through the vehicle-mounted local area network and re-sends a log uploading request to the master controller, deleting the locally stored log identification to be reset according to the log identification resetting request, and copying the log to be uploaded from the log storage path according to the re-received log uploading request, wherein the log identification resetting request comprises the log identification to be reset, and determining that the log identification is invalid log identification after the log identification has been received before judgment.
2. The method of claim 1, wherein uploading the log to be uploaded to the server according to the log rank comprises:
under the condition that the log grade is the first grade, directly uploading the log to be uploaded to the server;
and under the condition that the log grade is the second grade, sending an abnormal log generation notification comprising the log grade and the log identification to the server, and uploading the log to be uploaded to the server according to a second uploading command after receiving the second uploading command issued by the server, wherein the second uploading command is an uploading command generated according to the abnormal log generation notification, and the degree of abnormality represented by the first grade is larger than the second grade.
3. The method according to claim 2, wherein the log upload request further comprises log file attribute information and/or the number of requests of the log to be uploaded;
the normal log generation notification further includes at least one of the log file attribute information, a log upload state, and/or the abnormal log generation notification further includes at least one of the log file attribute information, the time stamp, and a log upload state.
4. The method according to claim 2, wherein the method further comprises:
under the condition of generating a normal log by itself, sending a normal log generation notification corresponding to the generated normal log by itself to the server, and uploading the generated normal log by itself to the server after receiving a first uploading command for the generated normal log by itself sent by the server;
directly uploading the self-generated exception log to the server under the condition that the self-generated exception log is generated and the log grade of the self-generated exception log is the first grade;
and under the condition that the self-generated abnormal log is of a second level, sending an abnormal log generation notification corresponding to the self-generated abnormal log to the server, and uploading the self-generated abnormal log to the server after receiving a second uploading command for the self-generated abnormal log issued by the server.
5. The method according to any one of claims 1-4, further comprising:
receiving a retransmission instruction for the log to be uploaded sent by the server under the condition that the log to be uploaded fails to be uploaded, and retransmitting the log to be uploaded to the server;
And deleting the copied log to be uploaded under the condition that the log to be uploaded is successfully uploaded.
6. A log uploading method of a controller, wherein the method is applied to a slave controller which cannot access a public network, the method comprising:
after generating a log to be uploaded, storing the log to be uploaded to a log storage path of the slave controller;
generating a log uploading request corresponding to the log to be uploaded, wherein the log uploading request comprises a log grade and a log identifier of the log to be uploaded;
the log uploading request is sent to a main controller through a vehicle-mounted local area network, so that the main controller copies the log to be uploaded from the log storage path according to the log grade and the log mark in the log uploading request, and then uploads the copied log to be uploaded to a server according to the log grade, wherein the main controller is a controller capable of accessing a public network;
the master controller copies the log to be uploaded from the log storage path according to the log grade and the log identifier in the log uploading request, and then uploads the copied log to be uploaded to the server according to the log grade, and the master controller comprises the following steps: when the log grade characterizes that the log to be uploaded is a normal log, sending a normal log generation notification comprising the log grade and the log identifier to a server, copying the log to be uploaded corresponding to the log identifier from a log storage path of the slave controller after receiving a first uploading command sent by the server, uploading the log to the server, wherein the first uploading command is an uploading command generated by the server according to each normal log generation notification selected from the at least one normal log generation notification after acquiring at least one normal log generation notification, the normal log is generated under the condition that the controller operates normally, the normal log generation notification comprises a timestamp, the timestamp is the time when the master controller receives the uploading request for the first time, the log uploading request also comprises a first source address, the first source address is the slave controller sending the log uploading request, and the slave controller re-start the address and the first log identifier, and the first source address are generated again after the master controller re-starts the log identifier;
Receiving a log copy result response corresponding to the log uploading request sent by the main controller through the vehicle-mounted local area network;
and under the condition that the log copying result response comprises invalid log identification, sending a log identification resetting request to the main controller through the vehicle-mounted local area network, and sending a log uploading request to the main controller again, so that after deleting the locally stored log identification to be reset according to the log identification resetting request, the main controller copies the log to be uploaded from the log storage path according to the re-received log uploading request, wherein the log identification resetting request comprises the log identification to be reset, and the log identification is determined to be invalid log identification after the log identification has been received before judgment.
7. The method of claim 6, wherein the method further comprises:
when the log uploading request further comprises the request times of the log to be uploaded, after sending the log uploading request to the main controller for a preset time period, if the log copying result response is not received, adding 1 to the request times in the log uploading request, and sending an updated log uploading request to the main controller through the vehicle-mounted local area network, so that the main controller copies the log to be uploaded from the log storage path again according to the updated log uploading request;
And under the condition that the destination address in the log copy result response is not the self address or the log identifier in the log copy result response is not the log identifier sent before the self address, ignoring the log copy result response.
8. The log uploading system of the controller is characterized by comprising a master controller and a slave controller, wherein the master controller can access a public network controller, the slave controller can not access the public network controller, and the master controller and the slave controller are communicated through a vehicle-mounted local area network;
the slave controller is configured to store a log to be uploaded in a log storage path of the slave controller after generating the log to be uploaded, generate a log uploading request corresponding to the log to be uploaded, and send the log uploading request to the master controller, where the log uploading request includes a log grade and a log identifier of the log to be uploaded;
the master controller is configured to send a normal log generation notification including the log level and the log identifier to a server when the log level characterizes that the log to be uploaded is a normal log, copy, from a log storage path of the slave controller, the log to be uploaded corresponding to the log identifier after receiving a first upload command sent by the server, upload the log to be uploaded to the server, where the first upload command is an upload command generated by the server according to each normal log generation notification selected from the at least one normal log generation notification after the server acquires at least one normal log generation notification, where the normal log is a log generated under a condition that the controller is running normally, copy, from a log storage path of the slave controller, the log to be uploaded corresponding to the log identifier when the log level characterizes that the log to be uploaded is an abnormal log, and upload the log to be uploaded to the server according to the log level, where the log to be uploaded is generated under an abnormal condition of the slave controller;
The normal log generation notification comprises a time stamp, wherein the time stamp is the time when the master controller receives the log uploading request for the first time, the log uploading request further comprises a first source address, the first source address is the address of the slave controller sending the log uploading request, the master controller and the slave controller restart the equipment to which the slave controller belongs and then carry out numbering on the generated log again to generate a log identifier, and the first uploading command comprises the log identifier, the first source address and the time stamp;
the master controller is used for sending a log copy result response corresponding to the log uploading request to the slave controller after copying the log to be uploaded corresponding to the log identifier under a log storage path of the slave controller;
the slave controller is used for receiving the log copy result response;
the slave controller is configured to send a log identifier resetting request to the master controller and resend a log uploading request to the master controller when the log copy result response includes that the log identifier is invalid, where the log identifier resetting request includes a log identifier to be reset, and before determining that the log identifier has been received, the log identifier is determined to be an invalid log identifier;
The master controller is used for receiving a log identifier resetting request, deleting the locally stored log identifier to be reset, receiving a log uploading request resent by the slave controller, and copying the log to be uploaded from the log storage path according to the re-received log uploading request.
CN202210723806.8A 2022-06-24 2022-06-24 Log uploading method and system of controller Active CN115174554B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210723806.8A CN115174554B (en) 2022-06-24 2022-06-24 Log uploading method and system of controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210723806.8A CN115174554B (en) 2022-06-24 2022-06-24 Log uploading method and system of controller

Publications (2)

Publication Number Publication Date
CN115174554A CN115174554A (en) 2022-10-11
CN115174554B true CN115174554B (en) 2023-07-11

Family

ID=83486713

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210723806.8A Active CN115174554B (en) 2022-06-24 2022-06-24 Log uploading method and system of controller

Country Status (1)

Country Link
CN (1) CN115174554B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019125867A (en) * 2018-01-12 2019-07-25 パナソニックIpマネジメント株式会社 Monitoring device, monitoring system and monitoring method
CN110912998A (en) * 2019-11-26 2020-03-24 福建汉特云智能科技有限公司 Vehicle problem troubleshooting system and method based on remote equipment terminal
US10705918B1 (en) * 2017-07-21 2020-07-07 EMC IP Holding Company LLC Online metadata backup consistency check
CN112437140A (en) * 2020-11-13 2021-03-02 北京经纬恒润科技股份有限公司 Method and device for remotely exporting TBOX log

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10705918B1 (en) * 2017-07-21 2020-07-07 EMC IP Holding Company LLC Online metadata backup consistency check
JP2019125867A (en) * 2018-01-12 2019-07-25 パナソニックIpマネジメント株式会社 Monitoring device, monitoring system and monitoring method
CN110912998A (en) * 2019-11-26 2020-03-24 福建汉特云智能科技有限公司 Vehicle problem troubleshooting system and method based on remote equipment terminal
CN112437140A (en) * 2020-11-13 2021-03-02 北京经纬恒润科技股份有限公司 Method and device for remotely exporting TBOX log

Also Published As

Publication number Publication date
CN115174554A (en) 2022-10-11

Similar Documents

Publication Publication Date Title
CN111538763B (en) Method for determining master node in cluster, electronic equipment and storage medium
WO2013139196A1 (en) Auxiliary diagnosis method, device and system for virtual machine failure
CN110636128A (en) Data synchronization method, system, electronic equipment and storage medium
CN102255974A (en) Cloud storage method for cloud computing server
WO2016202126A1 (en) Method and device of reclaiming ip address and dynamic host configuration protocol server
US20090070336A1 (en) Method and system for managing transmitted requests
CN110312245A (en) A kind of business monitoring method and device of transnational roaming terminal
CN109586989B (en) State checking method, device and cluster system
CN110809262A (en) Internet of things equipment operation and maintenance management method based on COAP protocol
CN115174554B (en) Log uploading method and system of controller
CN114090342A (en) Storage disaster tolerance link management method, message execution node and storage control cluster
CN113055203A (en) Method and device for recovering abnormity of SDN control plane
CN108880994B (en) Method and device for retransmitting mails
CN111211925B (en) Alarm information synchronization method and device, computer equipment and storage medium
CN112306871A (en) Data processing method, device, equipment and storage medium
CN111680106A (en) Method and device for synchronizing data of multiple application systems
CN114466321B (en) Message sending method and device, electronic equipment and storage medium
JP2007328609A5 (en)
CN116319277A (en) Method and system for selecting main materials by using Raft in heterogeneous environment
CN114024819B (en) Event information reporting method and device
CN107800754B (en) Data transmission task processing method and device, and data transmission task monitoring method and device
CN115033428A (en) Management method, system and management server of distributed database
CN113316180B (en) Method and device for processing exception of service tunnel
CN113259203A (en) Terminal performance monitoring method and device
CN108848147B (en) SNMP proxy equipment registration method, device, computer equipment and storage medium

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