Disclosure of Invention
The embodiment of the invention aims to provide a method, a device and a medium for processing log information based on a B/S framework.
In order to achieve the above object, an embodiment of the present invention provides a log information processing method based on a B/S architecture, which is executed by an edge computing component mounted on a browser, and the method includes:
acquiring error log information generated by a current browser in the operation process of responding to a target client application; wherein the edge computing component is in the same domain name as the target client application;
and converting the error log information into a first character string in a binary data format, and storing the first character string in a preset front-end browser database.
As an improvement of the above solution, after the converting the error log information into a first character string in a binary data format and storing the first character string in a preset front-end browser database, the method further includes:
judging whether the first character string has preset keyword information or not;
and if the first character string has preset keyword information, sending error log information corresponding to the first character string to a back-end server.
As an improvement of the above scheme, the determining whether the first character string has preset keyword information specifically includes:
dividing the first character string into at least one second character string with a preset byte size;
sequentially acquiring each second character string, and storing the currently acquired second character string in a preset cache region; the storage capacity of the cache region is the size of the preset bytes;
and judging whether the first character string has preset keyword information or not according to whether the second character string stored in the cache region has the preset keyword information or not.
As an improvement of the above scheme, the determining whether the first character string has preset keyword information according to whether the second character string stored in the current cache region has preset keyword information specifically includes:
converting the second character string stored in the current cache region into character information with the same format as the preset keyword information;
comparing the character information with the preset keyword information, and judging whether the second character string has the preset keyword information;
if yes, judging that the first character string has preset keyword information; if not, judging that the first character string does not have preset keyword information.
As an improvement of the above scheme, after the determining whether the first character string has the preset keyword information according to whether the second character string stored in the current cache region has the preset keyword information, the method further includes:
and clearing the second character string stored in the cache region at present.
The embodiment of the invention also provides a log information processing device based on the B/S architecture, which is configured to be mounted on an edge computing component on a browser, and the device comprises:
the log information acquisition module is used for acquiring error report log information generated by the current browser in the operation process of responding to the target client application; wherein the edge computing component is in the same domain name as the target client application;
and the log information conversion module is used for converting the error reporting log information into a first character string in a binary data format and storing the first character string in a preset front-end browser database.
As an improvement of the above, the apparatus further comprises:
the keyword information judging module is used for judging whether the first character string has preset keyword information or not;
and the log information sending module is used for sending the error report log information corresponding to the first character string to a back-end server if the first character string has preset keyword information.
As an improvement of the above scheme, the keyword information determination module specifically includes:
the character string dividing unit is used for dividing the first character string into at least one second character string with a preset byte size;
the character string acquisition unit is used for sequentially acquiring each second character string and storing the currently acquired second character string in a preset cache region; the storage capacity of the cache region is the size of the preset bytes;
and the keyword information judging unit is used for judging whether the first character string has preset keyword information or not according to whether the second character string stored in the current cache region has the preset keyword information or not.
As an improvement of the foregoing solution, the keyword information determination unit is specifically configured to:
converting the second character string stored in the current cache region into character information with the same format as the preset keyword information;
comparing the character information with the preset keyword information, and judging whether the second character string has the preset keyword information;
if yes, judging that the first character string has preset keyword information; if not, judging that the first character string does not have preset keyword information.
As an improvement of the above scheme, the keyword information determination module further includes:
and the character string clearing unit is used for clearing the second character string stored in the cache region at present after judging whether the first character string has the preset keyword information or not according to whether the second character string stored in the cache region at present has the preset keyword information or not.
The embodiment of the invention provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program runs, a device where the computer-readable storage medium is located is controlled to execute any one of the above log information processing methods based on the B/S architecture.
Compared with the prior art, the log information processing method, device and medium based on the B/S architecture are disclosed by the embodiment of the invention. By mounting an edge computing component on a browser, the edge computing component is in the same domain name as the target client application. Further, error log information generated by the current browser in the process of responding to the operation of the target client application is obtained through the edge computing component; and converting the error log information into a first character string in a binary data format, and storing the first character string in a preset front-end browser database. By adopting the technical means of the embodiment of the invention, the error log information provided in the interface opened by the browser is monitored in real time through the edge computing component mounted on the browser, so that the automatic collection and storage of the error log information at the front end are realized, the acquisition and analysis of the back-end server are facilitated, the pertinence of the back-end server for acquiring the log information is effectively improved, and the data processing capacity of the back-end server is reduced; and moreover, the error log information is converted into a binary data format for storage, so that the data storage capacity can be effectively reduced, and the storage space is saved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flowchart of a log information processing method based on a B/S architecture according to an embodiment of the present invention. The embodiment of the invention provides a log information processing method based on a B/S architecture, which is executed by an edge computing component mounted on a browser, and is specifically executed through steps S11 to S12:
s11, acquiring error log information generated by the current browser in the operation process of responding to the target client application; wherein the edge computing component is in the same domain name as the target client application;
and S12, converting the error log information into a first character string in a binary data format, and storing the first character string in a preset front-end browser database.
It should be noted that the target client application in the embodiment of the present invention is an application program that adopts a browser/server architecture, for example, an application program that needs to provide a presentation and search page for a user through a browser, or an external application program that runs a web page link and a two-dimensional code in an application program and is opened through a browser.
For example, when a user opens a link in an application, the browser, in response to the client operation, jumps to a webpage on which the user has clicked and displays the webpage to the user. Meanwhile, after responding to the client operation, the operation information, including description of relevant operations such as date, time, user and action, is recorded and log information is formed.
In the embodiment of the present invention, referring to fig. 2, a schematic diagram of a method for executing log processing by an edge computing component in the embodiment of the present invention is shown. And mounting a preset edge computing component on the browser in the form of code development and the like, and executing the log information processing method based on the B/S architecture. When a user opens the application program in the same first-level domain name or any external third-party application program under the application program, the browser can respond to the service operation of the application program in the same first-level domain name and form log information, and error log information about all the application programs in the same first-level domain name, which is provided in an interface opened by the browser, can be monitored in real time through the edge computing component. After the error reporting log information is obtained, converting the error reporting log information into a first character string in a binary data format, and storing the first character string in a preset front-end browser database, so that a worker can conveniently obtain the error reporting log information from the front-end browser database in a subsequent process for analysis.
The embodiment of the invention provides a log information processing method based on a B/S (browser/server) architecture. Further, error log information generated by the current browser in the process of responding to the operation of the target client application is obtained through the edge computing component; and converting the error log information into a first character string in a binary data format, and storing the first character string in a preset front-end browser database. By adopting the technical means of the embodiment of the invention, the error log information provided in the interface opened by the browser is monitored in real time through the edge computing component mounted on the browser, so that the automatic collection and storage of the error log information at the front end are realized, the acquisition and analysis of the back-end server are facilitated, the pertinence of the back-end server for acquiring the log information is effectively improved, and the data processing capacity of the back-end server is reduced; and moreover, the error log information is converted into a binary data format for storage, so that the data storage capacity can be effectively reduced, and the storage space is saved.
As a preferred implementation, referring to fig. 1 and 2, the embodiment of the present invention is further implemented on the basis of the above embodiment, and after step S12, the method further includes steps S13 to S14:
s13, judging whether the first character string has preset keyword information or not;
and S14, if the first character string has preset keyword information, sending error log information corresponding to the first character string to a back-end server.
In the embodiment of the invention, whether the first character string has the preset keyword information is judged by acquiring the first character string in the front-end browser database, if the first character string contains the preset keyword information, the corresponding error log information is shown to be in accordance with the uploading condition, and the error log information is sent to the back-end server for analysis processing.
Optionally, after analyzing that the first character string has the keyword information, sending corresponding error log information to a backend server through a gateway device.
The preset keyword information may be defined according to the actual use requirement of the user. As an example, the preset keyword information is set according to common error content of the application program in the running process, and further, when it is determined that the keyword information is included in the first character string, it indicates that the error report log information corresponding to the first character string includes specific error content occurring in the running process of the application program, and the log information corresponding to the first character string is uploaded to the back-end server.
The back-end server is a preset client log center, and the log center can quickly position the error content of the application program in the operation process according to the received log information, and timely solve and repair the problems of self-development application or third-party application in different types and different service platforms.
By adopting the technical means of the embodiment of the invention, the error-reporting log information provided in the interface opened by the browser is monitored in real time and analyzed through the edge computing component mounted on the browser, and the error-reporting log information containing the keyword information is uploaded to the back-end server in time, so that the back-end server can realize the quick positioning of the specific error-reporting log information, and the problems of the application program in the operation process are analyzed and solved. Compared with the prior art that all log information generated by the browser is directly uploaded to the background for analysis, the method and the device for analyzing the log information can effectively reduce time consumption in the process of collecting the log by the background server, reduce resources occupied in the process of uploading the log, and reduce data processing amount of the back-end server.
As a preferred embodiment, the present invention is further practiced on the basis of the above example. Fig. 3 is a schematic flow chart of determining keyword information according to an embodiment of the present invention. Step S13, namely, the step of determining whether the first character string has the preset keyword information, specifically includes steps S131 to S133:
s131, dividing the first character string into at least one second character string with a preset byte size;
s132, sequentially acquiring each second character string, and storing the currently acquired second character string in a preset cache region; the storage capacity of the cache region is the size of the preset bytes;
s133, judging whether the first character string has preset keyword information or not according to whether the second character string stored in the current cache region has the preset keyword information or not.
In the embodiment of the invention, a cache area with the storage capacity of the preset byte size is preset to realize temporary storage of the second character string with the preset byte size and key word information analysis.
Specifically, the edge calculation component cuts and reads a first character string stored in the front-end browser database by taking the size of the preset byte as a unit, so that the first character string is divided into at least one second character string with the size of the preset byte, the currently acquired second character string is stored in the cache region, and whether the second character string stored in the cache region has preset keyword information or not is judged, so that whether the first character string has the preset keyword information or not is judged.
Preferably, step S133 specifically includes:
converting the second character string stored in the current cache region into character information with the same format as the preset keyword information; comparing the character information with the preset keyword information, and judging whether the second character string has the preset keyword information; if yes, judging that the first character string has preset keyword information; if not, judging that the first character string does not have preset keyword information.
Preferably, after step S133, the method further comprises step S134:
and S134, clearing the second character string stored in the cache region at present.
Specifically, after storing the currently acquired second character string in a preset cache region and judging whether preset keyword information exists, the second character string stored in the cache region is cleared, so that when it is judged that the current second character string does not have the keyword information, the next second character string can be timely acquired and stored in the cache region, and whether the preset keyword information exists is continuously analyzed.
By adopting the technical means of the embodiment of the invention, on one hand, the first character string is divided into a plurality of second character strings with smaller bytes for analyzing whether the preset keyword information exists, and once the keyword information exists in the currently acquired second character string, the keyword information of the first character string is judged, so that the data transmission amount and the calculated amount can be effectively saved to a certain extent; on the other hand, the first character string is cut into blocks and analyzed by constructing a cache region with a certain storage capacity, after whether the second character string currently stored in the cache region has keyword information is judged, the cache region is released in time, and then the next second character string is continuously obtained for analysis, so that the situation that a plurality of storage regions are created, too much storage space is occupied, and space resources are wasted can be avoided.
Fig. 4 is a schematic structural diagram of a log information processing apparatus based on a B/S architecture according to an embodiment of the present invention. The embodiment of the present invention provides a log information processing apparatus 20 based on a B/S architecture, configured as an edge computing component mounted on a browser, including: a log information reading module 21 and a log information conversion module 22.
The log information reading module 21 is configured to obtain error log information generated by the current browser in the process of responding to the target client application operation; wherein the edge computing component is in the same domain name as the target client application;
the log information conversion module 22 is configured to convert the error log information into a first character string in a binary data format, and store the first character string in a preset front-end browser database.
It should be noted that, in the embodiment of the present invention, the target client application is an application program that adopts a browser/server architecture, for example, an application program that needs to provide a presentation and search page for a user through a browser, or an application program that opens a web page link or a two-dimensional code running in the application program through the browser.
In the embodiment of the invention, the preset edge computing component is mounted on the browser in the form of code development and the like. When a user opens the application program in the same first-level domain name or any external third-party application program under the application program, the browser can respond to the service operation of the application program in the same first-level domain name and form log information, and the log information reading module monitors error log information about all the application programs in the same first-level domain name, which is provided in an open interface of the browser, in real time. After the error reporting log information is obtained, the log information conversion module converts the error reporting log information into a first character string in a binary data format, and stores the first character string in a preset front-end browser database, so that a worker can conveniently obtain the error reporting log information from the front-end browser database in a subsequent process for analysis.
The embodiment of the invention provides a log information processing device based on a B/S (browser/server) architecture, which is configured as an edge computing component mounted on a browser, wherein the edge computing component and a target client application are in the same domain name. Further, error log information generated by the current browser in the process of responding to the operation of the target client application is obtained through the edge computing component; and converting the error log information into a first character string in a binary data format, and storing the first character string in a preset front-end browser database. By adopting the technical means of the embodiment of the invention, the error log information provided in the interface opened by the browser is monitored in real time through the edge computing component mounted on the browser, so that the automatic collection and storage of the error log information at the front end are realized, the acquisition and analysis of the back-end server are facilitated, the pertinence of the back-end server for acquiring the log information is effectively improved, and the data processing capacity of the back-end server is reduced; and moreover, the error log information is converted into a binary data format for storage, so that the data storage capacity can be effectively reduced, and the storage space is saved.
As a preferred embodiment, the log information processing device 20 based on the B/S architecture further includes a keyword information determination module 23 and a log information transmission module 24.
The keyword information determining module 23 is configured to determine whether the first character string has preset keyword information;
the log information sending module 24 is configured to send error log information corresponding to the first character string to a back-end server if the first character string has preset keyword information.
In the embodiment of the present invention, the keyword information determining module 23 obtains the first character string in the front-end browser database, determines whether the first character string has preset keyword information, and if the first character string contains preset keyword information, it indicates that the corresponding error log information meets the uploading condition, and the log information sending module 24 sends the error log information to the back-end server for analysis processing.
The preset keyword information may be defined according to the actual use requirement of the user. As an example, the preset keyword information is set according to common error content of an application program in the running process, and further, when it is determined that the first character string includes the keyword information, it is indicated that error report log information corresponding to the first character string includes error content occurring in the running process of the application program, the error report log information corresponding to the first character string is uploaded to a back-end server, so that the back-end server can quickly locate the error content in the running process of the application program, and problems occurring in different models and different service platforms of the application program are timely solved and repaired.
By adopting the technical means of the embodiment of the invention, the error-reporting log information provided in the interface opened by the browser is monitored in real time and analyzed through the edge computing component mounted on the browser, and the error-reporting log information containing the keyword information is uploaded to the back-end server in time, so that the back-end server can realize the quick positioning of the specific error-reporting log information, and the problems of the application program in the operation process are analyzed and solved. Compared with the prior art that all log information generated by the browser is directly uploaded to the background for analysis, the method and the device for analyzing the log information can effectively reduce time consumption in the process of collecting the log by the background server, reduce resources occupied in the process of uploading the log, and reduce data processing amount of the back-end server.
As a preferred embodiment, refer to fig. 5, which is a schematic structural diagram of a keyword information determination module in an embodiment of the present invention. The keyword information determining module 23 specifically includes:
a character string dividing unit 231 configured to divide the first character string into at least one second character string of a preset byte size;
a character string obtaining unit 232, configured to sequentially obtain each second character string, and store the currently obtained second character string in a preset cache region; the storage capacity of the cache region is the size of the preset bytes;
a keyword information determining unit 233, configured to determine whether the first character string has preset keyword information according to whether the second character string currently stored in the cache region has preset keyword information.
In the embodiment of the invention, a cache area with the storage capacity of the preset byte size is preset to realize temporary storage of the second character string with the preset byte size and key word information analysis.
Specifically, a first character string stored in the front-end browser database is cut and read by taking the preset byte size as a unit, so that the first character string is divided into at least one second character string with the preset byte size. And storing the currently acquired second character string in the cache region, and judging whether the second character string stored in the cache region has preset keyword information or not, so as to judge whether the first character string has the preset keyword information or not.
Preferably, the keyword information determining unit 233 is specifically configured to:
converting the second character string stored in the current cache region into character information with the same format as the preset keyword information; comparing the character information with the preset keyword information, and judging whether the second character string has the preset keyword information; if yes, judging that the first character string has preset keyword information; if not, judging that the first character string does not have preset keyword information.
Preferably, the keyword information determining module 23 further includes:
the character string clearing unit 234 is configured to clear the second character string currently stored in the cache region after determining whether the first character string has the preset keyword information according to whether the second character string currently stored in the cache region has the preset keyword information.
By adopting the technical means of the embodiment of the invention, on one hand, the first character string is divided into a plurality of second character strings with smaller bytes for analyzing whether the preset keyword information exists, and once the keyword information exists in the currently acquired second character string, the keyword information of the first character string is judged, so that the data transmission amount and the calculated amount can be effectively saved to a certain extent; on the other hand, the first character string is cut into blocks and analyzed by constructing a cache region with a certain storage capacity, after whether the second character string currently stored in the cache region has keyword information is judged, the cache region is released in time, and then the next second character string is continuously obtained for analysis, so that the situation that a plurality of storage regions are created, too much storage space is occupied, and space resources are wasted can be avoided.
It should be noted that, the log information processing apparatus based on the B/S architecture provided in the embodiment of the present invention is configured to execute all the process steps of the log information processing method based on the B/S architecture in the foregoing embodiment, and the working principles and beneficial effects of the two are in one-to-one correspondence, and thus are not described again.
As a preferred implementation manner, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the log information processing method based on the B/S architecture according to the foregoing embodiment.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-only memory (ROM), a Random Access Memory (RAM), or the like.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.