A log processing method, apparatus, device, and storage medium

CN117454045BActive Publication Date: 2026-10-20CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311443275.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-01
Publication Date
2026-10-20
Estimated Expiration
2043-11-01

AI Technical Summary

Technical Problem

[0005]本申请提供一种日志的处理方法、装置、设备及存储介质,用以解决现有技术中由于使用canvas防止日志内容被抓取时,canvas对于IE9以下的版本不兼容,因此导致浏览器使用IE9以下版本时,无法避免日志内容被抓取从而盗取数据库中的数据问题,并且使用canvas并不能避免不法人员通过拷贝开发者工具控制台中的代码,从而将拷贝的代码还原为日志内容从而实现对于盗取数据库中数据的问题

Benefits of technology

[0038]本申请提供的一种日志的处理方法、装置、设备及存储介质,通过获取日志查看请求,并根据日志查看请求,显示预配置的日志窗体,并通过日志接口获取日志内容,然后采用SM2解密算法,对日志内容进行解密,获取解密后的日志内容,根据预配置的日志窗体的宽度和高度,分别计算获取预配置的日志窗体内的每行的字数,以及虚拟滚动可添加的最大条目数,然后根据预配置的日志窗体内的每行的字数,对解密后的日志内容进行逐行分割处理,获取多条目的日志数组,根据开始索引位置和最大条目数,从多条目的日志数组中获取第一待添加条目的日志数组,最后将第一待添加的条目的日志数组显示在预配置的日志窗体内,并将第一待添加的条目的日志数组对应的第一源代码添加至开发者的源文件中,相较于现有技术中通过canvas将日志内容逐屏渲染成图片形式来限制控制台对于页面显示的日志内容进行全量抓取时,由于canvas对于浏览器的版本有较高要求,进而导致对于浏览器使用IE9以下版本时依然会存在全量抓取日志内容从而盗取数据库中数据的情形,并且canvas并不能避免不法人员通过拷贝开发者工具控制台中的代码,从而将拷贝的代码还原为日志内容进而实现对于数据库中数据盗取的问题,本申请提供了一种兼容低版本浏览器的防止日志内容被全量抓取的方法,通过获取日志查看请求,并根据日志查看请求,显示预配置的日志窗体,并通过日志接口获取日志内容,采用SM2解密算法,对日志内容进行解密,获取解密后的日志内容,根据预配置的日志窗体的宽度和高度,分别计算获取预配置的日志窗体内的每行的字数,以及虚拟滚动可添加的最大条目数,根据预配置的日志窗体内的每行的字数,对解密后的日志内容进行逐行分割处理,获取多条目的日志数组,根据开始索引位置和最大条目数,从多条目的日志数组中获取第一待添加条目的日志数组,将第一待添加的条目的日志数组显示在预配置的日志窗体内,并将第一待添加的条目的日志数组对应的第一源代码添加至开发者的源文件中,通过动态添加日志内容到预配置的日志窗体中,从而保持在开发者源文件中只有对应预配置的日志窗体内的日志内容对应的源代码,从而避免了不法人员全量拷贝开发者控制台中的代码,将拷贝得到的代码还原为日志内容的可能性,从源文件上控制了数据被盗取的可能性,并且本申请通过监听日志窗体内的滚动事件,动态添加日志内容至日志窗体中,不受浏览器版本的限制,可以兼容所有版本的浏览器,以此解决了日志内容被全量抓取从而数据被盗取的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117454045B_ABST
    Figure CN117454045B_ABST
Patent Text Reader

Abstract

The application provides a log processing method, device and equipment and a storage medium. The method comprises the following steps: obtaining a log viewing request, displaying a log window according to the log viewing request, obtaining log content through a log interface, decrypting the log content by using an SM2 decryption algorithm, calculating the number of words of each line in the log window and the maximum number of items that can be added by virtual scrolling according to the width and height of the log window, performing row-by-row segmentation processing on the decrypted log content according to the number of words of each line in the log window, obtaining a log array with multiple items, obtaining a log array of a first to-be-added item from the log array with multiple items according to a start index position and the maximum number of items, displaying the log array of the first to-be-added item in a preconfigured log window, and adding first source code corresponding to the log array of the first to-be-added item to a source file of a developer, thereby solving the problem that log content is captured and data is stolen.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of preventing page content scraping, and in particular to a method, apparatus, device and storage medium for processing logs. Background Technology

[0002] For projects with log output, such as tenant management platforms, malicious actors can exploit vulnerabilities to package data from the tenant management platform's database, such as personal information, into the logs using illegal techniques. They can then view the log content via a web interface to steal data from the database. Additionally, some malicious actors can technically view the code in the developer tools' console, copy this code, and then reconstruct the log content to steal data from the database.

[0003] To prevent malicious actors from stealing data from the database through illegal technical means, the existing technology mainly adopts a canvas solution. Specifically, by using canvas to render the log content as an image screen by screen, the console is limited from fully capturing the log content displayed on the page.

[0004] However, existing canvas solutions have two main drawbacks: first, they have high browser version requirements and are incompatible with versions below IE9. In other words, when using browsers below IE9, there is still a possibility of illegally stealing data from the database. Second, they still cannot prevent malicious actors from using code in the developer tools console and restoring copied code to log content to steal data from the database. Therefore, there is an urgent need for a method to prevent log content from being captured in order to solve the problem of data theft. Summary of the Invention

[0005] This application provides a log processing method, apparatus, device, and storage medium to solve the problem in the prior art where, when using canvas to prevent log content from being crawled, canvas is incompatible with versions of IE9 and below. This results in the inability to prevent log content from being crawled and thus stealing data from the database when using browsers with versions of IE9 and below. Furthermore, using canvas cannot prevent malicious individuals from copying code from the developer tools console and then restoring the copied code to log content, thereby stealing data from the database.

[0006] Firstly, this application provides a log processing method, including:

[0007] Obtain a log viewing request, display a pre-configured log window based on the log viewing request, and obtain the log content through the log interface;

[0008] The log content is decrypted using the SM2 decryption algorithm to obtain the decrypted log content;

[0009] Based on the width and height of the pre-configured log window, calculate and obtain the number of characters in each line of the pre-configured log window, as well as the maximum number of entries that can be added via virtual scrolling;

[0010] Based on the number of characters in each line of the pre-configured log window, the decrypted log content is split line by line to obtain a log array with multiple entries.

[0011] Based on the starting index position and the maximum number of entries, obtain the log array of the first entry to be added from the log array of the multiple entries;

[0012] The log array of the first entry to be added is displayed in the pre-configured log window, and the first source code corresponding to the log array of the first entry to be added is added to the developer's source file.

[0013] In a preferred embodiment of the above-mentioned log processing method, the following are included:

[0014] When listening for scroll events within the pre-configured log window, update the starting index position, and based on the updated index position and the maximum number of entries, obtain the log array of the second entry to be added from the multi-entry log array;

[0015] The log array of the second entry to be added is displayed in the pre-configured log window, and the second source code corresponding to the log array of the second entry to be added is re-added to the developer's source file.

[0016] In a preferred embodiment of the above-mentioned log processing method, the step of calculating and obtaining the number of characters per line in the pre-configured log window and the maximum number of entries that can be added via virtual scrolling, based on the width and height of the pre-configured log window, includes:

[0017] Based on the width of the pre-configured log window and the font style size of the preset value, calculate and obtain the number of characters in each line of the pre-configured log window;

[0018] Based on the height of the pre-configured log window, calculate the maximum number of entries that can be added via virtual scrolling within the pre-configured log window.

[0019] In a preferred embodiment of the above-mentioned log processing method, the decrypted log content is segmented line by line according to the number of characters in each line of the pre-configured log window to obtain a multi-entry log array, packaged as follows:

[0020] Based on the number of characters in each line of the pre-configured log window, the decrypted log content is split line by line using the JavaScript split method to obtain a log array with multiple entries.

[0021] In a preferred embodiment of the above-mentioned log processing method, updating the starting index position when listening for and acquiring scroll events within the pre-configured log window includes:

[0022] When listening for scroll events within the pre-configured log window, the scroll direction and scroll bar position are obtained, and the start index bar position is updated based on the scroll direction, scroll bar position, and the height of each entry array.

[0023] In the preferred embodiment of the above-mentioned log processing method, it further includes:

[0024] During the display of the pre-configured log window, when a right-click operation request is detected, the operation processing corresponding to the right-click operation request is stopped.

[0025] In the preferred embodiment of the above-mentioned log processing method, it further includes:

[0026] After the pre-configured log window is closed, when a right-click operation request is detected, the operation corresponding to the right-click operation request is executed.

[0027] Secondly, this application provides a log processing apparatus, comprising:

[0028] The acquisition module is used to acquire log viewing requests, display a pre-configured log window based on the log viewing requests, and acquire log content through the log interface;

[0029] The acquisition module is also used to decrypt the log content using the SM2 decryption algorithm to obtain the decrypted log content;

[0030] The processing module is used to calculate and obtain the number of characters in each line of the pre-configured log window and the maximum number of entries that can be added by virtual scrolling, based on the width and height of the pre-configured log window.

[0031] The processing module is also used to perform line-by-line segmentation of the decrypted log content according to the number of words in each line of the pre-configured log window, and obtain a log array with multiple entries.

[0032] The processing module is further configured to obtain the log array of the first entry to be added from the log array of the multiple entries based on the starting index position and the maximum number of entries;

[0033] The processing module is further configured to display the log array of the first entry to be added in the pre-configured log window, and add the first source code corresponding to the log array of the first entry to be added to the developer's source file.

[0034] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0035] The memory stores computer-executed instructions;

[0036] The processor executes computer execution instructions stored in the memory to implement the method as described in any of the first aspects.

[0037] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any of the first aspects.

[0038] This application provides a log processing method, apparatus, device, and storage medium. The method involves obtaining a log viewing request, displaying a pre-configured log window based on the request, obtaining log content through a log interface, decrypting the log content using the SM2 decryption algorithm, obtaining the decrypted log content, calculating the number of characters per line in the pre-configured log window based on its width and height, and determining the maximum number of entries that can be added via virtual scrolling. Then, based on the number of characters per line in the pre-configured log window, the decrypted log content is segmented line by line to obtain a multi-entry log array. Finally, based on the starting index position and the maximum number of entries, the log array containing the first entry to be added is retrieved from the multi-entry log array. Finally, the log array of the first item to be added is displayed in the pre-configured log window, and the first source code corresponding to the log array of the first item to be added is added to the developer's source file. Compared with the existing technology that uses canvas to render the log content screen by screen as an image to limit the console from fully crawling the log content displayed on the page, canvas has high requirements for browser version. As a result, when using browsers below IE9, there is still a situation where the full log content can be crawled and data can be stolen from the database. Furthermore, canvas cannot prevent malicious personnel from copying the code in the developer tool console and restoring the copied code to log content to gain access to the database. To address the issue of log theft, this application provides a method compatible with older browsers to prevent full scraping of log content. The method involves obtaining log viewing requests, displaying a pre-configured log window based on these requests, retrieving log content via a log interface, decrypting the log content using the SM2 decryption algorithm, obtaining the decrypted log content, calculating the number of characters per line in the pre-configured log window based on its width and height, and determining the maximum number of entries that can be added via virtual scrolling. Based on the number of characters per line in the pre-configured log window, the decrypted log content is segmented line by line to obtain a multi-entry log array. Finally, based on the starting index and the maximum number of entries, the first entry to be added is retrieved from the multi-entry log array. The application dynamically adds log content to the pre-configured log window, displaying the log array of the first item to be added. It also adds the corresponding source code to the developer's source file. By dynamically adding log content to the pre-configured log window, the developer's source file only contains the source code corresponding to the log content in the pre-configured log window. This prevents malicious individuals from copying all code from the developer's console and reverting it to log content, thus controlling the possibility of data theft at the source file level. Furthermore, by listening to scroll events within the log window, the application dynamically adds log content, making it compatible with all browser versions.This solves the problem of data theft caused by the full scraping of log content. Attached Figure Description

[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0040] Figure 1 This is a flowchart illustrating a log processing method according to Embodiment 1 provided in this example.

[0041] Figure 2 This is a flowchart illustrating a second embodiment of a log processing method provided in this embodiment;

[0042] Figure 3 This is a flowchart illustrating a third embodiment of a log processing method provided in this embodiment;

[0043] Figure 4 This is a flowchart illustrating a fourth embodiment of a log processing method provided in this embodiment;

[0044] Figure 5 A flowchart to prevent the full log content from being crawled;

[0045] Figure 6 A schematic diagram of the structure of a log processing method according to an embodiment of this application;

[0046] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application.

[0047] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0048] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0049] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0050] Projects with log output, such as tenant management platforms, are vulnerable to malicious actors who use illegal techniques to package data from the tenant management platform's database into the logs. They then steal the log content to access the database. Currently, canvas solutions are used to prevent log content theft. However, canvas solutions are not compatible with browsers below IE9 and cannot prevent malicious actors from stealing data by copying code from the developer console.

[0051] Based on this, the inventive concept of this application lies in how to provide a new method to prevent the full crawling of page content, and in particular, it relates to a method to prevent the full crawling of log content.

[0052] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0053] Figure 1 This is a flowchart illustrating a log processing method according to Embodiment 1 provided in this example. Figure 1 As shown, the method includes the following steps:

[0054] Step S101: Obtain the log viewing request, display the pre-configured log form according to the log viewing request, and obtain the log content through the log interface.

[0055] In this embodiment, when the tenant management platform receives a log viewing request, it triggers the display of a pre-configured log window based on the request. This pre-configured log window has a pre-defined height and width to display the log content within that specified range. It's important to note that the tenant management platform is a multi-tenant system used to manage the data and permissions of different tenants. In this mode, a system can simultaneously provide services to multiple tenants, each with its own data and permission controls. The tenant management platform helps enterprises better manage the data and permissions of different tenants, improving system security and scalability.

[0056] In addition, the tenant management platform will also obtain the pre-displayed log content through the log interface when triggering the display of the pre-configured log window.

[0057] Step S102: Use the SM2 decryption algorithm to decrypt the log content and obtain the decrypted log content.

[0058] In this embodiment, the log content obtained from the log interface is encrypted using the SM2 encryption algorithm. Therefore, when attempting to steal this log content from the log interface, the obtained log content will be garbled. Based on this, by encrypting the log content using the SM2 encryption algorithm, the possibility of unauthorized personnel stealing log content through the log interface is effectively prevented. Therefore, after the tenant management platform obtains the log content from the log interface, it needs to use the SM2 decryption algorithm to decrypt the log content to obtain the decrypted log content.

[0059] Step S103: Based on the width and height of the pre-configured log window, calculate and obtain the number of characters in each line of the pre-configured log window, as well as the maximum number of entries that can be added by virtual scrolling.

[0060] In this embodiment, after the obtained log content is decrypted using the SM2 decryption algorithm, the decrypted log content is displayed on the pre-configured log window. The tenant management platform will calculate the number of log content characters displayed per line of the pre-configured log window based on the width of the pre-configured window, and calculate the maximum number of entries that the pre-configured log window can display based on the height of the log window. In other words, it will calculate the maximum number of lines of log content that the pre-configured log window can display based on the height of the pre-configured log window.

[0061] Step S104: Based on the number of characters in each line of the pre-configured log window, the decrypted log content is split line by line to obtain a log array with multiple entries.

[0062] In this embodiment, when calculating the number of characters in each line of the pre-configured log window, the tenant management platform will segment the log content decrypted by the SM2 decryption algorithm line by line according to the number of characters in each line of the pre-configured log window, so that each segmented log content is adapted to the width of the pre-configured log window. After segmenting the decrypted log content line by line, multiple log arrays adapted to the width of the pre-configured log window will be obtained.

[0063] Step S105: Based on the starting index position and the maximum number of entries, obtain the log array of the first entry to be added from the log array of multiple entries.

[0064] In this embodiment, when initially displaying the log content, the log array will be displayed starting from the first entry. Then, based on the maximum number of entries that the pre-configured log window can display (i.e., the maximum number of entries is the maximum number of log arrays that the pre-configured log window can display), the number of log array entries corresponding to the maximum number of entries is obtained from the log array obtained by segmenting the log content, which is the log array of the first entry to be added.

[0065] Step S106: Display the log array of the first entry to be added in the pre-configured log window, and add the first source code corresponding to the log array of the first entry to be added to the developer's source file.

[0066] In this embodiment, when the log content is initially displayed, the obtained log array of the first item to be added will be displayed in the pre-configured log window. At the same time, the first source code corresponding to the log array of the first item to be added will be added to the developer's source file.

[0067] In this embodiment, when a log viewing request is received, a pre-configured log window is displayed according to the request. Log content is obtained through the log interface, and the log content is decrypted using the SM2 decryption algorithm. The decrypted log content is obtained. Based on the width and height of the pre-configured log window, the number of characters per line in the pre-configured log window and the maximum number of entries that can be added via virtual scrolling are calculated. Based on the number of characters per line in the pre-configured log window, the decrypted log content is segmented line by line to obtain a log array of multiple entries. Based on the starting index position and the maximum number of entries, the log array of the first entry to be added is obtained from the log array of multiple entries. The log array of the first entry to be added is displayed in the pre-configured log window, and the first source code corresponding to the log array of the first entry to be added is added to the developer's source file. Compared to existing technologies that use canvas to render log content screen by screen as images to limit the console from fully capturing the log content displayed on the page, canvas has high browser version requirements and is not compatible with versions below IE9. Furthermore, using canvas cannot prevent malicious actors from using code in the developer tools console to copy code and restore it to log content to steal data from the database. This application listens for scroll events within the log window, calculates the number of characters per line in the pre-configured log window based on its width and height, and determines the maximum number of entries that can be added via virtual scrolling. Based on the pre-configured number of characters per line, the decrypted log content is segmented line by line to obtain a multi-entry log array, and then the array is processed according to the starting index position and... The maximum number of entries is determined by retrieving the log array of the first entry to be added from a multi-entry log array. This log array is then displayed in a pre-configured log window, and the corresponding source code is added to the developer's source file. By dynamically adding log content to the pre-configured log window, the developer's source file only contains the source code corresponding to the log content in the pre-configured log window. This prevents malicious individuals from copying all the code in the developer's console and reverting it to log content, thus controlling the possibility of data theft at the source file level. Furthermore, this application dynamically adds log content to the log window by listening to scroll events, making it compatible with all browser versions and thus solving the problem of full log content scraping.

[0068] Figure 2 This is a flowchart illustrating a second embodiment of a log processing method provided in this embodiment, as shown below. Figure 2 As shown, the method includes the following steps:

[0069] Step S201: When listening for scroll events in the pre-configured log window, update the start index position, and based on the updated index position and the maximum number of entries, retrieve the log array of the second entry to be added from the multi-entry log array.

[0070] In this embodiment, when a scroll event is detected within the pre-configured log window (optionally, the scroll event can be scrollTop), the updated index position is dynamically calculated based on the scroll event. Then, based on the updated index position and the maximum number of entries that the pre-configured log window can display, the log array corresponding to the index position is obtained from the log array obtained by segmenting the log content, which is used as the first log content within the pre-configured log window. The log content displayed after obtaining the first log content based on the maximum number of entries that the pre-configured log window can display is then displayed.

[0071] Step S202: Display the log array of the second entry to be added in the pre-configured log window, and re-add the second source code corresponding to the log array of the second entry to be added to the developer's source file.

[0072] In this embodiment, the acquired log content is displayed in a pre-configured log window, and the source code corresponding to this part of the log content is re-added to the developer's source file. When the second source code is added to the developer's source file, the first source code will no longer be displayed in the developer's source file.

[0073] In this embodiment, by listening for scroll events within the pre-configured log window, the starting index position is updated, and based on the updated index position and the maximum number of entries, the log array of the second entry to be added is obtained from the multi-entry log array. The scroll events within the pre-configured log window are listened for, and log content is dynamically added. Compared to canvas rendering log content screen-by-screen as an image, this application improves the rendering speed of the webpage and enhances the user experience. Then, the log array of the second entry to be added is displayed within the pre-configured log window, and the second source code corresponding to the log array of the second entry to be added is re-added to the developer's source file. This reduces the code obtainable from the source file in the console from tens of megabytes to tens of words, preventing unauthorized copying of the code in the developer's console and the possibility of restoring the copied code to log content.

[0074] Figure 3 This is a flowchart illustrating a third embodiment of a log processing method provided in this embodiment. Figure 1 Based on the illustrated embodiments, as Figure 3 As shown, one specific implementation of step S103 is as follows:

[0075] Step S301: Calculate and obtain the number of characters in each line of the pre-configured log window based on the width of the pre-configured log window and the font style size of the preset value.

[0076] Step S302: Calculate the maximum number of entries that can be added to the virtual scroll within the pre-configured log window based on the pre-configured log window height.

[0077] In this embodiment, the number of characters that can be displayed per line in the log window varies depending on the width and font size of the pre-configured log window. Here, the number of characters that can be displayed per line in the pre-configured log window can be calculated by determining the width of the pre-configured log window and the preset font size. By calculating Math.ceil(viewHeight / height per line) using the height (viewHeight) of the pre-configured log window, the maximum number of entries that can be added by virtual scrolling in the pre-configured log window can be obtained. In other words, the maximum number of log arrays that the pre-configured log window can display can be calculated.

[0078] Furthermore, in order to obtain an array of logs that fit the width of the log window, in the above... Figure 1 or Figure 3 Based on the illustrated embodiment, one specific implementation of step S104 is as follows:

[0079] Based on the number of characters in each line of the pre-configured log window, the JavaScript split method is used to split the decrypted log content line by line to obtain a log array with multiple entries.

[0080] Furthermore, in the above Figure 2 Based on the illustrated embodiment, the specific operation method for updating the start index position in step S201 when listening for and obtaining scroll events within the pre-configured log window is as follows:

[0081] When listening for scroll events within the pre-configured log window, obtain the scroll direction and scroll bar position, and update the start index bar position based on the scroll direction, scroll bar position, and the height of each entry array.

[0082] In this embodiment, the scroll events within the pre-configured log window are listened to. The optional scroll event can be the scrollTop event. The position of the scroll bar is determined by listening to the offset. Based on the scroll direction, the position of the scroll bar, and the height of each array of entries, the current index position is determined by calculating Math.floor(scrollTop / height of each array of entries).

[0083] Optionally, if the displayed log content is too large and the front-end container cannot hold all the log content, a maximum request volume can be set for the requested log content. By displaying the log content in batches, when the scroll bar reaches the bottom (i.e., the detected offset is equal to the height of the pre-configured log window), the tenant management platform will request the log interface to receive the next batch of log content and repeat the steps of the above embodiment to dynamically display the log content in the pre-configured log window. According to the preset volume size, the interface log content is dynamically requested, making the interface loading speed faster and effectively preventing the browser from displaying a white screen. At the same time, compared with canvas rendering log content screen by screen as an image, which takes a long time to load, this application renders it as text dynamically, so that the user experience is not affected when the network environment is poor.

[0084] Figure 4 This is a flowchart illustrating a log processing method according to Embodiment 4, which is based on the above embodiments, such as... Figure 4 As shown, the method may further include the following steps:

[0085] Step S401: During the process of displaying the pre-configured log window, when a right-click operation request is detected, stop executing the operation processing corresponding to the right-click operation request.

[0086] In this embodiment, when the pre-configured log window is displayed, the tenant management platform monitors right-click operation requests within the window. When a right-click operation request is detected, including operations such as copy and cut, the tenant management platform will stop executing the operation corresponding to the right-click operation request. Optionally, the copy and cut functions on the keyboard will also be monitored and disabled.

[0087] By monitoring right-click operation requests and then prohibiting the execution of the corresponding operation processing, the full scraping of log content by most ordinary users can be avoided.

[0088] Furthermore, based on the above embodiments, the method may further include:

[0089] Step S402: After the pre-configured log window is closed, when a right-click operation request is detected, perform the operation processing corresponding to the right-click operation request.

[0090] In this embodiment, when the tenant management platform detects that the pre-configured log window is closed, it destroys the operation processing corresponding to the right-click operation request that is prohibited from being executed. That is, it executes the operation processing corresponding to the right-click operation request. The purpose is not to affect the interaction events of the outer window, that is, the interaction events of the window outside the pre-configured log window.

[0091] Based on the above embodiments, for example, Figure 5 A flowchart to prevent the full log content from being crawled. (Example) Figure 5 Specifically, when the tenant management platform receives a log viewing request, it triggers the log retrieval interface based on the request and retrieves the SM2-encrypted log content from the interface. After retrieving the SM2-encrypted log content, it decrypts it using SM2 decryption to obtain the decrypted log content, thus preventing malicious individuals from stealing log content from the log interface. Upon receiving a log viewing request, the tenant management platform also initializes the log window, disabling copy and right-click operations to prevent most ordinary users from fully capturing the log content. When initializing the log window, the number of characters per line in the log window is calculated based on the window width. The decrypted log content is then divided into arrays based on the maximum number of characters per line in the log window. The maximum number of items that can be added via virtual scrolling is calculated based on the window height. This allows the system to obtain the maximum number of initial content items. By listening to the scrolling area, the system dynamically calculates the start index and offset of the log window's rendering nodes to re-trigger the rendering of nodes and replace content items. This prevents malicious individuals from copying the code in the developer console to obtain the log content. Finally, after the log is viewed, the window's event listeners are destroyed to ensure that the interactive events of the outer window are not affected.

[0092] Figure 6 This is a schematic diagram illustrating the structure of an embodiment of a log processing method provided in this application. Figure 6 As shown, the device includes an acquisition module 61 and a processing module 62. The acquisition module 61 acquires log viewing requests, displays a pre-configured log window based on the requests, and acquires log content through a log interface. The acquisition module 61 also decrypts the log content using the SM2 decryption algorithm to acquire the decrypted log content. The processing module 62 calculates the number of characters per line in the pre-configured log window and the maximum number of entries that can be added via virtual scrolling, based on the width and height of the pre-configured log window. The processing module 62 further segments the decrypted log content line by line based on the number of characters per line in the pre-configured log window to acquire a multi-entry log array. The processing module 62 also acquires the log array of the first entry to be added from the multi-entry log array based on the starting index position and the maximum number of entries. Finally, the processing module 62 displays the log array of the first entry to be added in the pre-configured log window and adds the first source code corresponding to the log array of the first entry to be added to the developer's source file.

[0093] A log processing device in this embodiment can be repositioned to perform the above-described... Figures 1 to 4The implementation principles and effects of any of the method embodiments are similar, and will not be described in detail here.

[0094] Figure 7 This is a schematic diagram illustrating the structure of an electronic device according to an embodiment of this application. See also... Figure 7 The electronic device provided in this embodiment includes at least one processor 71 and a memory 72. The processor 71 and the memory 72 are connected via a bus 73.

[0095] The specific implementation process of processor 71 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0096] In the above Figure 7 In the illustrated embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0097] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0098] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0099] This application also provides a computer-readable storage medium storing computer-executable instructions thereon, which, when executed by a processor, implements the log processing method described above.

[0100] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The computer-readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0101] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0102] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0103] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0104] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0105] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0106] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.

[0107] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0108] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.

[0109] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.

[0110] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.

[0111] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0112] In the above embodiments, the descriptions of each embodiment have their own emphasis. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as these combinations of technical features do not contradict each other, they should be considered within the scope of this specification.

[0113] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0114] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A log processing method, characterized in that, Includes the following steps: Obtain a log viewing request, display a pre-configured log window based on the log viewing request, and obtain the log content through the log interface; The log content is decrypted using the SM2 decryption algorithm to obtain the decrypted log content; Based on the width and height of the pre-configured log window, calculate and obtain the number of characters in each line of the pre-configured log window, as well as the maximum number of entries that can be added via virtual scrolling; Based on the number of characters in each line of the pre-configured log window, the decrypted log content is split line by line to obtain a log array with multiple entries. Based on the starting index position and the maximum number of entries, obtain the log array of the first entry to be added from the log array of the multiple entries; Display the log array of the first entry to be added in the pre-configured log window, and add the first source code corresponding to the log array of the first entry to be added to the developer's source file; The method further includes: when listening for scroll events in the pre-configured log window, obtaining the scroll direction and scroll bar position, updating the start index position according to the scroll direction, scroll bar position, and height of each entry array, and obtaining the log array of the second entry to be added from the multi-entry log array according to the updated index position and the maximum number of entries; displaying the log array of the second entry to be added in the pre-configured log window, and re-adding the second source code corresponding to the log array of the second entry to be added to the developer's source file.

2. The method according to claim 1, characterized in that, The step of calculating and obtaining the number of characters per line in the pre-configured log window and the maximum number of entries that can be added via virtual scrolling, based on the width and height of the pre-configured log window, includes: Based on the width of the pre-configured log window and the font style size of the preset value, calculate and obtain the number of characters in each line of the pre-configured log window; Based on the height of the pre-configured log window, calculate the maximum number of entries that can be added via virtual scrolling within the pre-configured log window.

3. The method according to claim 1, characterized in that, The step involves segmenting the decrypted log content line by line based on the number of characters in each line of the pre-configured log window to obtain a multi-entry log array, including: Based on the number of characters in each line of the pre-configured log window, the decrypted log content is split line by line using the JavaScript split method to obtain a log array with multiple entries.

4. The method according to any one of claims 1 to 3, characterized in that, Also includes: During the display of the pre-configured log window, when a right-click operation request is detected, the operation processing corresponding to the right-click operation request is stopped.

5. The method according to claim 4, characterized in that, Also includes: After the pre-configured log window is closed, when a right-click operation request is detected, the operation corresponding to the right-click operation request is executed.

6. A log processing device, characterized in that, include: The acquisition module is used to acquire log viewing requests, display a pre-configured log window based on the log viewing requests, and acquire log content through the log interface; The acquisition module is also used to decrypt the log content using the SM2 decryption algorithm to obtain the decrypted log content; The processing module is used to calculate and obtain the number of characters in each line of the pre-configured log window and the maximum number of entries that can be added by virtual scrolling, based on the width and height of the pre-configured log window. The processing module is also used to perform line-by-line segmentation of the decrypted log content according to the number of words in each line of the pre-configured log window, and obtain a log array with multiple entries. The processing module is further configured to obtain the log array of the first entry to be added from the log array of the multiple entries based on the starting index position and the maximum number of entries; The processing module is also used to display the log array of the first entry to be added in the pre-configured log window, and to add the first source code corresponding to the log array of the first entry to be added to the developer's source file; The processing module is further configured to, when listening for scroll events in the pre-configured log window, obtain the scroll direction and scroll bar position, update the start index position based on the scroll direction, scroll bar position, and height of each entry array, and obtain the log array of the second entry to be added from the multi-entry log array based on the updated index position and the maximum number of entries; display the log array of the second entry to be added in the pre-configured log window, and re-add the second source code corresponding to the log array of the second entry to be added to the developer's source file.

7. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Network data package encryption method and apparatus

    CN106407818A

  • Log processing method, device and system

    CN116846742A