CN115658438A - Log collection method and device - Google Patents

Log collection method and device Download PDF

Info

Publication number
CN115658438A
CN115658438A CN202211386994.6A CN202211386994A CN115658438A CN 115658438 A CN115658438 A CN 115658438A CN 202211386994 A CN202211386994 A CN 202211386994A CN 115658438 A CN115658438 A CN 115658438A
Authority
CN
China
Prior art keywords
target
log
character information
page
information
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
CN202211386994.6A
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202211386994.6A priority Critical patent/CN115658438A/en
Publication of CN115658438A publication Critical patent/CN115658438A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a log collection method and a log collection device, which relate to the technical field of artificial intelligence, and the method comprises the following steps: carrying out segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after a click action of a user on the hyperlink is detected; caching the character information into a local browser cache; after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information; and sending the restored target log information to a log server. The method and the device are used for reducing the loss rate of the log and improving the user experience.

Description

Log collection method and device
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a log acquisition method and a log acquisition device.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
With the increasing use of web application scenarios and users, the need for web-side log gathering functionality is also highlighted. The web-side application program needs to collect user behaviors, such as user clicks, element exposure and the like, in real time, and provide a data source for subsequent behavior analysis and customization services.
Because there is no necessary connection between the log collection program of the web end and the use of the main service, if a synchronous sending mode is used, the sending needs to be waited for and the response needs to be completed, so that the behavior of the user is blocked, and the user experience is influenced.
Therefore, most log collection programs send log requests to the server in a manner that does not block asynchronous requests of the host process.
Generally, in a conventional log collection process, a user action occurs, and then an asynchronous request is created and sent to a log server, but the asynchronous request has the disadvantage that smooth completion of sending during the page opening period cannot be guaranteed.
Specifically, the method comprises the following steps: in the scene that the clicking of the hyperlink in the existing part is completed through page synchronous jumping, the asynchronous log request is not sent to be completed with a high probability, and therefore the log information in the existing part is lost.
There is no log collection scheme that can solve the above problems.
Disclosure of Invention
The embodiment of the invention provides a log acquisition method, which is used for reducing the loss rate of logs and improving user experience and comprises the following steps:
carrying out segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after a click action of a user on the hyperlink is detected;
caching the character information into a local browser cache;
after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information;
and sending the restored target log information to a log server.
The embodiment of the invention also provides a log acquisition device, which is used for reducing the loss rate of logs and improving user experience, and the device comprises:
the log dividing module is used for dividing the target log information of the monitored target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after a click action of a user on the hyperlink is detected;
the character information caching module is used for caching the character information into a local browser cache;
the log reduction module is used for acquiring the character information from a local browser cache after monitoring the jump of the target page, and reducing the character information to obtain reduced target log information;
and the log sending module is used for sending the restored target log information to a log server.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the log collection method when executing the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the log collection method is implemented.
An embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the log collection method is implemented.
In the embodiment of the invention, the target log information of the monitored target page is segmented to obtain the character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after the click action of the user on the hyperlink is detected; caching the character information into a local browser cache; after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information; sending the restored target log information to a log server; according to the embodiment of the invention, the target log information is stored in the local browser cache, and the restored target log information is sent to the log server after the page jump, so that the problem that the log information is lost because the asynchronous log request is easy to be sent without completion due to the page jump in the asynchronous sending process of the traditional log can be solved, the problem that the log sending function is triggered when the page is about to jump so that the log loss rate is higher is solved, the log loss rate is reduced, and the user experience is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
FIG. 1 is a schematic flow chart illustrating a log collection method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an embodiment of a log collection method according to the present invention;
fig. 3 is a schematic structural diagram of a log collection device according to an embodiment of the present invention;
fig. 4 is a diagram illustrating a specific example of a log collection device according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating an embodiment of a log collection device according to the present invention;
fig. 6 is a schematic diagram of a computer device for log collection according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
The term "and/or" herein merely describes an associative relationship, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of a, B, and C, and may mean including any one or more elements selected from the group consisting of a, B, and C.
In the description of the present specification, the terms "comprising," "including," "having," "containing," and the like are used in an open-ended fashion, i.e., to mean including, but not limited to. Reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," etc., means that a particular feature, structure, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. The sequence of steps involved in the embodiments is for illustrative purposes to illustrate the implementation of the present application, and the sequence of steps is not limited and can be adjusted as needed.
According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
With the increasing use of web application scenarios and users, the need for web-side log gathering functionality is also highlighted. The web-side application program needs to collect user behaviors, such as user clicks, element exposure and the like, in real time, and provide data sources for subsequent behavior analysis and customization services.
Because there is no necessary connection between the log collection program of the web end and the use of the main service, if a synchronous sending mode is used, the sending needs to be waited for and the response needs to be completed, so that the behavior of the user is blocked, and the user experience is influenced.
Therefore, most log collection programs send log requests to the server in a manner that does not block asynchronous requests of the host process.
Generally, in a conventional log collection process, a user action occurs, and then an asynchronous request is created and sent to a log server, but the asynchronous request has the disadvantage that smooth completion of sending during the page opening period cannot be guaranteed.
Specifically, the method comprises the following steps: in the scene that the clicking of part of hyperlinks is completed through page synchronous jumping, asynchronous log requests are not sent to be completed with high probability, so that the part of log information is lost.
There is no log collection scheme that can solve the above problems.
In order to solve the above problem, an embodiment of the present invention provides a log collecting method, so as to reduce a loss rate of logs and improve user experience, where, referring to fig. 1, the method may include:
step 101: carrying out segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after a click action of a user on the hyperlink is detected;
step 102: caching the character information into a local browser cache;
step 103: after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information;
step 104: and sending the restored target log information to a log server.
In the embodiment of the invention, the monitored target log information of the target page is segmented to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after the click action of the user on the hyperlink is detected; caching the character information into a local browser cache; after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information; sending the restored target log information to a log server; according to the embodiment of the invention, the target log information is stored in the local browser cache, and the restored target log information is sent to the log server after the page is jumped, so that the problem that log information is lost due to the fact that asynchronous log requests are easy to be sent without completion due to page jumping in the asynchronous sending process of the traditional log can be solved, the problem that the log sending function is triggered when the page is about to jump and the log loss rate is high is solved, the log loss rate is reduced, and the user experience is improved.
When the method is specifically implemented, firstly, segmenting target log information of a monitored target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after the click action of the user on the hyperlink is detected.
In an embodiment, different log information may be divided by a specific separator (e.g., space) and then spliced into character information, such as a character string.
In one embodiment, further comprising:
before the monitored target log information of the target page is subjected to segmentation processing, determining whether a hyperlink exists in the target page;
when determining that no hyperlink exists in the target page, sending target log information of the target page to a log server in an asynchronous mode;
the method for segmenting the monitored target log information of the target page to obtain the character information corresponding to the target log information comprises the following steps:
and when the hyperlink exists in the target page, carrying out segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information.
In the above embodiment, by determining whether a hyperlink exists in the target page and when it is determined that the hyperlink does not exist in the target page, an asynchronous manner is adopted, and target log information of the target page is sent to the log server, it is determined that the current target page does not jump due to a user clicking the page, so that the following problems are not caused: as the clicking of part of hyperlinks is completed through page synchronous jumping, asynchronous log requests are not sent to be completed with high probability in the scene, and the problem of log information loss is caused.
Furthermore, when the hyperlink exists in the target page, the monitored target log information of the target page is segmented to obtain character information corresponding to the target log information, so that the problem that log information is lost due to the fact that asynchronous log requests are prone to being not sent completely due to page skipping in the asynchronous sending process of traditional logs can be solved, the problem that the log sending function is triggered when the page is about to skip and the log loss rate is high is solved, the log loss rate is reduced, and user experience is improved.
In an embodiment, the dividing process is performed on the monitored target log information of the target page to obtain character information corresponding to the target log information, as shown in fig. 2, including:
step 201: dividing the monitored target log information of the target page by using a preset separator to obtain a plurality of divided characters of the target log information;
step 202: and splicing the segmented characters of the target log information to obtain character information corresponding to the target log information.
In the embodiment, the target log information of the monitored target page is segmented by the preset separators to obtain a plurality of segmented characters of the target log information; and splicing the segmented characters of the target log information to obtain the character information corresponding to the target log information, so that the target log information of the target page can be stored in a cache form in the subsequent steps.
In specific implementation, after the target log information of the monitored target page is segmented to obtain the character information corresponding to the target log information, the character information is cached in the local browser cache.
In an embodiment, the log of the upcoming page url jump scenario may be synchronously cached in the local browser cache before the jump by a page caching technique. Therefore, when the page jump is completed, whether the browser cache has the cache log of the type or not can be checked firstly in the subsequent page, and if so, the log is sent to the log server immediately. Therefore, the log before the page jump operation can be ensured not to be lost because of the unsent completion.
In one embodiment, caching the character information in a local browser cache includes:
and correspondingly caching the character information and the identification of the target page into a local browser cache.
In the above embodiment, the above character string may be cached in the cookie of the local browser, and a special key word may be used as the storage key word (i.e. the identification of the target page), such as "log".
In one embodiment, after the jump of the target page is monitored, the obtaining of the character information from the local browser cache includes:
and after the jump of the target page is monitored, acquiring character information corresponding to the identifier from a local browser cache according to the identifier of the target page.
In one embodiment, caching the character information in a local browser cache includes:
and caching the character information into a local browser cache by using a cookie browser cache technology, a local Storage browser cache technology, a session Storage browser cache technology, a web SQL browser cache technology or an index DB browser cache technology.
In the above embodiment, the log information is cached at the browser end, and the page jump is followed by reading from the browser cache, and the caching technology is not limited to the browser Storage technologies such as cookie, local Storage, session Storage, web SQL, and index DB. The above browser storage technology can be freely replaced, the used logic is consistent, and the difference is only in the storage and reading methods, which is not limited in the present application.
In specific implementation, after the character information is cached in a local browser cache, after the jump of the target page is monitored, the character information is obtained from the local browser cache, and the character information is restored to obtain restored target log information.
In an embodiment, a cookie value (i.e., the character information may be referred to as a cache value, which may be a cookie value) with a key "log" (i.e., the identifier) may be read from the newly skipped page, and the value is read according to the preset delimiter, so as to restore the original log information.
In one embodiment, after the jump of the target page is monitored, the obtaining of the character information from the local browser cache includes:
and after the jump of the target page is monitored, acquiring character information corresponding to the identifier from a local browser cache according to the identifier of the target page.
In the embodiment, when the asynchronous reporting mode is used, some operation logs which can cause page skipping can be firstly and synchronously cached on the browser, the operation consumption time is very short, the operation can be completed in millisecond level, and the normal use of a user can not be influenced, so that the cached logs can be sent out on a new page on a newly skipped page in the subsequent steps, and the log collection task is realized.
In specific implementation, after the jump of the target page is monitored, the character information is acquired from a local browser cache, the character information is restored, the restored target log information is obtained, and then the restored target log information is sent to a log server.
In an embodiment, the restored log information may be sent to the log server in an asynchronous manner, and cache data for clearing the character information may be sent to the local browser cache. In addition, the asynchronous sending mode of the restored target log information in the application does not influence the normal page experience of the user, and the user side is unaware.
In the embodiment, the log is cached in advance in the application, so that the loss rate of the log sending function triggered when the page is about to jump can be greatly reduced.
In one embodiment, sending the restored target log information to a log server includes:
and sending the restored target log information to a log server in an asynchronous Request form based on an XML Http Request object of a local browser.
In the above embodiment, a cookie caching technology of the browser end may be used to complete log storage before page skipping, identify a log of a previous page to be sent in a new page, extract specific cookie caching content, use an XML Http Request object of the browser end to complete a function of asynchronously sending logs, and send out the log content.
In the embodiment of the invention, the target log information of the monitored target page is segmented to obtain the character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after a click action of a user on the hyperlink is detected; caching the character information into a local browser cache; after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information; sending the restored target log information to a log server; according to the embodiment of the invention, the target log information is stored in the local browser cache, and the restored target log information is sent to the log server after the page is jumped, so that the problem that log information is lost due to the fact that asynchronous log requests are easy to be sent without completion due to page jumping in the asynchronous sending process of the traditional log can be solved, the problem that the log sending function is triggered when the page is about to jump and the log loss rate is high is solved, the log loss rate is reduced, and the user experience is improved.
As described above, in order to solve the following problems in the prior art: the mode of synchronously reporting the log can block the behavior of the user, the normal operation of the user cannot obtain the response of the browser before the request response does not come back, and if the network condition is not good, the user side has long waiting time, which has very serious influence on the user experience; the asynchronous log reporting mode easily causes that the log information is not sent out when the page is closed or the page jumps, so that the log information is lost.
The embodiment of the invention firstly synchronously caches some operation logs which can cause page jump to the browser while using an asynchronous reporting mode, the operation consumption time is very short, the operation can be completed in millisecond level, and the normal use of a user can not be influenced. And then sending out the cached log on the new page on the newly opened page. And synchronously caching the log of the upcoming page url jump scene into a local browser cache before jumping through a page caching technology. After the page jump is completed, whether the browser cache has the cache log of the type is checked in the subsequent page, and if so, the log is sent to a log server immediately. Therefore, the log before the page jump operation can be ensured not to be lost because of the unsent completion.
The embodiment of the invention also provides a log acquisition device, which is expressed by the following embodiment. Because the principle of the device for solving the problems is similar to the log collection method, the implementation of the device can refer to the implementation of the log collection method, and repeated parts are not described again.
An embodiment of the present invention further provides a log collecting device, configured to reduce a loss rate of logs and improve user experience, as shown in fig. 3, the log collecting device includes:
the log dividing module 301 is configured to perform dividing processing on target log information of the monitored target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after the click action of the user on the hyperlink is detected;
a character information caching module 302, configured to cache the character information in a local browser cache;
a log restoring module 303, configured to obtain the character information from a local browser cache after monitoring the jump of the target page, and restore the character information to obtain restored target log information;
a log sending module 304, configured to send the restored target log information to a log server.
In one embodiment, as shown in fig. 4, further comprising:
a hyperlink detection module 401 configured to:
before the monitored target log information of the target page is subjected to segmentation processing, determining whether a hyperlink exists in the target page;
when determining that no hyperlink exists in the target page, sending target log information of the target page to a log server in an asynchronous mode;
the log splitting module is specifically configured to:
and when the hyperlink exists in the target page, carrying out segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information.
In an embodiment, the log splitting module is specifically configured to:
carrying out segmentation processing on the monitored target log information of the target page by using preset separators to obtain a plurality of segmentation characters of the target log information;
and splicing the segmented characters of the target log information to obtain character information corresponding to the target log information.
In one embodiment, the character information caching module is specifically configured to:
and correspondingly caching the character information and the identification of the target page into a local browser cache.
In one embodiment, the log restoring module is specifically configured to:
and after the jump of the target page is monitored, acquiring character information corresponding to the identifier from a local browser cache according to the identifier of the target page.
In one embodiment, the character information caching module is specifically configured to:
and caching the character information into a local browser cache by using a cookie browser cache technology, a local Storage browser cache technology, a session Storage browser cache technology, a web SQL browser cache technology or an index DB browser cache technology.
In one embodiment, the log sending module is specifically configured to:
and sending the restored target log information to a log server in an asynchronous Request form based on an XML Http Request object of a local browser.
A specific embodiment is given below to illustrate a specific application of the apparatus of the present invention, and in this embodiment, the following modules may be included:
the log generation module is used for monitoring events such as clicking, exposure, sliding and the like by utilizing a browser event monitoring mechanism to form log content, namely a log segmentation module is used for carrying out segmentation processing on target log information of a monitored target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after the click action of the user on the hyperlink is detected;
the log sending module, namely the key introduction module of the invention, sends the generated front-end log to the server in a request form; the character information caching module is used for caching the character information into a local browser cache; the log reduction module is used for acquiring the character information from a local browser cache after monitoring the jump of the target page, and reducing the character information to obtain reduced target log information; a log sending module for sending the restored target log information to a log server
The log receiving module, namely a log server, analyzes the log content by receiving the request of the sending module and stores the log content into a database;
and finally, completing the processes of generating, sending, receiving, analyzing and storing the log.
Referring to fig. 5, the above embodiment may be performed as follows:
1. different log information is divided by a specific separator (such as a space) and then spliced into a character string.
2. The character string is cached in the cookie of the local browser, and a special key word is used as a storage key word, such as 'log'.
3. And reading a cookie value with a key word of 'log' in a newly-jumped page, respectively reading the value according to a separator in 1, and restoring the log information which can be started at the beginning.
4. And sending the restored log information to a log server in an asynchronous mode.
5. The log cache is emptied.
Of course, it is understood that other variations of the above-described detailed modules may be made, and all such variations are intended to fall within the scope of the present invention.
An embodiment of a computer device for implementing all or part of the content in the log collection method provided in the embodiments of the present invention specifically includes the following content:
a processor (processor), a memory (memory), a communication Interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between related devices; the computer device may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the computer device may be implemented with reference to the embodiment for implementing the log collection method and the embodiment for implementing the log collection apparatus in the embodiment, and the contents of the embodiments are incorporated herein, and repeated descriptions are omitted.
Fig. 6 is a schematic block diagram of a system configuration of a computer apparatus 1000 according to an embodiment of the present application. As shown in fig. 6, the computer apparatus 1000 may include a cpu 1001 and a memory 1002; the memory 1002 is coupled to the cpu 1001. Notably, this FIG. 6 is exemplary; other types of structures may also be used in addition to or in place of the structures to implement telecommunications or other functions.
In one embodiment, the log collection function may be integrated into the central processing unit 1001. The cpu 1001 may be configured to perform the following control:
segmenting the monitored target log information of the target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after the click action of the user on the hyperlink is detected;
caching the character information into a local browser cache;
after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information;
and sending the restored target log information to a log server.
In another embodiment, the log collection device may be configured separately from the central processing unit 1001, for example, the log collection device may be configured as a chip connected to the central processing unit 1001, and the log collection function is realized by the control of the central processing unit.
As shown in fig. 6, the computer device 1000 may further include: a communication module 1003, an input unit 1004, an audio processor 1005, a display 1006, a power supply 1007. It is noted that the computer device 1000 does not necessarily include all of the components shown in FIG. 6; furthermore, the computer device 1000 may also comprise components not shown in fig. 6, which may be referred to in the prior art.
As shown in fig. 6, the central processing unit 1001, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, and the central processing unit 1001 receives input and controls the operation of the various components of the computer apparatus 1000.
The memory 1002 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the cpu 1001 can execute the program stored in the memory 1002 to realize information storage or processing, or the like.
The input unit 1004 provides input to the cpu 1001. The input unit 1004 is, for example, a key or a touch input device. The power supply 1007 is used to supply power to the computer apparatus 1000. The display 1006 is used for displaying display objects such as images and characters. The display may be, for example, an LCD display, but is not limited thereto.
The memory 1002 may be a solid state memory such as Read Only Memory (ROM), random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes referred to as an EPROM or the like. The memory 1002 may also be some other type of device. Memory 1002 includes buffer memory 1021 (sometimes referred to as a buffer). The memory 1002 may include an application/function storage part 1022, the application/function storage part 1022 being used for storing application programs and function programs or a flow for executing the operation of the computer device 1000 by the central processing unit 1001.
The memory 1002 may also include a data store 1023, the data store 1023 being used to store data such as contacts, digital data, pictures, sounds and/or any other data used by the computer device. Driver storage 1024 of memory 1002 may include various drivers for the computer device for communication functions and/or for performing other functions of the computer device (e.g., messaging applications, directory applications, etc.).
The communication module 1003 is a transmitter/receiver 1003 that transmits and receives signals via an antenna 1008. A communication module (transmitter/receiver) 1003 is coupled to the central processor 1001 to provide an input signal and receive an output signal, which may be the same as the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 1003, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same computer device. The communication module (transmitter/receiver) 1003 is also coupled to a speaker 1009 and a microphone 1010 via an audio processor 1005 to provide audio output via the speaker 1009 and receive audio input from the microphone 1010 to implement general telecommunications functions. The audio processor 1005 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 1005 is also coupled to the central processor 1001, so that locally recorded sound can be recorded through the microphone 1010 and locally stored sound can be played through the speaker 1009.
The embodiment of the invention also provides a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and when the computer program is executed by a processor, the log collection method is realized.
An embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the log collection method is implemented.
In the embodiment of the invention, the monitored target log information of the target page is segmented to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after the click action of the user on the hyperlink is detected; caching the character information into a local browser cache; after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information; sending the restored target log information to a log server; according to the embodiment of the invention, the target log information is stored in the local browser cache, and the restored target log information is sent to the log server after the page jump, so that the problem that the log information is lost because the asynchronous log request is easy to be sent without completion due to the page jump in the asynchronous sending process of the traditional log can be solved, the problem that the log sending function is triggered when the page is about to jump so that the log loss rate is higher is solved, the log loss rate is reduced, and the user experience is improved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, and it should be understood that the above-mentioned embodiments are only examples of the present invention and should not be used to limit the scope of the present invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (17)

1. A log collection method, comprising:
carrying out segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after a click action of a user on the hyperlink is detected;
caching the character information into a local browser cache;
after monitoring the jump of the target page, acquiring the character information from a local browser cache, and performing reduction processing on the character information to obtain reduced target log information;
and sending the restored target log information to a log server.
2. The method of claim 1, further comprising:
before the monitored target log information of the target page is subjected to segmentation processing, whether a hyperlink exists in the target page is determined;
when determining that no hyperlink exists in the target page, sending target log information of the target page to a log server in an asynchronous mode;
the method for segmenting the monitored target log information of the target page to obtain the character information corresponding to the target log information comprises the following steps:
and when the hyperlink exists in the target page, carrying out segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information.
3. The method as claimed in claim 1, wherein the step of performing segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information comprises:
dividing the monitored target log information of the target page by using a preset separator to obtain a plurality of divided characters of the target log information;
and splicing the segmented characters of the target log information to obtain character information corresponding to the target log information.
4. The method of claim 1, wherein caching the character information into a local browser cache comprises:
and correspondingly caching the character information and the identification of the target page into a local browser cache.
5. The method as claimed in claim 4, wherein obtaining the character information from a local browser cache after monitoring the jump to the target page comprises:
and after the jump of the target page is monitored, acquiring character information corresponding to the identifier from a local browser cache according to the identifier of the target page.
6. The method of claim 1, wherein caching the character information into a local browser cache comprises:
and caching the character information into a local browser cache by using a cookie browser cache technology, a local Storage browser cache technology, a session Storage browser cache technology, a web SQL browser cache technology or an index DB browser cache technology.
7. The method of claim 1, wherein sending the restored target log information to a log server comprises:
and sending the restored target log information to a log server in an asynchronous Request form based on an XML Http Request object of the local browser.
8. A log collection device, comprising:
the log dividing module is used for dividing the target log information of the monitored target page to obtain character information corresponding to the target log information; the target page carrying the hyperlink is used for running a jump instruction for jumping to a page corresponding to the hyperlink after a click action of a user on the hyperlink is detected;
the character information caching module is used for caching the character information into a local browser cache;
the log reduction module is used for acquiring the character information from a local browser cache after monitoring the jump of the target page, and reducing the character information to obtain reduced target log information;
and the log sending module is used for sending the restored target log information to a log server.
9. The apparatus of claim 8, further comprising:
a hyperlink detection module to:
before the monitored target log information of the target page is subjected to segmentation processing, whether a hyperlink exists in the target page is determined;
when determining that no hyperlink exists in the target page, sending target log information of the target page to a log server in an asynchronous mode;
the log splitting module is specifically configured to:
and when the hyperlink exists in the target page, carrying out segmentation processing on the monitored target log information of the target page to obtain character information corresponding to the target log information.
10. The apparatus of claim 8, wherein the log splitting module is specifically configured to:
carrying out segmentation processing on the monitored target log information of the target page by using preset separators to obtain a plurality of segmentation characters of the target log information;
and splicing the segmented characters of the target log information to obtain character information corresponding to the target log information.
11. The apparatus of claim 8, wherein the character information caching module is specifically configured to:
and correspondingly caching the character information and the identification of the target page into a local browser cache.
12. The apparatus of claim 11, wherein the log reduction module is specifically configured to:
and after the jump of the target page is monitored, acquiring character information corresponding to the identifier from a local browser cache according to the identifier of the target page.
13. The apparatus of claim 8, wherein the character information caching module is specifically configured to:
and caching the character information into a local browser cache by using a cookie browser cache technology, a local Storage browser cache technology, a session Storage browser cache technology, a web SQL browser cache technology or an index DB browser cache technology.
14. The apparatus of claim 8, wherein the log sending module is specifically configured to:
and sending the restored target log information to a log server in an asynchronous Request form based on an XML Http Request object of a local browser.
15. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 7 when executing the computer program.
16. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of any one of claims 1 to 7.
17. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
CN202211386994.6A 2022-11-07 2022-11-07 Log collection method and device Pending CN115658438A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211386994.6A CN115658438A (en) 2022-11-07 2022-11-07 Log collection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211386994.6A CN115658438A (en) 2022-11-07 2022-11-07 Log collection method and device

Publications (1)

Publication Number Publication Date
CN115658438A true CN115658438A (en) 2023-01-31

Family

ID=85016318

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211386994.6A Pending CN115658438A (en) 2022-11-07 2022-11-07 Log collection method and device

Country Status (1)

Country Link
CN (1) CN115658438A (en)

Similar Documents

Publication Publication Date Title
CN102468989B (en) The method and system of network data
CN109514586B (en) Method and system for realizing intelligent customer service robot
CN107370806B (en) HTTP status code monitoring method, device, storage medium and electronic equipment
CN110297944B (en) Distributed XML data processing method and system
CN110647460B (en) Test resource management method and device and test client
CN111782470A (en) Distributed container log data processing method and device
CN111367873A (en) Log data storage method and device, terminal and computer storage medium
CN113672748A (en) Multimedia information playing method and device
CN109002550B (en) Test method and device for reduction equipment
CN113297453A (en) Network request response method and device, electronic equipment and storage medium
CN112463391A (en) Memory control method, memory control device, storage medium and electronic equipment
CN109831673B (en) Live broadcast room data processing method, device, equipment and storage medium
CN115658438A (en) Log collection method and device
JP7375089B2 (en) Method, device, computer readable storage medium and computer program for determining voice response speed
CN115547330A (en) Information display method and device based on voice interaction and electronic equipment
CN115904805A (en) Data backup method and device, electronic equipment and storage medium
CN112910855B (en) Sample message processing method and device
CN113988954A (en) Financing product marketing method and device
CN110569424A (en) Information recommendation method and device
CN111063347B (en) Real-time voice recognition method, server and client
CN113672488A (en) Log text processing method and device
CN113761433A (en) Service processing method and device
CN111767435A (en) User behavior analysis method and device
US20150074125A1 (en) Managing content available for content prediction
CN112562688A (en) Voice transcription method, device, recording pen and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination