CN111198855B - Log data processing method and device - Google Patents

Log data processing method and device Download PDF

Info

Publication number
CN111198855B
CN111198855B CN201911409299.5A CN201911409299A CN111198855B CN 111198855 B CN111198855 B CN 111198855B CN 201911409299 A CN201911409299 A CN 201911409299A CN 111198855 B CN111198855 B CN 111198855B
Authority
CN
China
Prior art keywords
serial port
log data
port channel
current
time
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
CN201911409299.5A
Other languages
Chinese (zh)
Other versions
CN111198855A (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.)
Shenzhen Queclink Communication Technology Co ltd
Original Assignee
Shenzhen Queclink Communication Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Queclink Communication Technology Co ltd filed Critical Shenzhen Queclink Communication Technology Co ltd
Priority to CN201911409299.5A priority Critical patent/CN111198855B/en
Publication of CN111198855A publication Critical patent/CN111198855A/en
Application granted granted Critical
Publication of CN111198855B publication Critical patent/CN111198855B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • 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/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a log data processing method and device. The method comprises the following steps: detecting whether each serial port receives log data sent by the connecting equipment; if at least one serial port is detected to receive the log data sent by the connection device, for each serial port, the obtained log data is stored in a serial port channel folder corresponding to the serial port through the serial port, and the connection device is automatically detected by means of the secure digital card and the detected log data is stored in the serial port channel folder corresponding to the serial port in the secure digital card, so that the received log data can be stored in a partitioning mode, and the convenience of log data detection and storage is effectively improved.

Description

Log data processing method and device
Technical Field
The embodiment of the application relates to the technical field of serial data processing, in particular to a log data processing method and device.
Background
In the process of testing large-scale mobile equipment, serial port log data of each equipment are often required to be recorded, so that a user and a developer can know the running condition of a system or software conveniently, and the development and analysis of data resources are assisted, so that the system is perfected better, and the efficiency of investigation and problem solving is improved.
The common serial log data recording method is to access a serial line for each device, then connect the serial lines to a computer, record the log data on a serial communication assistant of the computer, record the serial data by a serial assistant, and manually detect and store in real time.
However, because the user needs to manually detect and store the log data in the device through a computer, the log data detection and storage are inconvenient.
Disclosure of Invention
The embodiment of the application provides a log data processing method and device, which are used for solving the problem that the serial port log data detection and storage are inconvenient in the prior art.
In a first aspect, an embodiment of the present application provides a method for processing log data, including:
detecting whether each serial port receives log data sent by the connecting equipment;
if at least one serial port is detected to receive the log data sent by the connection device, storing the received log data in a serial port channel folder corresponding to the serial port through the serial port;
the serial port channel folder is arranged in a local secure digital card.
Optionally, the method further comprises:
When the connection equipment is determined to be connected, detecting whether a serial port channel folder corresponding to each serial port exists in a local secure digital card;
if not, establishing a corresponding serial port channel folder in the secure data card for each serial port.
Optionally, for each serial port, storing, by the serial port, the received log data in a serial port channel folder corresponding to the serial port, including:
when the serial port channel folder corresponding to the serial port is determined to not have the serial port channel file, a corresponding first serial port channel file is established, and the current first time is determined, so that the first serial port channel file is named according to the first time and a preset file format;
and storing the log data acquired by the serial port in the first serial port channel file.
Optionally, the storing the log data obtained by the serial port in the first serial port channel file includes:
packaging the log data received by the serial port, and recording a current serial port identifier and a current timestamp corresponding to the packaged log data;
storing the packed log data, the current serial port identifier corresponding to the packed log data and the current time into a cache queue corresponding to the current serial port identifier;
When the log data received by the serial port meets the preset condition, determining whether the current time corresponding to the packed log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the identifier of the current serial port;
and when the data are identical, storing the packed log data into the first serial port channel file.
Optionally, the method further comprises:
if the current time corresponding to the packed log data stored in the cache queue is determined to be different from the time of the first serial port channel file corresponding to the current serial port identifier, establishing a second serial port channel file corresponding to the serial port;
determining a current second time, naming the second serial port channel file according to the second time and a preset file format, and storing the packaged log data in the second serial port channel file.
Optionally, the method further comprises:
acquiring a log data calling request, wherein the log data calling request comprises time information to be called;
inquiring the secure digital card according to the log data retrieval request, acquiring a serial port channel file matched with the retrieved time information, and reporting the packaged log data stored in the file.
Optionally, the determining that the log data received by the serial port meets a preset condition includes:
when detecting that the connection equipment transmits a data byte interval and analyzing an idle identification bit based on the data byte interval, determining that log data received by the serial port meets a preset condition;
or alternatively, the process may be performed,
and analyzing the received log data, and if the analyzed log data comprises characters identical to the preset characters, determining that the log data received by the serial port meets the preset conditions.
Optionally, the method further comprises:
and when the capacity of the stored log data in the secure digital card is determined to be larger than a preset storage threshold, deleting the stored serial port channel file in the secure digital card according to the timestamp corresponding to the packaged log data.
In a second aspect, an embodiment of the present application provides a log data processing apparatus, including:
the detection module is used for detecting whether each serial port receives log data sent by the connection equipment;
the processing module is used for storing the received log data in a serial port channel folder corresponding to the serial port through the serial port if at least one serial port is detected to receive the log data sent by the connecting device;
The serial port channel folder is arranged in a local secure digital card.
Optionally, the detection module is further configured to detect whether a serial port channel folder corresponding to each serial port exists in the local secure digital card when determining that the connection device is connected.
The processing module is further configured to, when no serial port channel folder corresponding to each serial port exists in the secure digital card, establish a corresponding serial port channel folder in the secure digital card for each serial port, and establish a first serial port channel file under each serial port channel folder.
Optionally, the processing module is specifically configured to:
when the serial port channel folder corresponding to the serial port is determined to not have the serial port channel file, a corresponding first serial port channel file is established, and the current first time is determined, so that the first serial port channel file is named according to the first time and a preset file format;
and storing the log data acquired by the serial port in the first serial port channel file.
Optionally, the processing module is specifically configured to:
packaging the log data received by the serial port, and recording a current serial port identifier and a current timestamp corresponding to the packaged log data;
Storing the packed log data, the current serial port identifier corresponding to the packed log data and the current time into a cache queue corresponding to the current serial port identifier;
when the log data received by the serial port meets the preset condition, determining whether the current time corresponding to the packed log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the identifier of the current serial port;
and when the data are identical, storing the packed log data into the first serial port channel file.
Optionally, the processing module is further configured to:
when the current time corresponding to the packed log data stored in the cache queue is different from the time of the first serial port channel file corresponding to the identification of the current serial port, establishing a second serial port channel file corresponding to the serial port;
determining a current second time, naming the second serial port channel file according to the second time and a preset file format, and storing the packaged log data in the second serial port channel file.
Optionally, the processing module is further configured to obtain a log data retrieval request, where the log data retrieval request includes time information to be retrieved;
The processing module is also used for inquiring the secure digital card according to the log data calling request, acquiring a serial port channel file matched with the called time information, and reporting the packaged log data stored in the file.
Optionally, the processing module is specifically configured to:
when detecting that the connection equipment transmits a data byte interval and analyzing an idle identification bit based on the data byte interval, determining that log data received by the serial port meets a preset condition;
or alternatively, the process may be performed,
and analyzing the received log data, and if the analyzed log data comprises characters identical to the preset characters, determining that the log data received by the serial port meets the preset conditions.
Optionally, the processing module is further configured to delete the serial port channel file stored in the secure digital card according to the timestamp corresponding to the packaged log data when it is determined that the capacity of storing the log data in the secure digital card is greater than a preset storage threshold.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a memory for storing program instructions;
And the processor is used for calling and executing the program instructions in the memory and executing the log data processing method according to the first aspect of the application.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program, which when executed by a processor, implements a method for processing log data according to the first aspect of the present application.
According to the method and the device for processing the log data, the data are sent to each serial port through the connecting equipment, whether each serial port receives the log data sent by the connecting equipment or not is detected, if at least one serial port is detected to receive the log data sent by the connecting equipment, the received log data are stored in the serial port channel folder corresponding to the serial port through the serial ports, the connecting equipment is automatically detected by means of the secure digital card, the detected log data are stored in the serial port channel folder corresponding to the serial port in the secure digital card, and therefore the received log data can be stored in a partitioning mode, and the convenience of log data detection and storage is effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief description will be given below of the drawings that are needed in the embodiments or the prior art descriptions, it being obvious that the drawings in the following description are some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a diagram of a scene architecture as applied to various embodiments of the present application;
FIG. 2 is a flow chart illustrating a method for processing log data according to an embodiment of the present disclosure;
fig. 3 is a flowchart illustrating a method for processing log data according to another embodiment of the present disclosure;
fig. 4 is a flowchart illustrating a method for processing log data according to still another embodiment of the present disclosure;
fig. 5 is a flowchart of a method for processing log data according to another embodiment of the present disclosure;
FIG. 6 is a schematic structural diagram of a log data processing device according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The serial port log data recording method in the prior art is to connect a serial port line for each device, then connect the serial port lines to a computer, record the log data on a serial port communication assistant of the computer, record the serial port data through a serial port assistant, and manually detect and store the serial port data in real time. However, because the user needs to manually detect and store the log data in the device through a computer, the log data detection and storage are inconvenient.
Based on the technical problem, the log data on the connecting device is automatically detected and stored by mainly adopting convenient detection equipment. Specifically, a plurality of serial channels and a secure digital card are arranged in the detection device, the connection device is also provided with a corresponding serial channel, after the detection device is connected with the connection device through the serial ports, the connection device sends data to each serial port, then whether each serial port of the detection device receives log data sent by the connection device is detected, if at least one serial port of the detection device receives the log data sent by the connection device, the obtained log data is stored in a serial channel file corresponding to the serial port through the serial port of the detection device, and the serial channel file is arranged in the secure digital card.
Fig. 1 is a view of a scene architecture applied in various embodiments of the present application, as shown in fig. 1, which mainly includes: a detection device 11, and a connection device 12 connected to the detection device; wherein, the detection device 11 is provided with a secure digital card 110 and a plurality of serial ports 111; the connection device 12 includes multiple serial ports 121; the detection device 11 and the connection device 12 are connected by respective serial ports.
The technical solutions of the present application are described below in connection with several specific embodiments.
Fig. 2 is a flow chart of a method for processing log data according to an embodiment of the present application, as shown in fig. 2, the method according to the embodiment of the present application may include:
s201, detecting whether each serial port receives log data sent by the connecting device.
In this embodiment, after the detection device 11 is connected to the connection device 12, the connection device 12 powers up the detection device 11 when detecting that there is a device connected to it through a serial port, so that the detection device can detect whether each serial port receives log data sent by the connection device based on the serial port.
And S202, if at least one serial port is detected to receive the log data sent by the connection equipment, storing the received log data in a serial port channel folder corresponding to the serial port through the serial port. The serial port channel folder is arranged in a local secure digital card.
In this embodiment, log data sent by the connection device is detected, if at least one serial port in multiple serial ports is detected to receive the log data sent by the connection device, the detected log data sent by the connection device is stored in a corresponding serial port channel folder, and because the serial port channel folder is set in a local secure digital card, the detected log data sent by the connection device can be stored in the local secure digital card in a partitioned manner. The local secure digital CARD may be a TF-CARD memory CARD.
In this embodiment, the detection device is connected to the connection device through the serial ports, and detects whether each serial port receives the log data sent by the connection device, if it is detected that at least one serial port receives the log data sent by the connection device, the obtained log data is stored in the serial port channel file corresponding to the serial port through the serial port, and because the log data detected by each serial port is stored in the serial port channel folder corresponding to the serial port by means of the secure digital card, the received log data can be stored in a partition mode, and the convenience of log data detection and storage is effectively improved.
Fig. 3 is a flowchart of a method for processing log data according to another embodiment of the present application, as shown in fig. 3, the method according to the embodiment of the present application may include:
and S301, detecting whether serial port channel folders corresponding to the serial ports exist in the local secure digital card when the connection device is determined to be connected.
In this embodiment, the detection device provided with the secure digital card is connected to the connection device, and after the connection device powers on the detection device, the detection device may first determine whether, for each serial port, there is a serial port channel folder corresponding to the serial port in the local secure digital card.
S302, if the serial port channel folder does not exist, establishing a corresponding serial port channel folder in the secure data card for each serial port.
In this embodiment, if it is detected that at least one serial port does not establish a serial port channel folder corresponding to the serial port, then in the local secure digital card, the serial port channel folder corresponding to the serial port for which the serial port channel folder is not established is established.
S303, detecting whether each serial port receives log data sent by the connecting device.
In this embodiment, it is determined whether each serial port of the detection device receives log data sent by the connection device. If the log data sent by the connection device is received, step S304 is executed, and if the log data sent by the connection device is not received, the step is circulated until the serial port corresponding to the detection device receives the log data sent by the connection device, and then step S304 is executed.
S304, if it is detected that at least one serial port receives log data sent by the connection device, for each serial port, when it is determined that serial port channel files do not exist in serial port channel folders corresponding to the serial ports, a corresponding first serial port channel file is established, and the current first time is determined, so that the first serial port channel file is named according to the first time and a preset file format. The serial port channel folder is arranged in a local secure digital card.
In this embodiment, the detecting device detects each serial port, and after detecting that at least one serial port channel in the plurality of serial ports has received serial port log data sent by the connecting device, determines, for each serial port, whether the serial port channel folder established in the secure data card has a corresponding serial port channel file. And if the serial port channel folder does not have the corresponding serial port channel file, newly establishing a first serial port channel file corresponding to the serial port channel folder. For the newly built serial port channel file, the current first time can be further determined, and the serial port channel file is named according to the first time and a preset file format. For example, the serial port channel file name may be: CHANNEL 1_2019-01. TXT, CHANNEL1 represents a serial port; 2019-01-01 represents the time of the established first serial port channel file, namely the first time; TXT represents a preset file format.
Based on the above, when the detection device detects the connection device and stores log data information, a serial port channel folder corresponding to each serial port is set for each serial port. After the serial port receives serial port log data sent by the connecting device, newly creating a serial port channel file under a serial port channel folder corresponding to the serial port; there is a correlation between the naming of the serial port channel file and the time at which the serial port log data is stored.
In addition, for each serial port channel file, the time of the log data stored in the serial port channel file is matched with the time of the serial port channel file establishment.
S305, storing the log data acquired by the serial port in the first serial port channel file.
In this embodiment, according to the first serial port channel file established in S304, log data sent by the connection device and received by the detection device is stored in a serial port channel file corresponding to the serial port, where the serial port channel file is further established in a corresponding serial port channel folder, that is, the received log data is finally stored in a serial port channel folder corresponding to the serial port, and partition storage of the log data can be implemented through relevance of the received log data.
In this embodiment, first, a detecting device provided with a local secure digital card is connected with a connecting device, and after the connection, whether a serial port channel folder corresponding to each serial port exists in the local secure digital card is detected; if the serial port channel folder does not exist, establishing a corresponding serial port channel folder in the secure data card for each serial port; detecting whether each serial port of the detection equipment receives log data sent by the connection equipment or not; if at least one serial port is detected to receive log data sent by the connection device, establishing a corresponding first serial port channel file when determining that a serial port channel file does not exist in a serial port channel folder corresponding to the serial port for each serial port, and determining the current first time so as to name the first serial port channel file according to the first time and a preset file format; and then storing the log data acquired by the serial port in the first serial port channel file. Because the connection equipment is automatically detected by the secure digital card, the detected log data is stored in the serial port channel file corresponding to the serial port in the secure digital card, and for each serial port channel file, the time of the log data stored in the serial port channel file is matched with the time established by the serial port channel file, therefore, the partition storage of the log data can be realized through the relevance between the serial port channel file and the serial port channel folder corresponding to the serial port channel file, and the convenience of the log data detection storage is effectively improved.
Fig. 4 is a flow chart of a log data processing method according to still another embodiment of the present application, as shown in fig. 4, and based on the embodiment of fig. 3, optionally, a specific implementation manner of S305 is as follows:
s305a, packaging the log data received by the serial port, and recording a current serial port identifier and a current time stamp corresponding to the packaged log data.
If it is detected that at least one serial port channel of the plurality of serial ports receives serial port log data sent by the connection device, detecting whether the received log data exceeds 512 bytes or the byte interval exceeds 200ms, if the received log data exceeds 512 bytes or the byte interval exceeds 200ms, packaging the received serial port log data sent by the connection device for each serial port, and recording a current serial port identifier and a current timestamp corresponding to the packaged log data. The current serial port identifier may be a CHANNEL number of a current CHANNEL, for example, a current serial port identifier corresponding to the packaged log data is CHANNEL1, and the current timestamp may be a time of the received log data, for example, a current timestamp corresponding to the packaged log data is 2019-01-01.
S305b, storing the packed log data, the corresponding current serial port identifier and the current time into a cache queue corresponding to the current serial port identifier.
And storing the packaged log data with the current serial port identifier and the current timestamp in the S305a into a cache queue corresponding to the identifier of the current serial port. Namely, after the received log data is packed, the received log data is firstly cached and stored, so that the number of times of writing the received log data into the local secure digital card is reduced, and writing is performed after the received packed log data reaches the specified receiving amount, and the storage efficiency is improved. The buffer queue can be described by a transfer station in an image, that is, if the received log data is more, the storage area may not be received, the buffer queue is stored in the transfer station for buffering, the queue is a large container, all the received log data are stored in the queue, and each serial log data packet is marked before the log data are stored.
S305c, when it is determined that the log data received by the serial port meets a preset condition, determining whether the current time corresponding to the packaged log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the identifier of the current serial port. If the two are the same, step S305d is performed; if not, step S305e is performed.
When it is detected that the log data received by the serial port meets a preset condition, according to the packaged log data with the current serial port identifier and the current timestamp stored in S305b, whether the current time corresponding to the packaged log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the identifier of the current serial port is judged, so that the first serial port channel file corresponding to the identifier of the current serial port is newly built in real time.
The preset condition may be that the interval between the received log data bytes exceeds a certain preset time, where the preset time may be specifically set according to the situation, and in this embodiment, set to 200ms.
And S305d, storing the packed data into the first serial port channel file, and ending the processing flow.
If it is determined that the current time corresponding to the packed log data stored in the buffer queue is the same as the time of the first serial port channel file corresponding to the current serial port identifier, the packed log data with the current serial port identifier and the current timestamp stored in the buffer queue can be directly stored in the current first serial port channel file. For example, the current time corresponding to the packed log data stored in the buffer queue is 2019-01-01, and the time of the corresponding first serial port CHANNEL file identified as CHANNEL1 by the current serial port is 2019-01-01, then the packed log data identified as CHANNEL1 and having a current timestamp of 2019-01-01 stored in the buffer queue may be directly stored in the first serial port CHANNEL file currently named CHANNEL 1_2019-01-01.txt.
S305e, establishing a second serial port channel file corresponding to the serial port.
If the current time corresponding to the packed log data stored in the cache queue is determined to be different from the time of the first serial port channel file corresponding to the identifier of the current serial port, a second serial port channel file corresponding to the serial port needs to be established. For example, the current time corresponding to the packed log data stored in the buffer queue is 2019-01-02, the time of the corresponding first serial port CHANNEL file of the current serial port identifier as CHANNEL1 is 2019-01-01, and then a second serial port CHANNEL file corresponding to the serial port needs to be established, and the current serial port of the established second serial port CHANNEL file is identified as CHANNEL1.
S305f, determining the current second time, naming the second serial port channel file according to the second time and a preset file format, and storing the packaged log data in the second serial port channel file.
When detecting that the current time corresponding to the packed log data stored in the buffer queue is different from the time of the first serial port channel file corresponding to the identifier of the current serial port, obtaining a current second time, namely the time of the established second serial port channel file, according to the second time and the preset file format of the second serial port channel file, naming the second serial port channel file corresponding to each established serial port, and then storing the packed log data stored in the buffer queue into the second serial port channel file which is newly established. For example, the naming of the second serial port channel file established in the first serial port channel in the multiple serial port channel files may be: CHANNEL1_2019-01-02.TXT, wherein CHANNEL1 represents a first CHANNEL of serial CHANNELs; 2019-01-02 represents the time of the established second serial port channel file, namely the second time; TXT represents a preset file format, the packed log data stored in the cache queue may be stored in the second serial port CHANNEL file named CHANNEL1_2019-01-02. TXT.
Optionally, one possible implementation of S305c is:
when detecting the interval of data bytes sent by the connection device and analyzing the idle identification bit based on the interval of the data bytes, determining that log data received by the serial port meets preset conditions.
And analyzing the received packed log data, namely detecting the data byte interval transmitted by the connecting equipment, namely judging whether the byte interval in the received log data exceeds 200 ms. If the data byte interval sent by the connection device is detected to exceed 200ms, setting an idle flag bit based on the data byte interval, determining that the log data byte interval received by the serial port exceeds 200ms based on the idle flag bit analyzed by the data byte interval, recording the current time, and storing the received log data into a serial port channel file corresponding to the serial port.
Alternatively, another possible implementation of S305c is:
and analyzing the received log data, and if the analyzed log data comprises characters identical to the preset characters, determining that the log data received by the serial port meets the preset conditions.
And analyzing the received packed log data, judging whether the analyzed log data contains characters identical to preset characters, if so, determining that the log data received by the serial port meets preset conditions, recording the current time, and storing the received log data in a serial port channel file corresponding to the serial port.
The preset character may be a carriage return character, which is not limited in this application.
Fig. 5 is a flow chart of a log data processing method according to another embodiment of the present application, as shown in fig. 5, and optionally, on the basis of the embodiment of fig. 3, the method includes:
s306, acquiring a log data calling request, wherein the log data calling request comprises time information to be called.
The connection device sends a log data calling request to the detection device provided with the local secure digital card, and the detection device provided with the local secure digital card can receive the log data calling request, wherein the log data calling request contains time information to be called.
S307, inquiring the secure digital card according to the log data calling request, acquiring a serial port channel file matched with the called time information, and reporting the packaged log data stored in the file.
When the detection equipment detects and stores log data information, for each serial port, a serial port channel folder corresponding to the serial port channel folder and serial port channel files under the serial port channel folder are arranged, and the file names and the time for storing the log data have relevance, when the log data calling request acquired in the S306 is received, the packaged log data with serial port identifications and time information stored in the local security numbers can be traversed and inquired according to the relevance, a serial port channel file matched with the called time information is acquired, and then the packaged log data stored in the serial port channel file is reported, so that a problem time point can be better positioned, and the time point is taken as a reference, so that the packaged log data with problems can be conveniently and quickly searched.
Optionally, based on the embodiment of fig. 3, the method further includes:
And S308, deleting the serial port channel file stored in the secure digital card according to the timestamp corresponding to the packaged log data when the capacity of storing the log data in the secure digital card is determined to be larger than a preset storage threshold value.
In this embodiment, before it is detected that at least one serial port receives log data sent on the connection device and the obtained log data is stored in a serial port channel file corresponding to the serial port through the serial port, it is required to determine whether a capacity of storing log data in the local secure digital card is greater than a preset storage threshold, if it is determined that the capacity of storing log data in the secure digital card is greater than the preset storage threshold, deleting some serial port channel log files with earlier time information corresponding to the packaged log data according to a timestamp corresponding to the packaged log data, so as to obtain sufficient capacity to continue storing log data, where the preset storage threshold may be a difference between a total capacity value of the secure digital card and the received log data capacity value to be stored.
In this embodiment, first, a detection device provided with a local secure digital card is connected with a connection device, and after the connection, whether a serial port channel folder corresponding to multiple serial ports exists in the local secure digital card is detected; if the serial port channel file does not exist, establishing a corresponding serial port channel folder in the secure data card for each serial port, and establishing a first serial port channel file under each serial port channel folder; naming the first serial port channel files corresponding to each serial port according to the first time and a preset file format; transmitting data to each serial port through the connection equipment, detecting whether each serial port receives log data transmitted by the connection equipment or not, if at least one serial port receives the log data transmitted by the connection equipment, packaging the received log data, recording a current serial port identifier and a current timestamp corresponding to the packaged log data, and storing the current serial port identifier and the current timestamp in a cache queue corresponding to the identifier of the current serial port; when the serial port is determined not to receive the log data sent by the connection device, determining whether the current time corresponding to the packed log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the identifier of the current serial port; and when the data are identical, storing the packed data into the first serial port channel file. If the first serial port channel files are different, a first serial port channel file is newly established, the current first time is determined, the first serial port channel file is named according to the first time and a preset file format, the packed log data are stored in the first serial port channel file, and then the packed log data are stored in the first serial port channel file corresponding to the serial port, so that more log data can be processed, more log files are stored, and the analysis efficiency of the serial port data is improved. Meanwhile, the security digital card can be queried according to the transmitted log data retrieval request, a serial port channel file matched with the retrieved time information is obtained, and the packaged data stored in the file is reported, so that a problem time point can be better positioned, and the convenience of log data detection and storage is effectively improved.
Fig. 6 is a schematic structural diagram of a log data processing apparatus according to an embodiment of the present application, and as shown in fig. 6, an apparatus 600 according to an embodiment of the present application may include: the detection module 610 and the processing module 620.
The detecting module 610 is configured to detect whether each serial port receives log data sent by the connection device.
The processing module 620 is configured to store, if it is detected that at least one serial port receives log data sent on the connection device, the received log data in a serial port channel folder corresponding to the serial port through the serial port.
The serial port channel folder is arranged in a local secure digital card.
Optionally, the detecting module 610 is further configured to detect whether a serial port channel folder corresponding to each serial port exists in the local secure digital card when determining that the connection device is connected.
The processing module 620 is further configured to, when no serial port channel folder corresponding to each serial port exists in the local secure digital card, establish, for each serial port, a corresponding serial port channel folder in the secure digital card.
The processing module 620 is specifically configured to:
When the serial port channel folder corresponding to the serial port is determined to not have the serial port channel file, a corresponding first serial port channel file is established, and the current first time is determined, so that the first serial port channel file is named according to the first time and a preset file format;
and storing the log data acquired by the serial port in the first serial port channel file.
Optionally, the processing module 620 is specifically configured to:
and packaging the log data received by the serial port, and recording a current serial port identifier and a current time stamp corresponding to the packaged log data.
Storing the packed log data, the current serial port identifier corresponding to the packed log data and the current time into a cache queue corresponding to the current serial port identifier.
When the log data received by the serial port meets the preset condition, determining whether the current time corresponding to the packed log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the identifier of the current serial port.
And when the data are identical, storing the packed data into the first serial port channel file.
Optionally, the processing module 620 is further configured to:
If the serial ports are different, a second serial port channel file corresponding to the serial ports is established.
Determining a current second time, naming the second serial port channel file according to the second time and a preset file format, and storing the packaged log data in the second serial port channel file.
Optionally, the processing module 620 is further configured to obtain a log data retrieval request, where the log data retrieval request includes time information to be retrieved.
The processing module 620 is further configured to query the secure digital card according to a log data retrieval request, obtain a serial port channel file that matches the retrieved time information, and report the packaged data stored in the file.
Optionally, the processing module 620 is specifically configured to:
when detecting that the connection equipment transmits a data byte interval and analyzing an idle identification bit based on the data byte interval, determining that log data received by the serial port meets a preset condition;
or alternatively, the process may be performed,
and analyzing the received log data, and if the analyzed log data comprises characters identical to the preset characters, determining that the log data received by the serial port meets the preset conditions.
Optionally, the processing module 620 is further configured to delete the serial port channel file stored in the secure digital card according to the timestamp corresponding to the packaged log data when it is determined that the capacity of storing the log data in the secure digital card is greater than a preset storage threshold.
The device of the present embodiment may be used to execute the technical solutions of the above method embodiments, and its implementation principle and technical effects are similar, and are not repeated here.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application, as shown in fig. 7, an electronic device 700 according to the embodiment may include: memory 710, processor 720.
A memory 710 for storing program instructions;
processor 720, for calling and executing program instructions in the memory, performs:
and detecting whether each serial port receives log data sent by the connecting equipment.
If at least one serial port is detected to receive the log data sent by the connection device, the obtained log data is stored in a serial port channel folder corresponding to the serial port through the serial port.
The serial port channel folder is arranged in a local secure digital card.
Optionally, the processor 720 is further configured to:
when the connection equipment is determined to be connected, detecting whether a serial port channel folder corresponding to each serial port exists in the local secure digital card.
If the serial port channel file folder does not exist, establishing a corresponding serial port channel folder in the secure data card for each serial port.
Optionally, the processor 720 is specifically configured to:
when the fact that the serial port channel file does not exist in the serial port channel folder corresponding to the serial port is determined, a corresponding first serial port channel file is established, the current first time is determined, and the first serial port channel file is named according to the first time and a preset file format.
And storing the log data acquired by the serial port in the first serial port channel file.
Optionally, the processor 720 is specifically configured to:
and packaging the log data received by the serial port, and recording a current serial port identifier and a current time stamp corresponding to the packaged log data.
Storing the packed log data, the current serial port identifier corresponding to the packed log data and the current time into a cache queue corresponding to the current serial port identifier.
When the log data received by the serial port meets the preset condition, determining whether the current time corresponding to the packed log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the identifier of the current serial port.
And when the data are identical, storing the packed data into the first serial port channel file.
Optionally, the processor 720 is further configured to:
if the serial ports are different, a second serial port channel file corresponding to the serial ports is established.
Determining a current second time, naming the second serial port channel file according to the second time and a preset file format, and storing the packaged log data in the second serial port channel file.
Optionally, the processor 720 is further configured to:
acquiring a log data calling request, wherein the log data calling request comprises time information to be called;
inquiring the secure digital card according to the log data retrieval request, acquiring a serial port channel file matched with the retrieved time information, and reporting the log data stored in the file.
Optionally, the processor 720 is specifically configured to:
When detecting that the connection equipment transmits a data byte interval and analyzing an idle identification bit based on the data byte interval, determining that log data received by the serial port meets a preset condition;
or alternatively, the process may be performed,
and analyzing the received log data, and if the analyzed log data comprises characters identical to the preset characters, determining that the log data received by the serial port meets the preset conditions.
Optionally, the processor 720 is further configured to:
and when the capacity of the stored log data in the secure digital card is determined to be larger than a preset storage threshold, deleting the stored serial port channel file in the secure digital card according to the timestamp corresponding to the packaged log data.
The electronic device of the present embodiment may be used to execute the technical solutions of the foregoing method embodiments, and its implementation principle and technical effects are similar, and are not described herein again.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like, which can store program codes.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; 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 or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (8)

1. A method for processing log data, comprising:
detecting whether each serial port receives log data sent by the connecting equipment;
if at least one serial port is detected to receive the log data sent by the connection device, storing the received log data in a serial port channel folder corresponding to the serial port through the serial port;
the serial port channel folder is arranged in a local secure digital card;
the storing, by the serial port, the received log data in a serial port channel folder corresponding to the serial port includes:
when it is determined that a serial port channel file does not exist in a serial port channel folder corresponding to the serial port, a corresponding first serial port channel file is established, and the current first time is determined, so that the first serial port channel file is named according to the first time and a preset file format, wherein the time of log data stored in each serial port channel file is matched with the time established by the serial port channel file;
Packaging the log data received by the serial port, and recording a current serial port identifier and a current timestamp corresponding to the packaged log data;
storing the packed log data, the current serial port identifier corresponding to the packed log data and the current time into a cache queue corresponding to the current serial port identifier;
when the log data received by the serial port meets the preset condition, determining whether the current time corresponding to the packed log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the current serial port identifier;
and when the data are identical, storing the packed log data into the first serial port channel file.
2. The method as recited in claim 1, further comprising:
when the connection equipment is determined to be connected, detecting whether a serial port channel folder corresponding to each serial port exists in a local secure digital card;
if not, establishing a corresponding serial port channel folder in the secure digital card for each serial port.
3. The method as recited in claim 1, further comprising:
if the current time corresponding to the packed log data stored in the cache queue is determined to be different from the time of the first serial port channel file corresponding to the current serial port identifier, a second serial port channel file corresponding to the serial port is established;
Determining a current second time, naming the second serial port channel file according to the second time and a preset file format, and storing the packaged log data in the second serial port channel file.
4. The method of claim 1, wherein the determining that the log data received by the serial port meets a preset condition comprises:
when detecting that the connection equipment transmits a data byte interval and analyzing an idle identification bit based on the data byte interval, determining that log data received by the serial port meets a preset condition;
or alternatively, the process may be performed,
and analyzing the received log data, and if the analyzed log data comprises characters identical to the preset characters, determining that the log data received by the serial port meets the preset conditions.
5. The method of any one of claims 1-4, further comprising:
and when the capacity of the stored log data in the secure digital card is determined to be larger than a preset storage threshold, deleting the stored serial port channel file in the secure digital card according to the timestamp corresponding to the packaged log data.
6. A log data processing apparatus, comprising:
the detection module is used for detecting whether each serial port receives log data sent by the connection equipment;
the processing module is used for storing the received log data in a serial port channel folder corresponding to the serial port through the serial port for each serial port if at least one serial port is detected to receive the log data sent by the connecting device;
the serial port channel folder is arranged in a local secure digital card;
the processing module is specifically configured to:
when it is determined that a serial port channel file does not exist in a serial port channel folder corresponding to the serial port, a corresponding first serial port channel file is established, and the current first time is determined, so that the first serial port channel file is named according to the first time and a preset file format, wherein the time of log data stored in each serial port channel file is matched with the time established by the serial port channel file;
packaging the log data received by the serial port, and recording a current serial port identifier and a current timestamp corresponding to the packaged log data;
Storing the packed log data, the current serial port identifier corresponding to the packed log data and the current time into a cache queue corresponding to the current serial port identifier;
when the log data received by the serial port meets the preset condition, determining whether the current time corresponding to the packed log data stored in the cache queue is the same as the time of the first serial port channel file corresponding to the current serial port identifier;
and when the data are identical, storing the packed log data into the first serial port channel file.
7. An electronic device, comprising:
a memory for storing program instructions;
a processor for calling and executing program instructions in the memory, performing the method of processing log data according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of processing log data according to any one of claims 1 to 5.
CN201911409299.5A 2019-12-31 2019-12-31 Log data processing method and device Active CN111198855B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911409299.5A CN111198855B (en) 2019-12-31 2019-12-31 Log data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911409299.5A CN111198855B (en) 2019-12-31 2019-12-31 Log data processing method and device

Publications (2)

Publication Number Publication Date
CN111198855A CN111198855A (en) 2020-05-26
CN111198855B true CN111198855B (en) 2023-07-25

Family

ID=70746472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911409299.5A Active CN111198855B (en) 2019-12-31 2019-12-31 Log data processing method and device

Country Status (1)

Country Link
CN (1) CN111198855B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485661B (en) * 2021-07-01 2023-08-22 深圳市同泰怡信息技术有限公司 Four-way server and method for outputting log information thereof
CN113918358A (en) * 2021-09-17 2022-01-11 远景智能国际私人投资有限公司 Log sending method and device and log management system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002547A (en) * 2018-07-30 2018-12-14 努比亚技术有限公司 Journal file storage method, mobile terminal and computer readable storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10949415B2 (en) * 2011-03-31 2021-03-16 International Business Machines Corporation Logging system using persistent memory
CN110609818B (en) * 2018-05-29 2022-11-25 视联动力信息技术股份有限公司 Log processing method and device
US10756952B2 (en) * 2018-05-30 2020-08-25 International Business Machines Corporation Determining a storage network path utilizing log data
CN109376129A (en) * 2018-10-08 2019-02-22 郑州云海信息技术有限公司 A method of storage log is collected when locking by SYS_TF automatically
CN109783417B (en) * 2019-01-11 2022-03-15 四川长虹电器股份有限公司 Serial port communication device and method
CN110337017B (en) * 2019-07-05 2021-11-09 深圳市康冠科技股份有限公司 Television and log processing method thereof, log processing device and readable storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002547A (en) * 2018-07-30 2018-12-14 努比亚技术有限公司 Journal file storage method, mobile terminal and computer readable storage medium

Also Published As

Publication number Publication date
CN111198855A (en) 2020-05-26

Similar Documents

Publication Publication Date Title
CN108133008A (en) The processing method of business datum, device, equipment and storage medium in database
CN111198855B (en) Log data processing method and device
CN108134775B (en) Data processing method and equipment
CN110445719B (en) Routing table management method, device, equipment and storage medium
CN109542857B (en) Audit log storage method, audit log query method, audit log storage device, audit log query device and related equipment
WO2020199603A1 (en) Server vulnerability detection method and apparatus, device, and storage medium
CN111541521B (en) Data packet length identification method and system
CN110619022B (en) Node detection method, device, equipment and storage medium based on block chain network
CN112541102B (en) Abnormal data filtering method, device, equipment and storage medium
CN113014510B (en) Data caching method and device in distributed test of inertial navigation system
CN106453663B (en) Improved storage expansion method and device based on cloud service
CN111597559B (en) System command injection vulnerability detection method and device, equipment and storage medium
CN108076070B (en) FASP (fast open shortest Path protocol) blocking method, device and analysis system
WO2021155529A1 (en) Resource deletion method, apparatus, and device, and storage medium
CN108243323B (en) Software upgrading method and device
CN107179860B (en) data pulling method and device
CN117786188A (en) Data retrieval and recording method, device, system and storage medium
CN103312792A (en) Method and system for reading file from external storage equipment
CN115190089B (en) Message storage method, device, equipment and storage medium
CN115988106A (en) Method and device for acquiring message response time of asynchronous mechanism, electronic equipment and storage medium
CN114070819B (en) Malicious domain name detection method, device, electronic device and storage medium
CN113438506B (en) Video file restoration method and device, computer equipment and storage medium
CN106998361B (en) Data transmission method and system
JPH0730564A (en) Network system and method and device for detecting duplicate protocol address of network system
JP2003288341A5 (en)

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