CN111416767A - Log output method, device and storage medium of edge intelligent gateway - Google Patents

Log output method, device and storage medium of edge intelligent gateway Download PDF

Info

Publication number
CN111416767A
CN111416767A CN202010180439.2A CN202010180439A CN111416767A CN 111416767 A CN111416767 A CN 111416767A CN 202010180439 A CN202010180439 A CN 202010180439A CN 111416767 A CN111416767 A CN 111416767A
Authority
CN
China
Prior art keywords
log
tcp
gateway
intelligent gateway
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010180439.2A
Other languages
Chinese (zh)
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.)
Guangdong Ketyoo Intelligent Technology Co Ltd
Original Assignee
Guangdong Ketyoo Intelligent 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 Guangdong Ketyoo Intelligent Technology Co Ltd filed Critical Guangdong Ketyoo Intelligent Technology Co Ltd
Priority to CN202010180439.2A priority Critical patent/CN111416767A/en
Publication of CN111416767A publication Critical patent/CN111416767A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0677Localisation of faults
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/069Management of faults, events, alarms or notifications using logs of notifications; Post-processing of notifications

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a log output method, a device and a storage medium of an edge intelligent gateway, which are applied to a gateway program of the edge intelligent gateway, wherein the log output method comprises the following steps of S1: creating a log proxy process connected with a gateway program; s2: executing a start script of the gateway program and simultaneously starting a log proxy process, wherein the log proxy process stores log contents input from the gateway program in a specified file; s3: reading a configuration file of a log agent program, and starting a TCP server according to the configuration file for monitoring a connection request of a TCP client; s4: judging whether a TCP server receives a connection request from a TCP client, and storing a handle of the corresponding TCP client when the TCP connection request exists; s5: and sending the received log to the corresponding TCP client in real time according to the handle of the TCP client. The invention can check the current and historical logs of the gateway in real time and enhance the debugging function of the intelligent gateway.

Description

Log output method, device and storage medium of edge intelligent gateway
Technical Field
The invention relates to the technical field of intelligent gateways, in particular to a log output method, log output equipment and a log output storage medium of an edge intelligent gateway.
Background
In recent years, with the development of artificial intelligence and internet of things, more and more smart home products appear in the market, and a plurality of internet huge companies, traditional manufacturing companies and emerging entrepreneurship companies are added to the smart home products, so that the smart home is distributed in all aspects.
In the products of intelligent house, there can be different product forms according to the scene of difference, some products have external power source to supply power continuously, some products use battery system power supply, the agreement of equipment networking is also various, have Zigbee, B L E, WIFI etc., wherein Zigbee and B L E agreement are little with communication overhead, advantage that the power consumption is low, the equipment that intelligent product used protocols such as Zigbee, B L E can't direct access to ethernet, need have a gateway equipment to make the conversion of agreement, so in the overall arrangement of intelligent house, intelligent gateway is an indispensable product.
The intelligent gateway mainly aims to provide the capability of networking the intelligent equipment, so that a cloud end can control or monitor the intelligent equipment, the intelligent gateway needs to operate stably for a long time, and the high requirement is provided for software and hardware design of products of the intelligent gateway.
Disclosure of Invention
In order to overcome the defects of the prior art, one of the objectives of the present invention is to provide a log output method for an edge intelligent gateway, which can check the current log of the gateway in real time, reduce the logic modification of the edge intelligent gateway program, and enhance the debugging function of the intelligent gateway.
Another object of the present invention is to provide an electronic device.
It is a further object of the present invention to provide a storage medium.
One of the purposes of the invention is realized by adopting the following technical scheme:
a log output method of an edge intelligent gateway is applied to a gateway program of the edge intelligent gateway and comprises the following steps:
step S1: creating a log proxy process connected with a gateway program;
step S2: executing a start script of the gateway program and simultaneously starting a log proxy process, wherein the log proxy process stores log contents input from the gateway program in a specified file;
step S3: reading a configuration file of a log agent program, and starting a TCP server according to the configuration file for monitoring a connection request of a TCP client;
step S4: judging whether a TCP server receives a connection request from a TCP client, and storing a handle of the corresponding TCP client when the TCP connection request exists;
step S5: and sending the received log to the corresponding TCP client in real time according to the handle of the TCP client.
Further, the log proxy process establishes pipeline communication with the gateway program through an API provided by libuv, and starts a reading operation of the pipeline when the log proxy process is started, so as to obtain the log content output by the gateway program.
Further, the method for storing the log content in step S2 is as follows:
step S21: judging whether a log is input, if so, storing the log in a file, and executing the step S22;
step S22: judging whether the file size reaches a set limit, if so, executing step S23; if not, continuing to wait for receiving the log;
step S23: and compressing the log file, storing the compressed file in a specified file, and deleting the original log file.
Further, step S5 is preceded by: judging whether the TCP connection is disconnected in real time, if not, executing step S5; if the disconnection occurs, the TCP client handle is deleted, and the process returns to step S4.
Further, after the step S5, the method further includes: and judging whether the transmission fails, if so, deleting the TCP client handle, and returning to execute the step S4 again.
Further, when the TCP server is connected with the TCP client, the TCP client sends a connection request with a digital certificate to the TCP server, the TCP server verifies whether the digital certificate is valid, if so, an encrypted connection channel for transmitting log files is established between the TCP server and the TCP client, and a handle of the corresponding TCP client is stored; and if the TCP connection request is invalid, disconnecting the connection between the TCP server and the TCP client.
Further, the number of the TCP clients that send connection requests to the TCP server is at least one.
Further, the TCP server and the TCP client are in the same lan.
The second purpose of the invention is realized by adopting the following technical scheme:
an electronic device comprises a processor, a memory and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the log output method of the edge intelligent gateway when executing the computer program.
The third purpose of the invention is realized by adopting the following technical scheme:
a storage medium having stored thereon a computer program which, when executed, implements the above-described logging output method of an edge intelligent gateway.
Compared with the prior art, the invention has the beneficial effects that:
the invention starts a log operation agent program while starting the edge intelligent gateway program, outputs the log of the edge intelligent gateway to the log agent process through the L inux pipeline, can check the gateway log in real time, and directly transmits the log to the TCP client of the access server by starting the TCP server, thereby achieving the functions of quick searching and positioning and further improving the debugging efficiency of the edge intelligent gateway.
Drawings
Fig. 1 is a schematic operation flow diagram of the log output method of the edge intelligent gateway of the present invention.
Detailed Description
The present invention will be further described with reference to the accompanying drawings and the detailed description, and it should be noted that any combination of the embodiments or technical features described below can be used to form a new embodiment without conflict.
Example one
A log output method of an edge intelligent gateway is applied to a gateway program of the edge intelligent gateway, reduces logic modification of the edge intelligent gateway program, and realizes real-time checking of the current log of the gateway so as to enhance the debugging function of the intelligent gateway.
Referring to fig. 1, the log output method of the edge intelligent gateway includes the following steps:
step S1: creating a log proxy process connected with a gateway program; the gateway program can normally output log records, all control information of the intelligent gateway is recorded in the log in detail, and a user can determine the access condition of the intelligent gateway by checking the log, so that whether the working state of the intelligent gateway is abnormal or not is known.
The log proxy process establishes pipeline communication with the gateway program through an Application Program Interface (API) provided by libov, the pipeline communication between the log proxy process and the gateway program has a unidirectional reading function, and the reading operation of the pipeline can be started when the log proxy process is started, namely the output log content can be obtained from the gateway program through the pipeline communication.
Step S2: executing a start script of the gateway program and simultaneously starting a log proxy process, wherein the log proxy process stores log contents input from the gateway program in a specified file;
after the edge intelligent gateway is started and enters an L inux system, a start script of a gateway program is executed, the start script executes the gateway program, and simultaneously, a log proxy process connected with the gateway program can be started.
Because the storage resources in the edge gateway are limited, the saved log cannot be infinitely large, so the log proxy process needs to limit the size of the log file, and the method for storing the log content is as follows:
step S21: judging whether a log is input, if so, saving the log in a newly-built file, and executing the step S22;
step S22: judging whether the size of the file reaches a set limit, wherein the limit can be preset according to actual conditions; if the log file size exceeds the set limit, go to step S23; if not, continuing to wait for receiving the log;
step S23: when the size of the log file is too large, the log file needs to be compressed, after the log file is compressed each time, the step S22 is returned again to judge the size of the compressed file until the size of the file is compressed to a set limit, and then the compressed file is stored in a specified file for storage so as to improve the storage capacity of the log; and then deleting the original log file to prevent the log file from occupying the content repeatedly.
Then, each log file output by the gateway program is stored in a designated file, and each log file is named according to a set rule, for example, the output time of the log is used as the name of the log file; and the size of each log file is kept within a set limit, so that the log files in the designated files are tidy and ordered, and the log files are convenient to find and position subsequently.
Step S3: after the log agent program is started, reading a configuration file of the log agent program, wherein various configuration parameters of a TCP server are stored in the configuration file in advance, and the configuration parameters comprise but are not limited to an IP address of a local machine, an address of a specified gateway, an address of a domain name server and the like; a TCP server may be started according to the configuration parameters in the configuration file, and the TCP server may be configured to monitor the connection request of the TCP client.
The TCP server can be simultaneously connected with one or more TCP clients, the TCP server and the TCP clients are both positioned in the same local network, and the TCP server and the TCP clients can be connected in a wired or wireless mode to realize signal transmission.
Step S4: judging whether the TCP server receives a connection request from the TCP client, when the TCP connection request exists, storing a handle of the corresponding TCP client, wherein the handle is equivalent to the identification of the TCP client, and then accurately transmitting the log file to the corresponding TCP client through the handle.
In addition, when the TCP server is connected with the TCP client, the TCP client sends a connection request with a digital certificate to the TCP server, and the digital certificate is used for authenticating the identity authentication of the client; after receiving the connection request, the TCP server verifies whether the digital certificate is valid, if so, an encrypted connection channel for transmitting the log file is established between the TCP server and the TCP client, and a handle of the corresponding TCP client is stored, which means that the TCP client is determined to be trusted and the log file can be transmitted through the encrypted connection channel; if the TCP client is invalid, the TCP client is not trusted, the connection between the TCP server and the TCP client is disconnected at the moment, and the untrusted TCP client cannot transmit signals.
Step S5: sending the log stored in the designated file to the corresponding TCP client according to the handle of the TCP client; after the log agent program receives the log, the log agent program also sends a log to the accessed TCP client, so that a user can check the current and historical log contents of the intelligent gateway in real time through the TCP client.
Before the log file is sent to the TCP client, whether the connection between the TCP client and the TCP server is disconnected at the current moment or not needs to be judged in real time, and if the connection is not disconnected, the log file can be transmitted to the TCP client; if the TCP client is disconnected, the TCP client handle is deleted, the connection path between the TCP client and the TCP server is disconnected, and the process returns to step S4.
Step S6: judging whether the sending of the log file fails according to a sending feedback result of the TCP client, if so, deleting a TCP client handle, disconnecting the connection between the TCP server and the TCP client, and returning to execute the step S4 again; if the transmission is successful, the log output process can be completed.
The embodiment relates to a method for realizing the log output of an edge intelligent gateway, which realizes that a TCP server is used for checking the current log of the gateway in real time and realizing the compression and storage of the local log so as to achieve the aim of improving the debugging efficiency of the edge intelligent gateway.
Example two
The embodiment provides an electronic device, which includes a processor, a memory, and a computer program stored on the memory and capable of running on the processor, wherein the processor implements the log output method of the edge intelligent gateway in the first embodiment when executing the computer program; in addition, the present embodiment also provides a storage medium, on which a computer program is stored, and when the computer program is executed, the method for outputting logs of the edge intelligent gateway is implemented.
The apparatus and the storage medium in this embodiment are based on two aspects of the same inventive concept, and the method implementation process has been described in detail in the foregoing, so that those skilled in the art can clearly understand the structure and implementation process of the system in this embodiment according to the foregoing description, and for the sake of brevity of the description, details are not repeated here.
The above embodiments are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited thereby, and any insubstantial changes and substitutions made by those skilled in the art based on the present invention are within the protection scope of the present invention.

Claims (10)

1. A log output method of an edge intelligent gateway is applied to a gateway program of the edge intelligent gateway, and is characterized by comprising the following steps:
step S1: creating a log proxy process connected with a gateway program;
step S2: executing a start script of the gateway program and simultaneously starting a log proxy process, wherein the log proxy process stores log contents input from the gateway program in a specified file;
step S3: reading a configuration file of a log agent program, and starting a TCP server according to the configuration file for monitoring a connection request of a TCP client;
step S4: judging whether a TCP server receives a connection request from a TCP client, and storing a handle of the corresponding TCP client when the TCP connection request exists;
step S5: and sending the received log to the corresponding TCP client in real time according to the handle of the TCP client.
2. The log output method of the edge intelligent gateway of claim 1, wherein the log agent process establishes a pipeline communication with the gateway program through an API provided by libov, and starts a read operation of the pipeline when the log agent process is started, so as to obtain the log content output by the gateway program.
3. The method for logging output of an edge intelligent gateway according to claim 1, wherein the method for storing the log content in step S2 is as follows:
step S21: judging whether a log is input, if so, storing the log in a file, and executing the step S22;
step S22: judging whether the file size reaches a set limit, if so, executing step S23; if not, continuing to wait for receiving the log;
step S23: and compressing the log file, storing the compressed file in a specified file, and deleting the original log file.
4. The method for logging output of an edge intelligent gateway according to claim 1, wherein the step S5 is preceded by: judging whether the TCP connection is disconnected in real time, if not, executing step S5; if the disconnection occurs, the TCP client handle is deleted, and the process returns to step S4.
5. The log output method of the edge intelligent gateway of claim 4, wherein the step S5 is further followed by: and judging whether the transmission fails, if so, deleting the TCP client handle, and returning to execute the step S4 again.
6. The log output method of the edge intelligent gateway according to claim 1, wherein when the TCP server is connected to the TCP client, the TCP client sends a connection request with a digital certificate to the TCP server, and the TCP server verifies whether the digital certificate is valid, and if so, an encrypted connection channel for transmitting the log file is established between the TCP server and the TCP client, and a handle of the corresponding TCP client is saved; and if the TCP connection request is invalid, disconnecting the connection between the TCP server and the TCP client.
7. The edge intelligent gateway log output method according to claim 6, wherein the number of the TCP clients that send connection requests to the TCP server is at least one.
8. The method for logging output by an edge intelligent gateway according to claim 7, wherein the TCP server and the TCP client are in the same lan.
9. An electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the log output method of the edge smart gateway according to any one of claims 1 to 8 when executing the computer program.
10. A storage medium having stored thereon a computer program which, when executed, implements the method of logging output for an edge intelligent gateway of any one of claims 1 to 8.
CN202010180439.2A 2020-03-16 2020-03-16 Log output method, device and storage medium of edge intelligent gateway Pending CN111416767A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010180439.2A CN111416767A (en) 2020-03-16 2020-03-16 Log output method, device and storage medium of edge intelligent gateway

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010180439.2A CN111416767A (en) 2020-03-16 2020-03-16 Log output method, device and storage medium of edge intelligent gateway

Publications (1)

Publication Number Publication Date
CN111416767A true CN111416767A (en) 2020-07-14

Family

ID=71492930

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010180439.2A Pending CN111416767A (en) 2020-03-16 2020-03-16 Log output method, device and storage medium of edge intelligent gateway

Country Status (1)

Country Link
CN (1) CN111416767A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111949980A (en) * 2020-08-24 2020-11-17 上海明略人工智能(集团)有限公司 Target client monitoring method and device, storage medium and electronic device
CN113472748A (en) * 2021-05-31 2021-10-01 四川万益能源科技有限公司 Audit log system communication method based on non-blocking input and output
CN114172800A (en) * 2021-11-25 2022-03-11 浙江源创智控技术有限公司 KNX multi-gateway communication method, device, equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101331459A (en) * 2005-12-03 2008-12-24 国际商业机器公司 Methods and apparatus for remote monitoring of log data generated by an application program
CN101383880A (en) * 2008-09-26 2009-03-11 中兴通讯股份有限公司 Media gateway log system and log outputting method
US20100211826A1 (en) * 2005-11-12 2010-08-19 Logrhythm, Inc. Log collection, structuring and processing
CN102195795A (en) * 2010-03-19 2011-09-21 Tcl集团股份有限公司 Intelligent district log system and log recording method thereof
CN102594598A (en) * 2012-02-16 2012-07-18 浪潮(北京)电子信息产业有限公司 Log management system and implementation method thereof
CN102799514A (en) * 2011-05-24 2012-11-28 中兴通讯股份有限公司 Method and system for managing log records
CN102891873A (en) * 2011-07-21 2013-01-23 腾讯科技(深圳)有限公司 Method for storing log data and log data storage system
CN103326896A (en) * 2013-06-07 2013-09-25 合一信息技术(北京)有限公司 System and method for collecting information data generated by a user on Internet
CN104539630A (en) * 2015-01-19 2015-04-22 北京网秦天下科技有限公司 Method and device for checking linux journal files at windows client
CN109471743A (en) * 2018-11-12 2019-03-15 深圳前海微众银行股份有限公司 Log collecting method, device and computer readable storage medium
CN110535653A (en) * 2019-07-15 2019-12-03 中国电力科学研究院有限公司 A kind of safe distribution terminal and its means of communication

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100211826A1 (en) * 2005-11-12 2010-08-19 Logrhythm, Inc. Log collection, structuring and processing
CN101331459A (en) * 2005-12-03 2008-12-24 国际商业机器公司 Methods and apparatus for remote monitoring of log data generated by an application program
CN101383880A (en) * 2008-09-26 2009-03-11 中兴通讯股份有限公司 Media gateway log system and log outputting method
CN102195795A (en) * 2010-03-19 2011-09-21 Tcl集团股份有限公司 Intelligent district log system and log recording method thereof
CN102799514A (en) * 2011-05-24 2012-11-28 中兴通讯股份有限公司 Method and system for managing log records
CN102891873A (en) * 2011-07-21 2013-01-23 腾讯科技(深圳)有限公司 Method for storing log data and log data storage system
CN102594598A (en) * 2012-02-16 2012-07-18 浪潮(北京)电子信息产业有限公司 Log management system and implementation method thereof
CN103326896A (en) * 2013-06-07 2013-09-25 合一信息技术(北京)有限公司 System and method for collecting information data generated by a user on Internet
CN104539630A (en) * 2015-01-19 2015-04-22 北京网秦天下科技有限公司 Method and device for checking linux journal files at windows client
CN109471743A (en) * 2018-11-12 2019-03-15 深圳前海微众银行股份有限公司 Log collecting method, device and computer readable storage medium
CN110535653A (en) * 2019-07-15 2019-12-03 中国电力科学研究院有限公司 A kind of safe distribution terminal and its means of communication

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111949980A (en) * 2020-08-24 2020-11-17 上海明略人工智能(集团)有限公司 Target client monitoring method and device, storage medium and electronic device
CN113472748A (en) * 2021-05-31 2021-10-01 四川万益能源科技有限公司 Audit log system communication method based on non-blocking input and output
CN114172800A (en) * 2021-11-25 2022-03-11 浙江源创智控技术有限公司 KNX multi-gateway communication method, device, equipment and storage medium
CN114172800B (en) * 2021-11-25 2024-05-03 浙江源创智控技术有限公司 KNX multi-gateway communication method, KNX multi-gateway communication device, KNX multi-gateway communication equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111416767A (en) Log output method, device and storage medium of edge intelligent gateway
CN108512821B (en) Data transmission method, device and system, network gate and transaction data storage method
EP3119062B1 (en) Network transfer of large files in unstable network environments
CN106101291A (en) A kind of transmit the method for file, system, server and client
CN112398916B (en) File transmission method and device based on HTTP (hyper text transport protocol)
KR101938623B1 (en) Openflow communication method, system, controller, and service gateway
CN107395642B (en) Method and system for accessing and starting Docker container of TLS authentication based on Websocket
CN112165447B (en) WAF equipment-based network security monitoring method, system and electronic device
CN114172929B (en) Communication method, device and gateway
CN103227777A (en) Method for preventing ipsec (Internet Protocol Security) tunnel oscillation caused by failed dpd (Dead Peer Detection)
CN116366740A (en) Data transmission method, device, system, storage medium and processor
CN105302486A (en) Virtual offline desktop block device storage synchronization method
CN107846609B (en) Real-time transmission method, device and system for control room data
CN109067922A (en) A kind of data transmission method and device
CN106937280A (en) The authentication method of sensor node and sensor node accessing mobile communication network
Elhadeedy et al. 60 GHz Wi-Fi as a Tractor-Trailer Wireless Harness
US11824684B2 (en) Systems and methods for control channel tunneling
CN115714805A (en) Cross-platform communication connection method and system and electronic equipment
CN112422525B (en) Fault data transmission method, device, equipment and storage medium
KR101082850B1 (en) Active Sync-based Mobile Device for data Synchronizing and Method at the same
CN106301832B (en) Method and device for processing system log message
CN112118284A (en) Gateway device-oriented http data request method, device and medium
CN110636071B (en) Interface docking method
CN110868370B (en) Method, device and computer-readable storage medium for substation communication
CN111669364A (en) Data transmission method, device, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200714