Log information transmission method and device, and storage medium

By generating log information subscription identifiers and establishing SSE long connections, the problem of difficulty in timely adjusting log information content when the application device requirements change in the syslog protocol is solved, and dynamic adjustment of log information is realized.

CN119071281BActive Publication Date: 2026-06-05CHINA UNITED NETWORK COMM GRP CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA UNITED NETWORK COMM GRP CO LTD
Filing Date
2024-08-12
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

The syslog protocol is a one-sided protocol, making it difficult to promptly change the reported log information content according to the log information requirements of application devices.

Method used

By receiving POST requests from log information application devices, a log information subscription identifier is generated, and a Server Push Event (SSE) long connection is established to achieve dynamic adjustment of log information.

Benefits of technology

This invention enables timely adjustments to the reported log information content when the log information requirements of log information application devices change, thus addressing the shortcomings of the syslog protocol.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071281B_ABST
    Figure CN119071281B_ABST
Patent Text Reader

Abstract

The present disclosure provides a log information transmission method and device and a storage medium, relates to the technical field of communication, and solves the technical problem that in the prior art, when the log information demand of a log information application device changes, it is difficult to change the reported log information content in time according to the log information demand of the log application device by using the syslog protocol to report the log information. The method comprises the following steps: receiving a first POST request; generating a log information subscription identifier based on the identifier of the log information application device and the log information type requested to be obtained; sending a response message to the log information application device; the response message is used to instruct the log information application device to establish a server push event (SSE) long connection based on the log information subscription identifier; and the SSE long connection is used to send log information to the log information application device. The present disclosure is used for a log information reporting scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of communication technology, and in particular to a log information transmission method, apparatus and storage medium. Background Technology

[0002] Currently, in scenarios involving log information reporting, the common method is to report log information to the log information application device via the syslog protocol.

[0003] However, since the syslog protocol is a one-sided protocol, when the log information requirements of the log information application device change, it is difficult to change the reported log information content in a timely manner according to the log information requirements of the log application device. Summary of the Invention

[0004] This disclosure provides a log information transmission method, apparatus, and storage medium, which solves the technical problem in related technologies that the syslog protocol is a one-sided protocol, making it difficult to promptly change the content of the reported log information according to the log information requirements of the log application device when reporting log messages.

[0005] To achieve the above objectives, the present disclosure adopts the following technical solution:

[0006] In a first aspect, a log information transmission method is provided, comprising: receiving a first POST request; the first POST request including: an identifier of a log information application device and a type of log information requested by the log information application device; generating a log information subscription identifier based on the identifier of the log information application device and the type of log information requested; the log information subscription identifier being used to characterize the binding relationship between the log information application device and the type of log information; sending a response message to the log information application device; the response message being used to instruct the log information application device to establish a long-lived server push event (SSE) connection based on the log information subscription identifier; and the SSE connection being used to send log information to the log information application device.

[0007] In conjunction with the first aspect described above, in one possible implementation, after sending a response message to the log information application device, the method further includes: receiving a GET request from the log information application device; the GET request includes a log information subscription identifier. Based on the log information subscription identifier, an SSE long connection is established with the log information application device.

[0008] In conjunction with the first aspect above, in one possible implementation, the method specifically includes: determining the legitimacy of the log information type requested by the log information application device based on the identifier of the log information application device and the type of log information requested; and generating a log information subscription identifier if the type of log information requested by the log information application device is determined to be legitimate.

[0009] In conjunction with the first aspect mentioned above, in one possible implementation, the method specifically includes: determining the log information access permissions of the log information application device based on the identifier of the log information application device; and, if it is determined that the log information application device has the permission to access the type of log information requested, determining that the type of log information requested by the log information application device is legitimate.

[0010] In conjunction with the first aspect above, in one possible implementation, before sending a response message to the log information application device, the method further includes: constructing a system table based on the log information subscription identifier, the log information type, and the identifier of the log information application device; the system table is used to represent the binding relationship between the log information application device, the requested log information type, and the log information subscription identifier.

[0011] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: receiving a second POST request; the second POST request is used to request to stop obtaining log information; and based on the log information subscription identifier in the second POST request, determining to disconnect the SSE long connection with the log information application device.

[0012] In conjunction with the first aspect mentioned above, in one possible implementation, the method further includes: determining whether the time interval for sending log messages to the log information application device is greater than a preset threshold; if the time interval is determined to be greater than the preset threshold, sending a link detection message to the log information application device; the link detection message is used to confirm whether the SSE long connection is broken.

[0013] Secondly, a log information transmission device is provided, comprising: a communication unit and a processing unit; the communication unit is configured to receive a first POST request; the first POST request includes: an identifier of a log information application device and a type of log information requested by the log information application device; the processing unit is configured to generate a log information subscription identifier based on the identifier of the log information application device and the type of log information requested; the log information subscription identifier is used to characterize the binding relationship between the log information application device and the type of log information; the communication unit is configured to send a response message to the log information application device; the response message is used to instruct the log information application device to establish a server push event SSE long connection based on the log information subscription identifier; the SSE long connection is used to send log information to the log information application device.

[0014] In conjunction with the second aspect above, in one possible implementation, after sending a response message to the log information application device, the processing unit is further configured to instruct the communication unit to receive a GET request from the log information application device; the GET request includes a log information subscription identifier. Based on the log information subscription identifier, an SSE long connection is established with the log information application device.

[0015] In conjunction with the second aspect above, in one possible implementation, the processing unit is specifically used to: determine the legality of the type of log information requested by the log information application device based on the identifier of the log information application device and the type of log information requested; and generate a log information subscription identifier if the type of log information requested by the log information application device is determined to be legal.

[0016] In conjunction with the second aspect above, in one possible implementation, the processing unit is specifically used to determine the log information access permissions of the log information application device based on the identifier of the log information application device; and if it is determined that the log information application device has the permission to access the type of log information requested, the processing unit determines that the type of log information requested by the log information application device is legitimate.

[0017] In conjunction with the second aspect above, in one possible implementation, before sending a response message to the log information application device, the processing unit is further configured to: construct a system table based on the log information subscription identifier, the log information type, and the identifier of the log information application device; the system table is used to represent the binding relationship between the log information application device, the requested log information type, and the log information subscription identifier.

[0018] In conjunction with the second aspect above, in one possible implementation, the processing unit is further configured to instruct the communication unit to receive a second POST request; the second POST request is used to request to stop acquiring log information; and based on the log information subscription identifier in the second POST request, it is determined to disconnect the SSE long connection with the log information application device.

[0019] In conjunction with the second aspect above, in one possible implementation, the processing unit is further configured to determine whether the time interval for sending log messages to the log information application device is greater than a preset threshold; if the time interval is determined to be greater than the preset threshold, the processing unit instructs the communication unit to send a link detection message to the log information application device; the link detection message is used to confirm whether the SSE long connection is broken.

[0020] Thirdly, a log information transmission device is provided, comprising: a processor and a memory; wherein the memory is used to store computer execution instructions, and when the log information transmission device is running, the processor executes the computer execution instructions stored in the memory to cause the log information transmission device to perform the log information transmission method as described in the first aspect and any possible implementation thereof.

[0021] Fourthly, a computer-readable storage medium is provided, which stores instructions that, when executed by a processor of a log information transmission device, cause the log information transmission device to perform the log information transmission method as described in the first aspect and any possible implementation thereof.

[0022] Fifthly, a chip is provided, the chip including a processor and a communication interface, the communication interface and the processor being coupled, the processor being used to run computer programs or instructions to implement the log information transmission method as described in the first aspect above and any possible implementation thereof.

[0023] In this disclosure, the name of the aforementioned log information transmission device does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear under other names. As long as the function of each device or functional module is similar to that of this disclosure, it falls within the scope of this disclosure and its equivalents.

[0024] The technical solution provided in this disclosure brings at least the following beneficial effects: The log information transmission device in this disclosure first receives a first POST request from a log information application device; and based on the identifier of the log information application device in the first POST request and the type of log information requested by the log information application device, generates a log information subscription identifier to characterize the type binding relationship between the log information application device and the log information; then, it sends a response message to the log information application device, instructing the log information application device to establish a Server-SentEvents (SSE) long connection based on the log information subscription identifier; and sends the requested log information to the log information application device through the SSE long connection. When the log information requirements of the log information application device change, the requested log information type can be added or deleted through a POST request, thereby solving the technical problem that when the log information requirements of the log information application device change, it is difficult to timely change the reported log information content according to the log information requirements of the log information application device. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0026] Figure 1 This is a schematic diagram of the structure of a log information transmission system provided in an embodiment of the present disclosure;

[0027] Figure 2 A schematic diagram of the hardware structure of a log information transmission device provided in an embodiment of this disclosure;

[0028] Figure 3 A flowchart illustrating a log information transmission method provided in an embodiment of this disclosure;

[0029] Figure 4 A flowchart illustrating yet another log information transmission method provided in this disclosure embodiment;

[0030] Figure 5 A flowchart illustrating yet another log information transmission method provided in this disclosure embodiment;

[0031] Figure 6 A flowchart illustrating yet another log information transmission method provided in this disclosure embodiment;

[0032] Figure 7 A flowchart illustrating yet another log information transmission method provided in this disclosure embodiment;

[0033] Figure 8 A flowchart illustrating yet another log information transmission method provided in this disclosure embodiment;

[0034] Figure 9 A flowchart illustrating yet another log information transmission method provided in this disclosure embodiment;

[0035] Figure 10 A flowchart illustrating yet another log information transmission method provided in this disclosure embodiment;

[0036] Figure 11 This is a schematic diagram of the structure of a log information transmission device provided in an embodiment of the present disclosure. Detailed Implementation

[0037] The following description, in conjunction with the accompanying drawings, details a log information transmission method, apparatus, and storage medium provided in the embodiments of this disclosure.

[0038] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.

[0039] The terms “first” and “second” in this disclosure and its accompanying drawings are used to distinguish different objects or to distinguish different treatments of the same object, rather than to describe a particular order of objects.

[0040] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this disclosure are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus. It should be noted that in the embodiments of this disclosure, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this disclosure should not be construed as preferred or advantageous over other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0041] In the description of this disclosure, unless otherwise stated, "multiple" means two or more.

[0042] The following explanations of the terms used in the embodiments of this disclosure are provided to facilitate the reader's understanding.

[0043] 1. Server-Sent Events (SSE)

[0044] SSE (Event Streaming) technology is a technique used to enable servers to proactively push data to clients; it is also known as "Event Streaming". Based on the HTTP protocol, it utilizes the long-connection feature to establish a persistent connection between the client and the server, and uses this connection to push real-time data from the server to the client.

[0045] 2. syslog system logging protocol

[0046] The syslog protocol is a master-slave protocol, consisting of a client and a server. The client generates log messages, while the server receives these messages, saves them to a specific log file, or performs other processing. On Unix-like operating systems, syslog messages can be recorded in local files or sent over a network to a receiving server. Servers receiving syslog messages can manage and store logs from many different types of systems in a unified manner, or parse and process their content. Common applications include network management tools, security management systems, and log auditing systems.

[0047] The data format specification RFC5424 defines the header bytes of the syslog message body, which are defined according to the following structure: < <pri> > <version>sp <timestamp>sp <hostname>sp <app-name>sp <procid>sp <msg-id>sp<STRUCTURE DATA> Here, "pri" represents the entity that created the log message and the log message level; "sp" identifies a confirmation separator, such as a space; "version" is the version, which is generally 1; "timestamp" is the time the log was reported; "hostname" is the name of the source host that sent the syslog message; "app-name" is the specific location where the syslog message was generated, such as from a certain device; "procid" is the specific process ID that generated the syslog message; "msg-id" is the message type, which can be used to identify specific message attributes and for data filtering; "structure-data" is structured data; the body of the syslog message is UTF-8 encoded, of string type, and its content is customizable.

[0048] Currently, in log information reporting scenarios, the common method is to report log information to the log information application device via the syslog protocol. However, since the syslog protocol is a one-sided protocol, when the log information requirements of the log information application device change, it is difficult to promptly update the reported log information content according to the log information requirements of the log information application device.

[0049] To address the aforementioned technical problems, this disclosure provides a log information transmission method, apparatus, and storage medium to resolve the issue that log information reported via the syslog protocol is difficult to modify in a timely manner according to the log information requirements of log application devices. The method includes: the log information transmission apparatus first receives a first POST request from a log information application device; and based on the identifier of the log information application device in the first POST request and the type of log information requested by the log information application device, generates a log information subscription identifier representing the type binding relationship between the log information application device and the log information; then sends a response message to the log information application device, instructing the log information application device to establish a Server-Sent Events (SSE) long connection based on the log information subscription identifier; and sends the requested log information to the log information application device through the SSE long connection. When the log information requirements of the log information application device change, the requested log information type can be added or deleted via a POST request, thereby resolving the technical problem that log messages reported via the syslog protocol are difficult to modify in a timely manner according to the log information requirements of the log application device when its log information requirements change.

[0050] In one possible implementation, the above-described log information transmission method can be applied to the log information transmission system 100. The following, in conjunction with... Figure 1 This application provides a detailed description of a log information transmission system 100 according to an embodiment. For example... Figure 1 As shown, Figure 1 A log information transmission system 100 is provided for embodiments of this disclosure. The system includes: a log information application device 101 and a log information transmission device 102.

[0051] The log information application device 101 is used to send a first POST request to the log information transmission device 102. The first POST request includes: the identifier of the log information application device and the type of log information requested by the log information application device; receive response information from the log information transmission device 102, the response information including a log information subscription identifier; and send a GET request to the log information transmission device 102 based on the log information subscription identifier to determine the establishment of an SSE long connection with the log information transmission device 102.

[0052] The log information transmission device 102 is used to receive a first POST request; the first POST request includes: an identifier of the log information application device 101, and the type of log information requested by the log information application device 101; a log information subscription identifier is generated based on the identifier of the log information application device 101 and the type of log information requested; the log information subscription identifier is used to characterize the binding relationship between the log information application device 101 and the type of log information; a response message is sent to the log information application device 101; the response message is used to instruct the log information application device 101 to establish a server push event SSE long connection based on the log information subscription identifier; the SSE long connection is used to send log information to the log information application device 101.

[0053] In one possible implementation, the hardware structure of the log information transmission device includes: Figure 2 The components included in the log information transmission device 200 shown below. Figure 2 The hardware structure of the log information transmission device is described using the log information transmission device 200 shown as an example. Figure 2 As shown, the log information transmission device 200 includes at least one processor 201, a communication line 202, and at least one communication interface 204, and may also include a memory 203. The processor 201, memory 203, and communication interface 204 can be connected via the communication line 202.

[0054] The processor 201 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present disclosure, such as one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs).

[0055] Communication line 202 may include a path for transmitting information between the aforementioned components.

[0056] The communication interface 204 is used to communicate with other devices or communication networks. It can use any transceiver-like device, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.

[0057] The memory 203 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of including or storing desired program code having the form of instructions or data structures and accessible by a computer, but not limited thereto.

[0058] In one possible design, the memory 203 can exist independently of the processor 201, meaning the memory 203 can be an external memory of the processor 201. In this case, the memory 203 can be connected to the processor 201 via the communication line 202 to store execution instructions or application code, and its execution is controlled by the processor 201 to implement the log information transmission method provided in the following embodiments of this disclosure. In another possible design, the memory 203 can also be integrated with the processor 201, meaning the memory 203 can be an internal memory of the processor 201. For example, the memory 203 can be a cache, which can be used to temporarily store some data and instruction information.

[0059] As one possible implementation, processor 201 may include one or more CPUs, for example Figure 2 CPU0 and CPU1 in the example. Alternatively, the log information transmission device 200 may include multiple processors, such as CPU0 and CPU1. Figure 2 The processors 201 and 207 are included. Alternatively, the log information transmission device 200 may also include an output device 205 and an input device 206.

[0060] The following provides a detailed description of a log information transmission method according to an embodiment of this disclosure.

[0061] like Figure 3 As shown, Figure 3 This disclosure provides a log information transmission method that can be applied to, for example... Figure 2 The log information transmission device shown includes the following methods S301-S303, which will be described in detail below.

[0062] S301, The log information transmission device receives the first POST request.

[0063] The first POST request includes: the identifier of the log information application device and the type of log information requested by the log information application device.

[0064] In one possible implementation, the first POST request may also include the URL address of the first POST request.

[0065] For example, the request URL is:

[0066] / restconf / operations / ietf-subscribed-notifications:establish-subscription

[0067] For example, the input message for the first POST request is:

[0068]

[0069] Here, encoding specifies the data format requirements in this interface; topic specifies the subscription topic; and object-type-info specifies the type of the subscription object.

[0070] S302. The log information transmission device generates a log information subscription identifier based on the identifier of the log information application device and the type of log information requested.

[0071] In one possible implementation, the log information subscription identifier is used to characterize the binding relationship between the log information application device and the type of log information.

[0072] S303, The log information transmission device sends a response message to the log information application device.

[0073] In one possible implementation, the response message is used to instruct the log information application device to establish a long-lived server push event (SSE) connection based on the log information subscription identifier; the SSE connection is used to send log information to the log information application device.

[0074] For example, the input message for the response message is:

[0075] {

[0076] "ietf-subscribed-notifications:output":{

[0077] "id":{id}

[0078] }

[0079] }

[0080] Wherein, id is a log information subscription identifier used to represent the binding relationship between the log information application device and the log information type.

[0081] The technical solution provided by the above embodiments can bring at least the following beneficial effects: The log information transmission device first receives a first POST request from the log information application device; and based on the identifier of the log information application device in the first POST request and the type of log information requested by the log information application device, generates a log information subscription identifier to characterize the type binding relationship between the log information application device and the log information; then sends a response message to the log information application device, instructing the log information application device to establish a Server-SentEvents (SSE) long connection based on the log information subscription identifier; and sends the requested log information to the log information application device through the SSE long connection. When the log information requirements of the log information application device change, the requested log information type can be added or deleted through a POST request, thereby solving the technical problem that when the log information requirements of the log information application device change, it is difficult to timely change the reported log information content according to the log information requirements of the log information application device.

[0082] In one possible implementation, combining Figure 3 ,like Figure 4 As shown, after the log information transmission device sends a response message to the log information application device in S303, the process of the log information transmission device establishing an SSE long connection can be specifically implemented through the following S401-S402, which will be explained in detail below.

[0083] S401, The log information transmission device receives a GET request from the log information application device.

[0084] The GET request includes: a log information subscription identifier.

[0085] In one possible implementation, the GET request may also include the URL address of the GET request.

[0086] For example, the URL address for a GET request is:

[0087] / restconf / streams / yang-push-json / subscription-id={id}

[0088] S402. The log information transmission device determines and establishes an SSE long connection with the log information application device based on the log information subscription identifier.

[0089] In one possible implementation, when the log information transmission device receives a GET request and determines that the log information subscription identifier in the GET request has been successfully verified, it can be determined that the SSE long connection between the log information transmission device and the log information application device has been established.

[0090] In one possible implementation, once the SSE long connection between the log information transmission device and the log information application device is established, when the log information application device generates new log information requirements or modifies log information requirements, it can add or modify the subscribed log information content via a POST request, and the log information subscription identifier does not change, i.e., no new SSE long connection needs to be established.

[0091] For example, after the SSE long connection is established, the data structure for real-time reporting information is as follows:

[0092]

[0093] Wherein, event-time is the time when the reported information is sent; subscription-id is the log information subscription identifier assigned by the log information transmission device; patch-id is the identifier of a single notification message; edit-id is the key-value pair of the array element, used to express multiple notification messages; operation is used to generate / delete / update subscription objects; target is the root path; value is the data that has changed in the YANG model data nodes, and when log objects are involved, the corresponding log type data structure is filled in.

[0094] The technical solution provided by the above embodiments can bring at least the following beneficial effects: the log information transmission device receives a GET request from the log information application device, and determines to establish an SSE long connection with the log information application device based on the log information subscription identifier in the GET request, so that the log information transmission device can send log information to the log information application device based on the long connection.

[0095] One possible implementation is, such as Figure 5 As shown, before the log information transmission device generates a log information subscription identifier based on the identifier of the log information application device and the type of log information requested in the above-mentioned S302, the log information transmission device needs to determine the legality of the type of log information requested. This process can be specifically determined through the following S501-S502, which will be explained in detail below.

[0096] S501. The log information transmission device determines the legitimacy of the type of log information requested by the log information application device based on the identifier of the log information application device and the type of log information requested.

[0097] In one possible implementation, the log information transmission device identifies the log information application device based on its identifier, and then determines the legitimacy of the type of log information requested by the log information application device.

[0098] It is understandable that the log information application device may not have the permission to request the type of log information, so it is necessary to determine the legitimacy of the type of log information requested by the log information application device.

[0099] S502. The log information transmission device generates a log information subscription identifier when it determines that the type of log information requested by the log information application device is valid.

[0100] In one possible implementation, the log information types include: operation logs, system logs, and security logs.

[0101] For example, the data structure of the operation log is as follows:

[0102] {

[0103] "serial-num":{serial-num},

[0104] "log-type":{log-type},

[0105] "log-location":{log-location},

[0106] "severity-level":{severity-level},

[0107] "identity":{

[0108]

[0109] For example, the data structure of the system log is as follows:

[0110]

[0111]

[0112] For example, the data structure of a security log is as follows:

[0113]

[0114] Wherein, serial-num is the log serial number, assigned by the log information transmission device; log-type is the log type, including: operation log, system log, and security log; log-location is the source of the log, including: network management log and network element log; severity-level is used to characterize the importance of the information; ems-ip is the network address of the log information transmission device; ems-name is the name of the log information transmission device; name is the username; rank is the user permission level, including: administrator, configuration, maintenance, and monitoring; operating-terminal-address is the remote operation terminal address; operating-module is the operation module; operating-command is the operation command; object-type is the object type; object-name is the object name; operating-method is the operation method / action; operating-result is the operation result; syslog-name is the system log name; resource-id is the name of the object in the resource system; syslog-detail is the system log information description details; securitylog-detail is the security log details; start-time is the operation start time; and end-time is the operation end time.

[0115] The technical solution provided by the above embodiments can bring at least the following beneficial effects: the log information transmission device determines the log information application device based on the identifier of the log information application device, and determines the legality of the log information type requested by the log information application device; when the log information type requested by the log information application device is determined to be legal, a log information subscription identifier is generated, thereby improving the security of log information.

[0116] In one possible implementation, combining Figure 5 ,like Figure 6 As shown, the process by which the log information transmission device determines the legitimacy of the log information type requested by the log information application device based on the identifier of the log information application device and the type of log information requested can be specifically implemented through the following S601-S602, which will be explained in detail below.

[0117] S601, The log information transmission device determines the log information access permissions of the log information application device based on the identifier of the log information application device.

[0118] In one possible implementation, the storage module of the log information transmission device stores the information access permissions of all log information application devices.

[0119] S602. When the log information transmission device determines that the log information application device has the authority to access the type of log information requested, the log information transmission device determines that the type of log information requested by the log information application device is legitimate.

[0120] In one possible implementation, if the log information transmission device determines that the log information application device has the permission to access the type of log information requested, then the log information application device is deemed to have a legitimate log information type requested.

[0121] For example, the log information transmission device determines that the access permissions of the log information application device include: operation logs and security logs. If the log information type requested by the log information application device is operation logs, then the log information transmission device determines that the log information type requested by the log information application device is legitimate.

[0122] The technical solution provided by the above embodiments can bring at least the following beneficial effects: the log information transmission device determines the log information application device based on the identifier of the log information application device, and then determines the log information access permission of the log information application device. Based on the log information access permission of the log information application device, it determines that the type of log information requested by the log information application device is legal, thereby determining the legality of the type of log information requested by the log information application device.

[0123] In one possible implementation, combining Figure 3 ,like Figure 7 As shown, before the log information transmission device sends a response message to the log information application device in S303, a system table needs to be constructed. This process can be implemented in S701, which will be explained in detail below.

[0124] S701, The log information transmission device constructs a system table based on the log information subscription identifier, log information type, and the identifier of the log information application device.

[0125] The system table is used to represent the binding relationship between the log information application device, the type of log information requested, and the log information subscription identifier.

[0126] In one possible implementation, after receiving the first POST request and generating a log information subscription identifier based on the first POST request, the log information transmission device will construct a system table based on the log information subscription identifier, the log information type, and the identifier of the log information application device. This allows the log information transmission device to determine the binding relationship between the log information application device, the requested log information type, and the log information subscription identifier based on the system table.

[0127] The technical solution provided by the above embodiments can bring at least the following beneficial effects: After the log information transmission device generates a log information subscription identifier based on the first POST request, it constructs a system table based on the log information subscription identifier, the log information type, and the identifier of the log information application device, so that the log information transmission device can determine the binding relationship between the log information application device, the requested log information type, and the log information subscription identifier based on the system table.

[0128] One possible implementation is, such as Figure 8 As shown, the log information transmission device needs to disconnect the SSE long connection when it determines that the log information application device has stopped acquiring log information. This process can be implemented through the following S801-S802, which will be explained in detail below.

[0129] S801, the log information transmission device receives the second POST request.

[0130] The second POST request is used to request that the retrieval of log information be stopped.

[0131] In one possible implementation, when the log information application device does not need to obtain log information, it sends a second POST request to the log information transmission device to request to stop obtaining log information.

[0132] S802, the log information transmission device determines to disconnect the SSE long connection with the log information application device based on the log information subscription identifier in the second POST request.

[0133] In one possible implementation, the log information transmission device determines the log information application device that disconnects the SSE long connection based on the log information subscription identifier in the second POST request.

[0134] The technical solution provided by the above embodiments can bring at least the following beneficial effects: when the log information transmission device determines that the log information application device has stopped acquiring log information, it disconnects the SSE long connection with the log information application device and releases the related resource information.

[0135] One possible implementation is, such as Figure 9 As shown, if the log information transmission device has not sent log messages to the log information application device for a long time, the log information application device needs to determine the current connection status of the SSE long connection. This process can be implemented through the following S901-S902, which will be explained in detail below.

[0136] S901, The log information transmission device determines whether the time interval for sending log messages to the log information application device is greater than a preset threshold.

[0137] For example, the log information transmission device determines whether the time interval between the last time a log message was sent and the current time is greater than 30 seconds.

[0138] S902. When the time interval is determined to be greater than a preset threshold, the log information transmission device sends a link detection message to the log information application device.

[0139] Among them, the link detection message is used to confirm whether the SSE long connection has been broken.

[0140] For example, if the time interval between the last time a log message was sent and the current time is greater than 30 seconds, the log information transmission device sends a link detection message to the log information application device, so that the log information application device can determine the current connection status of the SSE long connection based on the link detection message.

[0141] The technical solution provided by the above embodiments can bring at least the following beneficial effects: when the log information transmission device has not sent log messages to the log information application device for a long time, it sends a link detection message to the log information application device, so that the log information application device can determine the current connection status of the SSE long connection based on the link detection message.

[0142] One possible implementation is, such as Figure 10 As shown, Figure 10 This is a flowchart illustrating another log information transmission method provided in this embodiment of the present disclosure. The process specifically includes the following S1001-S1008, which will be described in detail below.

[0143] S1001, The log information application device sends a log subscription relationship establishment request to the log information transmission device, and the corresponding log information transmission device receives the log subscription relationship establishment request.

[0144] S1002, The log information transmission device processes the request to establish a log subscription relationship.

[0145] S1003, The log information transmission device sends the result of establishing a subscription relationship to the log information application device, and the corresponding log information application device receives the result of establishing a subscription relationship.

[0146] S1004. The log information application device sends an SSE long connection establishment request to the log information transmission device, and the corresponding log information transmission device receives the SSE long connection establishment request from the log information application device.

[0147] S1005. When a log message is generated and triggered, the log information transmission device sends a log message to the log information application device, and the log information application device receives the log message from the log information transmission device.

[0148] S1006. The log information application device sends a request to delete the subscription relationship to the log information transmission device, and the log information transmission device receives the request to delete the subscription relationship from the log information application device.

[0149] S1007. The log information transmission device processes the request to delete the subscription relationship.

[0150] S1008. The log information transmission device sends the deletion subscription result to the log information application device, and the log information application device receives the deletion subscription result from the log information transmission device.

[0151] As can be seen, the above mainly describes the technical solutions provided by the embodiments of this disclosure from a methodological perspective. To achieve the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the modules and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.

[0152] This disclosure embodiment can divide the log information transmission device into functional modules according to the above method example. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this disclosure embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0153] One possible implementation is, such as Figure 11 , Figure 11 This is a schematic diagram of the structure of a log information transmission device 1100 provided in this disclosure.

[0154] The log information transmission device 1100 includes a communication unit 1101 and a processing unit 1102. The communication unit 1101 receives a first POST request, which includes an identifier of the log information application device and the type of log information requested by the log information application device. The processing unit 1102 generates a log information subscription identifier based on the identifier of the log information application device and the type of log information requested. The log information subscription identifier represents the binding relationship between the log information application device and the type of log information. The communication unit 1101 sends a response message to the log information application device, instructing the log information application device to establish a Server Push Event (SSE) long connection based on the log information subscription identifier. The SSE long connection is used to send log information to the log information application device.

[0155] In one possible implementation, after sending a response message to the log information application device, the processing unit 1102 is further configured to instruct the communication unit 1101 to receive a GET request from the log information application device; the GET request includes a log information subscription identifier. Based on the log information subscription identifier, an SSE long connection is established with the log information application device.

[0156] In one possible implementation, the processing unit 1102 is specifically used to: determine the legality of the type of log information requested by the log information application device based on the identifier of the log information application device and the type of log information requested; and generate a log information subscription identifier if the type of log information requested by the log information application device is determined to be legal.

[0157] In one possible implementation, the processing unit 1102 is specifically used to determine the log information access permissions of the log information application device based on the identifier of the log information application device; and if it is determined that the log information application device has the permission to access the type of log information requested, it determines that the type of log information requested by the log information application device is legitimate.

[0158] In one possible implementation, before sending a response message to the log information application device, the processing unit 1102 is further configured to: construct a system table based on the log information subscription identifier, the log information type, and the identifier of the log information application device; the system table is used to represent the binding relationship between the log information application device, the requested log information type, and the log information subscription identifier.

[0159] In one possible implementation, the processing unit 1102 is further configured to instruct the communication unit 1101 to receive a second POST request; the second POST request is used to request to stop obtaining log information; based on the log information subscription identifier in the second POST request, it is determined to disconnect the SSE long connection with the log information application device.

[0160] In one possible implementation, the processing unit 1102 is further configured to determine whether the time interval for sending log messages to the log information application device is greater than a preset threshold; if the time interval is determined to be greater than the preset threshold, the processing unit 1102 is instructed to send a link detection message to the log information application device; the link detection message is used to confirm whether the SSE long connection is disconnected.

[0161] This disclosure also provides a log information transmission device, which includes a processor and a memory; wherein the memory is used to store computer execution instructions, and when the log information transmission device is running, the processor executes the computer execution instructions stored in the memory so that the log information transmission device performs the log information transmission method described in this disclosure.

[0162] Embodiments of this disclosure provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform the log information transmission method described in the above method embodiments.

[0163] Embodiments of this disclosure provide a chip including a processor and a communication interface, the communication interface and the processor being coupled together, the processor being used to run computer programs or instructions to implement the log information transmission method as described in the above method embodiments.

[0164] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing, or any other form of computer-readable storage medium in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In this embodiment of the disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0165] Since the apparatus, devices, computer-readable storage media, and computer program products in the embodiments of this disclosure can be applied to the above methods, the technical effects they can achieve can also be referred to the above method embodiments. The embodiments of this disclosure will not be repeated here.

[0166] The above descriptions are merely specific embodiments of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions within the technical scope disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims. < / procid> < / hostname> < / timestamp> < / version> < / pri>

Claims

1. A log information transmission method, characterized in that, include: Receive the first POST request; The first POST request includes: the identifier of the log information application device and the type of log information requested by the log information application device; A log information subscription identifier is generated based on the identifier of the log information application device and the type of log information requested; the log information subscription identifier is used to characterize the binding relationship between the log information application device and the type of log information. A response message is sent to the log information application device; the input message of the response message includes the log information subscription identifier; the response message is used to instruct the log information application device to establish a server push event SSE long connection based on the log information subscription identifier; the SSE long connection is used to send log information to the log information application device; the data structure of the information includes operation and target fields; the operation is used to generate, delete, or update subscription objects; the target is the root path; Receive a GET request from the log information application device; the GET request includes: the log information subscription identifier and the URL address of the GET request; the URL address contains the log information subscription identifier; Based on the log information subscription identifier, an SSE long connection is established with the log information application device; After establishing an SSE long connection with the log information application device, when the log information application device generates new log information requirements or modifies log information requirements, it adds or modifies the subscribed log information content through a POST request, and the log information subscription identifier remains unchanged. Receive the second POST request; the second POST request is used to request that logging information be stopped. Based on the log information subscription identifier in the second POST request, it is determined that the SSE long connection with the log information application device will be disconnected.

2. The method according to claim 1, characterized in that, The generation of a log information subscription identifier based on the identifier of the log information application device and the type of log information requested includes: Based on the identifier of the log information application device and the type of log information requested, the legality of the type of log information requested by the log information application device is determined. If the type of log information requested by the log information application device is deemed valid, the log information subscription identifier is generated.

3. The method according to claim 2, characterized in that, The determination of the legitimacy of the log information type requested by the log information application device based on the identifier of the log information application device and the type of log information requested includes: The log information access permissions of the log information application device are determined based on the identifier of the log information application device. If it is determined that the log information application device has permission to access the requested log information type, then the requested log information type is deemed legitimate.

4. The method according to claim 3, characterized in that, Before sending a response message to the log information application device, the method further includes: A system table is constructed based on the log information subscription identifier, the log information type, and the identifier of the log information application device; the system table is used to represent the binding relationship between the log information application device, the requested log information type, and the log information subscription identifier.

5. The method according to any one of claims 1-4, characterized in that, The method further includes: Determine whether the time interval for sending log messages to the log information application device is greater than a preset threshold; If the time interval is determined to be greater than the preset threshold, a link detection message is sent to the log information application device; the link detection message is used to confirm whether the SSE long connection is disconnected.

6. A log information transmission device, characterized in that, include: Communication unit and processing unit; The communication unit is used to receive the first POST request; The first POST request includes: the identifier of the log information application device and the type of log information requested by the log information application device; The processing unit is configured to generate a log information subscription identifier based on the identifier of the log information application device and the type of log information requested; the log information subscription identifier is used to characterize the binding relationship between the log information application device and the type of log information. The communication unit is used to send a response message to the log information application device; the input message of the response message includes the log information subscription identifier; the response message is used to instruct the log information application device to establish a server push event SSE long connection based on the log information subscription identifier; the SSE long connection is used to send log information to the log information application device; the data structure of the information includes operation and target fields; the operation is used to generate, delete, or update subscription objects; the target is the root path; The communication unit is configured to receive a GET request from the log information application device; the GET request includes: the log information subscription identifier and the URL address of the GET request; the URL address contains the log information subscription identifier; and based on the log information subscription identifier, determine to establish an SSE long connection with the log information application device. The communication unit is used to, after determining that an SSE long connection has been established with the log information application device, add or modify the subscribed log information content via a POST request when the log information application device generates new or modifies log information requirements, while the log information subscription identifier remains unchanged. The communication unit is used to receive a second POST request; the second POST request is used to request to stop obtaining log information; based on the log information subscription identifier in the second POST request, it is determined to disconnect the SSE long connection with the log information application device.

7. A log information transmission device, characterized in that, include: A processor and a memory; wherein the memory is used to store computer execution instructions; when the log information transmission device is running, the processor executes the computer execution instructions stored in the memory to cause the log information transmission device to perform the log information transmission method according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a processor for log information transmission, cause the log information transmission device to perform the log information transmission method according to any one of claims 1-5.