CN108989471A - The management method and device of log in network system - Google Patents
The management method and device of log in network system Download PDFInfo
- Publication number
- CN108989471A CN108989471A CN201811029325.7A CN201811029325A CN108989471A CN 108989471 A CN108989471 A CN 108989471A CN 201811029325 A CN201811029325 A CN 201811029325A CN 108989471 A CN108989471 A CN 108989471A
- Authority
- CN
- China
- Prior art keywords
- log data
- data
- batches
- log
- sending
- 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
Links
- 238000007726 management method Methods 0.000 title abstract description 10
- 238000000034 method Methods 0.000 claims abstract description 30
- 238000012790 confirmation Methods 0.000 claims description 13
- 230000005540 biological transmission Effects 0.000 description 8
- 238000004590 computer program Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000000523 sample Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1074—Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
- H04L67/1078—Resource delivery mechanisms
- H04L67/108—Resource delivery mechanisms characterised by resources being split in blocks or fragments
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/069—Management 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)
- Information Transfer Between Computers (AREA)
Abstract
本发明公开了一种网络系统中日志的管理方法和装置。所述方法包括:当接收到客户端发送的日志下载请求后,获取所述下载请求对应的日志数据;确定所述日志数据的数据量的大小;将所述日志数据的数据量与预先设置的数据量阈值进行比较,得到比较结果;如果比较结果为大于所述数据量阈值,则将所述日志数据分批发送。
The invention discloses a log management method and device in a network system. The method includes: after receiving the log download request sent by the client, obtaining the log data corresponding to the download request; determining the size of the data volume of the log data; comparing the data volume of the log data with the preset The data volume threshold is compared to obtain a comparison result; if the comparison result is greater than the data volume threshold, the log data is sent in batches.
Description
技术领域technical field
本发明涉及信息处理领域,尤指一种网络系统中日志的管理方法和装置。The invention relates to the field of information processing, in particular to a log management method and device in a network system.
背景技术Background technique
网络设备、系统及服务程序等,在运作时都会产生一个叫log的事件记录;每一行日志都记载着日期、时间、使用者及动作等相关操作的描述。Network devices, systems, and service programs, etc., will generate an event record called log during operation; each line of log records the description of related operations such as date, time, user, and action.
Windows网络操作系统都设计有各种各样的日志文件,如应用程序日志,安全日志、系统日志、Scheduler服务日志、FTP日志、WWW日志、DNS服务器日志等等,这些根据你的系统开启的服务的不同而有所不同。我们在系统上进行一些操作时,这些日志文件通常会记录下操作的一些相关内容,这些内容对系统安全工作人员相当有用。比如说有人对系统进行了IPC探测,系统就会在安全日志里迅速地记下探测者探测时所用的IP、时间、用户名等,用FTP探测后,就会在FTP日志中记下IP、时间、探测所用的用户名等。Windows network operating systems are designed with various log files, such as application logs, security logs, system logs, Scheduler service logs, FTP logs, WWW logs, DNS server logs, etc., which are based on the services opened by your system vary with each other. When we perform some operations on the system, these log files usually record some relevant content of the operation, which is quite useful for system security staff. For example, if someone detects the system by IPC, the system will quickly record the IP, time, user name, etc. used by the detector in the security log. After using FTP to detect, it will record the IP, time, username used for the probe, etc.
当然,日志数据对于实现网络安全的价值有多大取决于两个因素:第一,你的系统和设备必须进行合适的设置以便记录你需要的数据。第二,你必须有合适的工具、培训和可用的资源来分析收集到的数据。Of course, how valuable log data is to achieving network security depends on two factors: First, your systems and devices must be properly set up to log the data you need. Second, you must have the right tools, training, and resources available to analyze the data collected.
当前很多网站在下载日志的时候都是将日志一次性输出到一个excel中,当日志内容不是很多时,不会出现问题。但是随着网站的使用,日志越来越来,数据量越来越大,这时候如果再将大量的数据一次性输出到一个excel中,就很容易出现卡死、请求超时、内存溢出等问题。At present, many websites output the log to an excel at one time when downloading the log. When the log content is not very large, there will be no problem. However, with the use of the website, the logs are getting more and more, and the amount of data is getting bigger and bigger. At this time, if a large amount of data is output to an excel at one time, problems such as stuck, request timeout, and memory overflow will easily occur. .
发明内容Contents of the invention
为了解决上述技术问题,本发明提供了一种网络系统中日志的管理方法和装置。In order to solve the above technical problems, the present invention provides a log management method and device in a network system.
为了达到本发明目的,本发明提供了一种网络系统中日志的管理方法,包括:In order to achieve the purpose of the present invention, the present invention provides a kind of log management method in the network system, comprising:
当接收到客户端发送的日志下载请求后,获取所述下载请求对应的日志数据;After receiving the log download request sent by the client, obtaining the log data corresponding to the download request;
确定所述日志数据的数据量的大小;Determine the size of the data volume of the log data;
将所述日志数据的数据量与预先设置的数据量阈值进行比较,得到比较结果;Comparing the data volume of the log data with a preset data volume threshold to obtain a comparison result;
如果比较结果为大于所述数据量阈值,则将所述日志数据分批发送。If the comparison result is greater than the data volume threshold, the log data is sent in batches.
其中,所述方法还具有如下特点:所述确定所述日志数据的数据量的大小包括:Wherein, the method also has the following characteristics: the determining the size of the data volume of the log data includes:
获取所述下载请求中所请求的保存格式;Obtain the storage format requested in the download request;
按照所请求的保存格式,生成存储该日志数据的临时文件;According to the requested storage format, generate a temporary file for storing the log data;
确定所述临时文件的数据量大小。Determine the data size of the temporary file.
其中,所述方法还具有如下特点:所述将所述日志数据分批发送之前,所述方法还包括:Wherein, the method also has the following characteristics: before sending the log data in batches, the method also includes:
发送将所述数据分批进行下载的提示信息;sending prompt information for downloading the data in batches;
接收对所述提示信息的确认操作;receiving a confirmation operation on the prompt message;
其中,在接收到所述确认操作后,再执行所述将所述日志数据分批发送的操作。Wherein, the operation of sending the log data in batches is performed after the confirmation operation is received.
其中,所述方法还具有如下特点:所述将所述日志数据分批发送之前,所述方法还包括:Wherein, the method also has the following characteristics: before sending the log data in batches, the method also includes:
获取所述客户端下载所述日志数据所使用的网络带宽信息;Obtaining network bandwidth information used by the client to download the log data;
根据所述网络带宽的大小,确定所述日志数据的分批次数以及每次发送的数据量;According to the size of the network bandwidth, determine the number of batches of the log data and the amount of data sent each time;
其中,所述将所述日志数据分批发送包括:Wherein, the sending of the log data in batches includes:
按照确定的分批次数以及每批发送的数据量,将所述日志数据发送出去。The log data is sent out according to the determined number of batches and the amount of data sent in each batch.
其中,所述方法还具有如下特点:所述将所述日志数据分批发送之前,所述方法还包括:Wherein, the method also has the following characteristics: before sending the log data in batches, the method also includes:
获取所述客户端下载所述日志数据所使用的网络带宽的占用状态;Acquiring the occupancy state of the network bandwidth used by the client to download the log data;
在上一批日志数据发送完成后,根据所述网络带宽的状态,控制每批日志数据的发送时间;After the last batch of log data is sent, according to the state of the network bandwidth, control the sending time of each batch of log data;
其中,所述将所述日志数据分批发送包括:Wherein, the sending of the log data in batches includes:
在确定的发送时间,将对应的批次的日志数据发送出去。At the determined sending time, the corresponding batch of log data is sent out.
为了达到本发明目的,本发明还提供了一种网络系统中日志的管理装置,包括:In order to achieve the purpose of the present invention, the present invention also provides a log management device in a network system, including:
第一获取模块,用于当接收到客户端发送的日志下载请求后,获取所述下载请求对应的日志数据;The first obtaining module is used to obtain the log data corresponding to the download request after receiving the log download request sent by the client;
第一确定模块,用于确定所述日志数据的数据量的大小;A first determining module, configured to determine the size of the data volume of the log data;
比较模块,用于将所述日志数据的数据量与预先设置的数据量阈值进行比较,得到比较结果;A comparison module, configured to compare the data volume of the log data with a preset data volume threshold to obtain a comparison result;
第一发送模块,用于如果比较结果为大于所述数据量阈值,则将所述日志数据分批发送。The first sending module is configured to send the log data in batches if the comparison result is greater than the data volume threshold.
其中,所述装置还具有如下特点:所述确定模块包括:Wherein, the device also has the following characteristics: the determination module includes:
获取单元,用于获取所述下载请求中所请求的保存格式;an acquisition unit, configured to acquire the storage format requested in the download request;
生成单元,用于按照所请求的保存格式,生成存储该日志数据的临时文件;A generating unit, configured to generate a temporary file for storing the log data according to the requested storage format;
确定单元,用于确定所述临时文件的数据量大小。A determining unit, configured to determine the data size of the temporary file.
其中,所述装置还具有如下特点:所述装置还包括:Wherein, the device also has the following characteristics: the device also includes:
第二发送模块,用于在将所述日志数据分批发送之前,发送将所述数据分批进行下载的提示信息;The second sending module is used to send prompt information for downloading the data in batches before sending the log data in batches;
接收模块,用于接收对所述提示信息的确认操作;A receiving module, configured to receive a confirmation operation on the prompt information;
其中,所述第一发送模块在接收到所述确认操作后,再执行所述将所述日志数据分批发送的操作。Wherein, the first sending module executes the operation of sending the log data in batches after receiving the confirmation operation.
其中,所述装置还具有如下特点:所述装置还包括:Wherein, the device also has the following characteristics: the device also includes:
第二获取模块,用于在将所述日志数据分批发送之前,获取所述客户端下载所述日志数据所使用的网络带宽信息;The second obtaining module is used to obtain the network bandwidth information used by the client to download the log data before sending the log data in batches;
第二确定模块,用于根据所述网络带宽的大小,确定所述日志数据的分批次数以及每次发送的数据量;The second determination module is used to determine the number of batches of the log data and the amount of data sent each time according to the size of the network bandwidth;
其中,所述第一发送模块按照确定的分批次数以及每批发送的数据量,将所述日志数据发送出去。Wherein, the first sending module sends the log data according to the determined number of batches and the amount of data sent in each batch.
其中,所述装置还具有如下特点:所述装置还包括:Wherein, the device also has the following characteristics: the device also includes:
第三获取模块,用于在将所述日志数据分批发送之前,获取所述客户端下载所述日志数据所使用的网络带宽的占用状态;A third obtaining module, configured to obtain the occupancy state of the network bandwidth used by the client to download the log data before sending the log data in batches;
控制模块,用于在上一批日志数据发送完成后,根据所述网络带宽的状态,控制每批日志数据的发送时间;A control module, configured to control the sending time of each batch of log data according to the state of the network bandwidth after the last batch of log data is sent;
其中,所述第一发送模块在确定的发送时间,将对应的批次的日志数据发送出去。Wherein, the first sending module sends the corresponding batch of log data at the determined sending time.
本发明提供的实施例,当接收到客户端发送的日志下载请求后,获取所述下载请求对应的日志数据,与现有技术直接将日志数据下发给客户端不同的是,本发明首先确定所述日志数据的数据量的大小,并将所述日志数据的数据量与预先设置的数据量阈值进行比较,根据得到比较结果,确定是否将数据直接发送给客户端,在比较结果为大于所述数据量阈值,则将所述日志数据分批发送,降低卡死、请求超时、内存溢出等问题发生的概率,提升数据传输的稳定性。In the embodiment provided by the present invention, after receiving the log download request sent by the client, the log data corresponding to the download request is obtained. Unlike the prior art that directly sends the log data to the client, the present invention first determines The size of the data volume of the log data, and compare the data volume of the log data with the preset data volume threshold, and determine whether to directly send the data to the client according to the comparison result, if the comparison result is greater than the specified If the above data volume threshold is exceeded, the log data will be sent in batches to reduce the probability of problems such as stuck, request timeout, and memory overflow, and improve the stability of data transmission.
本发明的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Additional features and advantages of the invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
附图说明Description of drawings
附图用来提供对本发明技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本发明的技术方案,并不构成对本发明技术方案的限制。The accompanying drawings are used to provide a further understanding of the technical solution of the present invention, and constitute a part of the description, and are used together with the embodiments of the application to explain the technical solution of the present invention, and do not constitute a limitation to the technical solution of the present invention.
图1为本发明提供的网络系统中日志的管理方法的流程图;Fig. 1 is the flowchart of the management method of log in the network system provided by the present invention;
图2为本发明提供的网络系统中日志的管理装置的结构图。FIG. 2 is a structural diagram of a log management device in a network system provided by the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined arbitrarily with each other.
在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The steps shown in the flowcharts of the figures may be performed in a computer system, such as a set of computer-executable instructions. Also, although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that shown or described herein.
图1为本发明提供的网络系统中日志的管理方法的流程图。图1所示方法包括:FIG. 1 is a flowchart of a log management method in a network system provided by the present invention. The methods shown in Figure 1 include:
步骤101、当接收到客户端发送的日志下载请求后,获取所述下载请求对应的日志数据;Step 101. After receiving the log download request sent by the client, obtain the log data corresponding to the download request;
步骤102、确定所述日志数据的数据量的大小;Step 102, determining the size of the data volume of the log data;
步骤103、将所述日志数据的数据量与预先设置的数据量阈值进行比较,得到比较结果;Step 103, comparing the data volume of the log data with a preset data volume threshold to obtain a comparison result;
步骤104、如果比较结果为大于所述数据量阈值,则将所述日志数据分批发送。Step 104, if the comparison result is greater than the data volume threshold, send the log data in batches.
本发明提供的方法实施例,当接收到客户端发送的日志下载请求后,获取所述下载请求对应的日志数据,与现有技术直接将日志数据下发给客户端不同的是,本发明首先确定所述日志数据的数据量的大小,并将所述日志数据的数据量与预先设置的数据量阈值进行比较,根据得到比较结果,确定是否将数据直接发送给客户端,在比较结果为大于所述数据量阈值,则将所述日志数据分批发送,降低卡死、请求超时、内存溢出等问题发生的概率,提升数据传输的稳定性。In the embodiment of the method provided by the present invention, after receiving the log download request sent by the client, the log data corresponding to the download request is obtained. Unlike the prior art that directly sends the log data to the client, the present invention first Determine the size of the data volume of the log data, and compare the data volume of the log data with a preset data volume threshold, determine whether to directly send the data to the client according to the comparison result, and if the comparison result is greater than If the data volume threshold is set, the log data will be sent in batches to reduce the probability of problems such as stuck, request timeout, and memory overflow, and improve the stability of data transmission.
下面对本发明提供的方法实施例作进一步说明:The method embodiment provided by the present invention is described further below:
本发明主要是为了解决大批量下载日志的时候,容易出现请求超时、卡死、内存溢出等问题。The present invention is mainly to solve problems such as request timeout, stuck, memory overflow, etc., which are prone to occur when downloading logs in large quantities.
本发明的方案的基本思想,具体如下:The basic idea of the solution of the present invention is specifically as follows:
1)大批量日志下载时分批下载;1) When downloading large batches of logs, download them in batches;
2)服务端根据分批下载的请求分批返回数据。2) The server returns data in batches according to the batch download request.
在本发明提供的一个方法实施例中,所述确定所述日志数据的数据量的大小包括:In a method embodiment provided by the present invention, the determining the size of the data volume of the log data includes:
获取所述下载请求中所请求的保存格式;Obtain the storage format requested in the download request;
按照所请求的保存格式,生成存储该日志数据的临时文件;According to the requested storage format, generate a temporary file for storing the log data;
确定所述临时文件的数据量大小。Determine the data size of the temporary file.
具体的,在用户配置所要下载的日志数据时,可以提示用户进行保存格式的设置,在用户完成设置后,触发下载请求操作,可以通过读取下载请求中用户配置的日志数据的保存格式;在将日志数据发送出去前,首先按照请求的下载格式,如excel、txt等,计算该日志数据以对应的保存格式进行发送时的数据量大小,最终确定要发送给用户的数据量,而不是该日志本身的数据量,以便更准确的得到用户需要接收的数据量。Specifically, when the user configures the log data to be downloaded, the user can be prompted to set the save format. After the user completes the setting, the download request operation is triggered, and the save format of the log data configured by the user in the download request can be read; Before sending the log data, first calculate the data volume when the log data is sent in the corresponding storage format according to the requested download format, such as excel, txt, etc., and finally determine the data volume to be sent to the user instead of the The amount of data in the log itself, in order to more accurately obtain the amount of data that the user needs to receive.
通过上述方式,确定得到的数据量会更加准确地确定日志数据的数据量,能够更准确的判断数据量与数据量阈值之间的大小,保证操作的准确性。Through the above method, the determined data volume will more accurately determine the data volume of the log data, and can more accurately determine the size between the data volume and the data volume threshold, thereby ensuring the accuracy of the operation.
其中,在将所述日志数据分批发送之前,所述方法还包括:Wherein, before sending the log data in batches, the method further includes:
发送将所述数据分批进行下载的提示信息;sending prompt information for downloading the data in batches;
接收对所述提示信息的确认操作;receiving a confirmation operation on the prompt message;
其中,在接收到所述确认操作后,再执行所述将所述日志数据分批发送的操作。Wherein, the operation of sending the log data in batches is performed after the confirmation operation is received.
具体的,在服务器侧确定需要进行分批操作后,还要征询客户端侧的处理结果,以保证能够更好的完成网络服务,同时达到提示用户后续需通过分批传输的方式来获取日志数据,以保证用户能够等待接收全部的日志数据。Specifically, after determining the need for batch operations on the server side, it is necessary to consult the processing results on the client side to ensure that network services can be better completed, and at the same time to remind users that they need to obtain log data in batches. , to ensure that users can wait to receive all log data.
当然,如果用户未执行确认操作,则按照默认的传输方式进行数据的传输,如直接将日志数据发送出去。Of course, if the user does not perform the confirmation operation, the data will be transmitted according to the default transmission method, such as sending the log data directly.
其中,在分批发送日志数据时,为充分匹配服务器侧与客户端侧的网络资源,所述将所述日志数据分批发送之前,所述方法还包括:Wherein, when sending the log data in batches, in order to fully match the network resources of the server side and the client side, before sending the log data in batches, the method further includes:
获取所述客户端下载所述日志数据所使用的网络带宽信息;Obtaining network bandwidth information used by the client to download the log data;
根据所述网络带宽的大小,确定所述日志数据的分批次数以及每次发送的数据量;According to the size of the network bandwidth, determine the number of batches of the log data and the amount of data sent each time;
其中,所述将所述日志数据分批发送包括:Wherein, the sending of the log data in batches includes:
按照确定的分批次数以及每批发送的数据量,将所述日志数据发送出去。The log data is sent out according to the determined number of batches and the amount of data sent in each batch.
具体的,获取客户端的带宽大小,根据该带宽大小,确定每次能够通过该网络带宽的带宽资源传输的数据量,再进而根据每次传输的数据量,确定该日志数据的总数量需要分成的批次总数。Specifically, obtain the bandwidth size of the client, determine the amount of data that can be transmitted through the bandwidth resources of the network bandwidth each time according to the bandwidth size, and then determine the total amount of log data that needs to be divided into according to the amount of data transmitted each time The total number of batches.
优选的,由于服务器侧与客户端侧的网络带宽往往还要传输其他数据,那么在进行日志数据的分批传输时,还要考虑当前网络带宽的占用情况,如果网络带宽处于空闲,则可以及时将该批次的数据量发送出去,而如果网络带宽处于忙碌状态,则控制推迟发送该批次的数据量的时间,等待网络带宽处于空闲状态时再进行发送。具体的实现方式如下:Preferably, since the network bandwidth of the server side and the client side often needs to transmit other data, the current network bandwidth occupancy should also be considered when performing batch transmission of log data. If the network bandwidth is idle, it can be timely Send the data volume of this batch, and if the network bandwidth is in a busy state, then control the time to postpone sending the data volume of this batch, and wait for the network bandwidth to be in an idle state before sending. The specific implementation is as follows:
其中,所述将所述日志数据分批发送之前,所述方法还包括:Wherein, before sending the log data in batches, the method further includes:
获取所述客户端下载所述日志数据所使用的网络带宽的占用状态;Acquiring the occupancy state of the network bandwidth used by the client to download the log data;
在上一批日志数据发送完成后,根据所述网络带宽的状态,控制每批日志数据的发送时间;After the last batch of log data is sent, according to the state of the network bandwidth, control the sending time of each batch of log data;
其中,所述将所述日志数据分批发送包括:Wherein, the sending of the log data in batches includes:
在确定的发送时间,将对应的批次的日志数据发送出去。At the determined sending time, the corresponding batch of log data is sent out.
由上可以看出,结合网络带宽的状态控制分批发送的操作,可以在兼顾网络正常传输的同时,减少请求超时、卡死、内存溢出等问题的发生概率,有效提升传输稳定性。It can be seen from the above that the operation of batch transmission combined with the state of the network bandwidth can reduce the probability of problems such as request timeout, stuck, memory overflow, etc. while taking into account the normal transmission of the network, and effectively improve the transmission stability.
下面以本发明提供的应用实例对本发明提到的方法作进一步说明:The method mentioned in the present invention will be further described below with the application examples provided by the present invention:
一种下载大批量日志时,分批下载日志的方式。具体实施过程如下:A way to download logs in batches when downloading large batches of logs. The specific implementation process is as follows:
1)在下载日志前,获取日志的数据量;1) Before downloading the log, obtain the data volume of the log;
2)根据获取到的日志数据量,判断是否需要分批次请求下载;2) According to the amount of log data obtained, it is judged whether it is necessary to request downloading in batches;
3)若数据量大,则依据数据量进行多次请求;3) If the amount of data is large, multiple requests are made based on the amount of data;
具体的,例如日志数据共有100万条数据,确定的分批下载策略为分10次请求下载,每次均为10万条数据;其中,每个请求都带有分批需要的参数:批次编号page和批次编号pageSize;Specifically, for example, the log data has a total of 1 million pieces of data, and the determined batch download strategy is to download in 10 requests, each with 100,000 pieces of data; each request has the parameters required for batching: batch Number page and batch number pageSize;
例如,第一个请求的参数pageSize:10万,page:1;第二个请求的参数pageSize:10万,page:2;依次类推;For example, the parameter pageSize of the first request: 100,000, page: 1; the parameter of the second request pageSize: 100,000, page: 2; and so on;
4)服务端获取到请求以及参数,进行日志的返回。4) The server obtains the request and parameters, and returns the log.
本发明应用实例提供的方法,解决了大批量下载日志的时候,出现的请求超时、卡死、内存溢出等问题,增强了产品的稳定性,提高产品竞争力。The method provided by the application example of the invention solves the problems of request overtime, stuck, memory overflow and the like when downloading a large number of logs, enhances the stability of the product and improves the competitiveness of the product.
图2为本发明提供的网络系统中日志的管理装置的结构图。图2所示装置包括:FIG. 2 is a structural diagram of a log management device in a network system provided by the present invention. The device shown in Figure 2 includes:
第一获取模块201,用于当接收到客户端发送的日志下载请求后,获取所述下载请求对应的日志数据;The first acquiring module 201 is configured to acquire log data corresponding to the download request after receiving the log download request sent by the client;
第一确定模块202,用于确定所述日志数据的数据量的大小;The first determination module 202 is configured to determine the size of the data volume of the log data;
比较模块203,用于将所述日志数据的数据量与预先设置的数据量阈值进行比较,得到比较结果;A comparison module 203, configured to compare the data volume of the log data with a preset data volume threshold to obtain a comparison result;
第一发送模块204,用于如果比较结果为大于所述数据量阈值,则将所述日志数据分批发送。The first sending module 204 is configured to send the log data in batches if the comparison result is greater than the data volume threshold.
在本发明提供的一个装置实施例中,所述确定模块202包括:In an apparatus embodiment provided by the present invention, the determination module 202 includes:
获取单元,用于获取所述下载请求中所请求的保存格式;an acquisition unit, configured to acquire the storage format requested in the download request;
生成单元,用于按照所请求的保存格式,生成存储该日志数据的临时文件;A generating unit, configured to generate a temporary file for storing the log data according to the requested storage format;
确定单元,用于确定所述临时文件的数据量大小。A determining unit, configured to determine the data size of the temporary file.
在本发明提供的一个装置实施例中,所述装置还包括:In an embodiment of the device provided by the present invention, the device further includes:
第二发送模块,用于在将所述日志数据分批发送之前,发送将所述数据分批进行下载的提示信息;The second sending module is used to send prompt information for downloading the data in batches before sending the log data in batches;
接收模块,用于接收对所述提示信息的确认操作;A receiving module, configured to receive a confirmation operation on the prompt information;
其中,所述第一发送模块204在接收到所述确认操作后,再执行所述将所述日志数据分批发送的操作。Wherein, the first sending module 204 executes the operation of sending the log data in batches after receiving the confirmation operation.
在本发明提供的一个装置实施例中,所述装置还包括:In an embodiment of the device provided by the present invention, the device further includes:
第二获取模块,用于在将所述日志数据分批发送之前,获取所述客户端下载所述日志数据所使用的网络带宽信息;The second obtaining module is used to obtain the network bandwidth information used by the client to download the log data before sending the log data in batches;
第二确定模块,用于根据所述网络带宽的大小,确定所述日志数据的分批次数以及每次发送的数据量;The second determination module is used to determine the number of batches of the log data and the amount of data sent each time according to the size of the network bandwidth;
其中,所述第一发送模块204按照确定的分批次数以及每批发送的数据量,将所述日志数据发送出去。Wherein, the first sending module 204 sends the log data according to the determined number of batches and the amount of data sent in each batch.
在本发明提供的一个装置实施例中,所述装置还包括:In an embodiment of the device provided by the present invention, the device further includes:
第三获取模块,用于在将所述日志数据分批发送之前,获取所述客户端下载所述日志数据所使用的网络带宽的占用状态;A third obtaining module, configured to obtain the occupancy state of the network bandwidth used by the client to download the log data before sending the log data in batches;
控制模块,用于在上一批日志数据发送完成后,根据所述网络带宽的状态,控制每批日志数据的发送时间;A control module, configured to control the sending time of each batch of log data according to the state of the network bandwidth after the last batch of log data is sent;
其中,所述第一发送模块204在确定的发送时间,将对应的批次的日志数据发送出去。Wherein, the first sending module 204 sends out the corresponding batch of log data at the determined sending time.
本发明提供的装置实施例,当接收到客户端发送的日志下载请求后,获取所述下载请求对应的日志数据,与现有技术直接将日志数据下发给客户端不同的是,本发明首先确定所述日志数据的数据量的大小,并将所述日志数据的数据量与预先设置的数据量阈值进行比较,根据得到比较结果,确定是否将数据直接发送给客户端,在比较结果为大于所述数据量阈值,则将所述日志数据分批发送,降低卡死、请求超时、内存溢出等问题发生的概率,提升数据传输的稳定性。In the device embodiment provided by the present invention, after receiving the log download request sent by the client, the log data corresponding to the download request is obtained. Unlike the prior art that directly sends the log data to the client, the present invention first Determine the size of the data volume of the log data, and compare the data volume of the log data with a preset data volume threshold, determine whether to directly send the data to the client according to the comparison result, and if the comparison result is greater than If the data volume threshold is set, the log data will be sent in batches to reduce the probability of problems such as stuck, request timeout, and memory overflow, and improve the stability of data transmission.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。Those of ordinary skill in the art can understand that all or part of the steps of the above-mentioned embodiments can be implemented using a computer program flow, the computer program can be stored in a computer-readable storage medium, and the computer program can be run on a corresponding hardware platform (such as system, device, device, device, etc.), and when executed, includes one or a combination of the steps of the method embodiment.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。Optionally, all or part of the steps in the above embodiments can also be implemented using integrated circuits, and these steps can be fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module accomplish. As such, the present invention is not limited to any specific combination of hardware and software.
上述实施例中的各装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/functional modules/functional units in the above embodiments can be realized by general-purpose computing devices, and they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices.
上述实施例中的各装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When each device/functional module/functional unit in the above-mentioned embodiments is realized in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, and the like.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求所述的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope described in the claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201811029325.7A CN108989471A (en) | 2018-09-05 | 2018-09-05 | The management method and device of log in network system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201811029325.7A CN108989471A (en) | 2018-09-05 | 2018-09-05 | The management method and device of log in network system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN108989471A true CN108989471A (en) | 2018-12-11 |
Family
ID=64544631
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201811029325.7A Pending CN108989471A (en) | 2018-09-05 | 2018-09-05 | The management method and device of log in network system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN108989471A (en) |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110377481A (en) * | 2019-06-19 | 2019-10-25 | 深圳壹账通智能科技有限公司 | Blog management method, device, equipment and storage medium |
| CN111090621A (en) * | 2019-10-30 | 2020-05-01 | 苏州浪潮智能科技有限公司 | Log obtaining method, device and storage medium |
| CN111314280A (en) * | 2019-11-28 | 2020-06-19 | 上海孝庸资产管理有限公司 | Multi-user large-data-volume-based slow system data real-time reading and updating method |
| CN111628967A (en) * | 2020-04-20 | 2020-09-04 | 深圳市广和通无线股份有限公司 | Log data transmission method and device, computer equipment and storage medium |
| CN114629896A (en) * | 2022-04-19 | 2022-06-14 | 高途教育科技集团有限公司 | File downloading method and device, electronic equipment and readable storage medium |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060167855A1 (en) * | 2004-05-12 | 2006-07-27 | Baytsp | Identification and tracking of digital content distributors on wide area networks |
| CN104391954A (en) * | 2014-11-27 | 2015-03-04 | 北京国双科技有限公司 | Database log processing method and device |
| CN105119727A (en) * | 2015-07-31 | 2015-12-02 | 山东蚁巡网络科技有限公司 | Log analysis service method characterized by charging according to cloud service resources |
| CN106788896A (en) * | 2016-12-27 | 2017-05-31 | 北京五八信息技术有限公司 | The method for uploading and device of daily record data |
| CN106897431A (en) * | 2017-02-27 | 2017-06-27 | 郑州云海信息技术有限公司 | A kind of daily record deriving method and system |
-
2018
- 2018-09-05 CN CN201811029325.7A patent/CN108989471A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060167855A1 (en) * | 2004-05-12 | 2006-07-27 | Baytsp | Identification and tracking of digital content distributors on wide area networks |
| CN104391954A (en) * | 2014-11-27 | 2015-03-04 | 北京国双科技有限公司 | Database log processing method and device |
| CN105119727A (en) * | 2015-07-31 | 2015-12-02 | 山东蚁巡网络科技有限公司 | Log analysis service method characterized by charging according to cloud service resources |
| CN106788896A (en) * | 2016-12-27 | 2017-05-31 | 北京五八信息技术有限公司 | The method for uploading and device of daily record data |
| CN106897431A (en) * | 2017-02-27 | 2017-06-27 | 郑州云海信息技术有限公司 | A kind of daily record deriving method and system |
Cited By (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110377481A (en) * | 2019-06-19 | 2019-10-25 | 深圳壹账通智能科技有限公司 | Blog management method, device, equipment and storage medium |
| CN110377481B (en) * | 2019-06-19 | 2022-06-28 | 深圳壹账通智能科技有限公司 | Log management method, device, equipment and storage medium |
| CN111090621A (en) * | 2019-10-30 | 2020-05-01 | 苏州浪潮智能科技有限公司 | Log obtaining method, device and storage medium |
| CN111314280A (en) * | 2019-11-28 | 2020-06-19 | 上海孝庸资产管理有限公司 | Multi-user large-data-volume-based slow system data real-time reading and updating method |
| CN111314280B (en) * | 2019-11-28 | 2022-05-27 | 上海孝庸资产管理有限公司 | Slow system data real-time reading and updating method based on multi-user large data volume |
| CN111628967A (en) * | 2020-04-20 | 2020-09-04 | 深圳市广和通无线股份有限公司 | Log data transmission method and device, computer equipment and storage medium |
| CN114629896A (en) * | 2022-04-19 | 2022-06-14 | 高途教育科技集团有限公司 | File downloading method and device, electronic equipment and readable storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108989471A (en) | The management method and device of log in network system | |
| CN108549580B (en) | Method for automatically deploying Kubernets slave nodes and terminal equipment | |
| CN102831045B (en) | Method and device for detecting starting items in terminal equipment | |
| JP5522307B2 (en) | System and method for remote maintenance of client systems in electronic networks using software testing with virtual machines | |
| CN110213356A (en) | A kind of login process method and relevant device based on data processing | |
| EP3991389B1 (en) | File upload control for client-side applications in proxy solutions | |
| CN104580406B (en) | A kind of method and apparatus of synchronous logging state | |
| CN106302445B (en) | Method and apparatus for handling request | |
| CN104468592B (en) | Login method and login system | |
| CN111756644B (en) | Hot spot current limiting method, system, equipment and storage medium | |
| CN111694749A (en) | Automatic interface testing method and device, computer equipment and readable storage medium | |
| WO2019109518A1 (en) | Data list uploading method and terminal thereof | |
| US8484360B2 (en) | Method and system for separating HTTP session | |
| CN108718347A (en) | A kind of domain name analytic method, system, device and storage medium | |
| WO2019237591A1 (en) | File format conversion method and apparatus, computer device, and storage medium | |
| US9178860B2 (en) | Out-of-path, content-addressed writes with untrusted clients | |
| CN110362993A (en) | Malicious process recognition methods, terminal, server, system and storage medium | |
| CN109948332A (en) | A kind of physical machine login password remapping method and device | |
| CN114185804B (en) | Interface testing method and device and terminal equipment | |
| CN113256360B (en) | Invoice processing control method, device, equipment and storage medium based on Ukey cabinet | |
| CN110633432A (en) | Method, device, terminal equipment and medium for acquiring data | |
| CN119011609A (en) | Cloud storage method, device, equipment and medium based on intelligent allocation of network equipment | |
| CN108052286A (en) | A kind of method, apparatus and equipment for managing heterogeneous storage devices | |
| CN111859320A (en) | Cross-system login-free method, apparatus, device and readable storage medium | |
| EP2406713A1 (en) | Synchronized relay messaging and coordinated network processing using snmp |
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 |
Application publication date: 20181211 |
|
| RJ01 | Rejection of invention patent application after publication |