CN111092883A - Method and device for automatically generating user access record, network equipment and storage medium - Google Patents

Method and device for automatically generating user access record, network equipment and storage medium Download PDF

Info

Publication number
CN111092883A
CN111092883A CN201911291318.9A CN201911291318A CN111092883A CN 111092883 A CN111092883 A CN 111092883A CN 201911291318 A CN201911291318 A CN 201911291318A CN 111092883 A CN111092883 A CN 111092883A
Authority
CN
China
Prior art keywords
access
user
record
access request
data 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.)
Granted
Application number
CN201911291318.9A
Other languages
Chinese (zh)
Other versions
CN111092883B (en
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.)
Chongqing Ruiyun Technology Co ltd
Original Assignee
Chongqing Ruiyun Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Ruiyun Technology Co ltd filed Critical Chongqing Ruiyun Technology Co ltd
Priority to CN201911291318.9A priority Critical patent/CN111092883B/en
Publication of CN111092883A publication Critical patent/CN111092883A/en
Application granted granted Critical
Publication of CN111092883B publication Critical patent/CN111092883B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/30Network architectures or network communication protocols for network security for supporting lawful interception, monitoring or retaining of communications or communication related information

Abstract

The invention provides a method, a device, network equipment and a storage medium for automatically generating user access records, wherein the method comprises the steps of scanning swagger notes of an application to be monitored by a swagger unit in the running process of the application to be monitored to generate API interface data information; when an access request of a user to be monitored is received, an intercepting operation is carried out on the access request through a spring interceptor so as to record user access request information; acquiring API interface data information and user access request information, and generating an access record of an access user; the intrusiveness of a huge amount of monitoring codes is avoided, the monitoring target has clear directivity, and meanwhile, the monitoring data has detailed self-description content, so that great convenience is provided for reading and applying the data.

Description

Method and device for automatically generating user access record, network equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for automatically generating a user access record, a network device, and a storage medium.
Background
Under the environment of utilizing the spring framework to develop the javaweb, the application system needs to monitor the access condition of the API interface exposed to the outside, and performs targeted optimization on the key response slow interface according to the access condition, or provides a basis for interface data caching, or grasps a client distribution area according to the access condition of the API interface to formulate a targeted marketing service publicity policy, and is also helpful for positioning system abnormity. In the traditional monitoring method, a monitoring function is implanted into each interface method, or all requests are monitored through an interceptor (or called as a filter), wherein the former has huge code intrusiveness, and the latter monitors all requests, so that the problems of huge data, difficulty in highlighting, difficulty in storing and using and the like exist.
Disclosure of Invention
The invention provides a method, a device, network equipment and a storage medium for automatically generating user access records, which mainly solve the technical problems that: the monitoring function is implanted to have huge code intrusiveness, and the interceptors are used for intercepting the problems of massive data, difficulty in highlighting key points, difficulty in storage and use and the like.
In order to solve the above technical problem, the present invention provides an automatic generation method for a user access record, comprising:
scanning swagger annotations of the application to be monitored by using a swagger unit in the running process of the application to be monitored to generate API interface data information;
when an access request of a user to the application to be monitored is received, intercepting the access request through a spring interceptor so as to record user access request information;
and acquiring the API interface data information and the user access request information, and generating an access record of the access user.
Optionally, the API interface data information includes at least one of a document description, an interface meaning, an interface parameter, and an interface response requirement.
Optionally, the user access request information includes at least one of an access terminal IP address, an access timestamp, an access parameter, and an access response time.
Optionally, the acquiring the API interface data information includes: and acquiring the API interface data information by calling a getDocumentation () method of the Swagger2Controller object.
Optionally, after the obtaining of the API interface data information and the user access request information, and before the generating of the access record of the access user, the method further includes:
and comparing the access URL in the user access request information with the URL document in the API interface data information, and judging that the access URL exists in the URL document.
The invention also provides a device for automatically generating the user access record, which comprises:
the swagger unit is used for scanning swagger notes of the application to be monitored in the running process of the application to be monitored and generating API (application programming interface) data information;
the spring interceptor is used for intercepting the access request when receiving the access request of the user to the application to be monitored so as to record the access request information of the user;
and the record generating unit is used for acquiring the API interface data information and the user access request information and generating the access record of the access user.
Optionally, the API interface data information includes at least one of document description, interface meaning, interface parameter, and interface response requirement; the user access request information comprises at least one of an access terminal IP address, an access timestamp, an access parameter and an access response time.
Optionally, the record generating unit obtains and acquires the API interface data information by calling a getDocumentation () function of the Swagger2Controller object.
The invention also provides network equipment, which comprises a processor, a memory and a communication bus;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is configured to execute one or more programs stored in the memory to implement the steps of the automatic generation method of user access records as described in any one of the above.
The present invention also provides a storage medium storing one or more programs executable by one or more processors to implement the steps of the method for automatically generating a user access record as described in any one of the above.
The invention has the beneficial effects that:
according to the method, the device, the network equipment and the storage medium for automatically generating the user access record, the swagger annotation of the application to be monitored is scanned by the swagger unit in the running process of the application to be monitored, and API interface data information is generated; when an access request of a user to be monitored is received, an intercepting operation is carried out on the access request through a spring interceptor so as to record user access request information; acquiring API interface data information and user access request information, and generating an access record of an access user; the intrusiveness of a huge amount of monitoring codes is avoided, the monitoring target has clear directivity, and meanwhile, the monitoring data has detailed self-description content, so that great convenience is provided for reading and applying the data.
Drawings
Fig. 1 is a schematic flow chart of a method for automatically generating a user access record according to a first embodiment of the present invention;
fig. 2 is a schematic structural diagram of an automatic user access record generation device according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a network device according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail with reference to the following detailed description and accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The first embodiment is as follows:
in order to solve the problems that a huge amount of codes are invasive in implantation of a monitoring function, an interceptor is used for intercepting the huge amount of data, emphasis is difficult to highlight, storage and use are difficult, and the like, the embodiment provides an automatic generation method of user access records, which is based on swagger documents and uses a spring interceptor as a means to monitor the interface access condition, so that the invasion of huge amount of monitoring codes is avoided, a monitored target has clear directivity, the monitoring data has detailed self-description content, and great convenience is provided for reading and application of the data.
Referring to fig. 1, the method mainly includes the following steps:
s101, in the running process of the Application to be monitored, scanning the swagger annotation of the Application to be monitored by using a swagger unit, and generating API (Application Programming Interface) Interface data information.
The Swagger is a development framework for writing a standard code interface document and automatically generating a visual document structure, and can be conveniently integrated with java application for use.
Swagger generates the corresponding interface document by the following notes:
(1) @ Api (): marking the type as a type of document information to be acquired by the swagger;
(2) @ ApiOperation (): marking the method as a method for swagger to acquire document information;
(3) @ ApiParam (): and marking the parameter information on the method, and reading the marked parameter information by the swagger to generate the document.
In the embodiment, swagger annotation of the application to be monitored is scanned through the swagger unit, and API interface data information is acquired, wherein the API interface data information is a part of content indispensable for generating user access records. Wherein the API interface data information includes but is not limited to document description, interface meaning, interface parameter, interface response requirement. In addition, the swagger unit may also obtain information such as access URL (Uniform Resource Locator), access parameter, and the like.
S102, when receiving an access request of a user to the application to be monitored, intercepting the access request through a spring interceptor so as to record access request information of the user.
The user access request information includes but is not limited to an access terminal IP address, an access time stamp, an access parameter, and an access response time.
S103, obtaining API interface data information and user access request information, and generating an access record of the access user.
And acquiring the API interface data information by calling a getDocumentation () method of the Swagger2Controller object. The Swagger2Controller is a class in the Swagger framework and is used for providing Swagger document output information for the outside. Wherein, a getDocumentation () method is provided for outputting the document data information in the current project collected by swagger. By calling the getDocumentation () method in this class, a piece of visual interface data information can be constructed according to the information returned by the method.
Comparing the access URL in the user access request information with the URL document in the API interface data information, and judging whether the access URL exists in the URL document; if the access URL exists in the URL document, the access request is part of a normal document and needs to be recorded. If the access URL does not exist in the URL document, the URL document does not belong to normal access, and processing is not needed.
Through the swagger unit, information such as document description, interface meaning, interface parameters, interface response requirements and the like of an access request can be intuitively obtained, and a user access record with intuitive and detailed content can be generated by merging and warehousing the information and information such as a user access terminal IP, an access timestamp, access parameters, access response time and the like currently recorded by the spring interceptor.
According to the automatic generation method of the user access record, swagger annotation of the application to be monitored is scanned by the swagger unit in the running process of the application to be monitored, and API interface data information is generated; when an access request of a user to be monitored is received, an intercepting operation is carried out on the access request through a spring interceptor so as to record user access request information; acquiring API interface data information and user access request information, and generating an access record of an access user; the intrusiveness of a huge amount of monitoring codes is avoided, the monitoring target has clear directivity, and meanwhile, the monitoring data has detailed self-description content, so that great convenience is provided for reading and applying the data; such as facilitating targeted interface optimization, data caching, and formulating targeted marketing service campaign policies, locating system exceptions, etc.
Example two:
in this embodiment, on the basis of the first embodiment, an apparatus for automatically generating a user access record is provided, where the apparatus is mainly used to implement the steps of the method for automatically generating a user access record in the first embodiment, please refer to fig. 2, and the apparatus mainly includes:
and the swagger unit 21 is configured to scan swagger annotations of the application to be monitored in the running process of the application to be monitored, and generate API interface data information.
The API interface data information comprises at least one of document description, interface meaning, interface parameter and interface response requirement.
The spring interceptor 22 is configured to, when receiving an access request of a user to an application to be monitored, perform an interception operation on the access request to record user access request information.
The user access request information comprises at least one of an access terminal ip address, an access time stamp, an access parameter and an access response time.
And a record generating unit 23, configured to obtain the API interface data information and the user access request information, and generate an access record of the access user.
The record generating unit 23 acquires the acquisition API interface data information by calling the getDocumentation () function of the Swagger2Controller object.
The record generating unit 23 compares the access URL in the user access request information with the URL document in the API interface data information, and determines whether the access URL exists in the URL document; if the access URL exists in the URL document, the access request is part of a normal document and needs to be recorded. If the access URL does not exist in the URL document, the URL document does not belong to normal access, and processing is not needed.
Example three:
in this embodiment, on the basis of the first embodiment and/or the second embodiment, a network device is provided, please refer to fig. 3, which includes a processor 31, a memory 32 and a communication bus 33;
the communication bus 33 is used for realizing connection communication between the processor 31 and the memory 32;
the processor 31 is configured to execute one or more programs stored in the memory 32 to implement the steps of the automatic generation method of user access records as described in the first embodiment. Please refer to the description of the first embodiment, which is not repeated herein.
The present embodiment also provides a storage medium storing one or more programs, where the one or more programs are executable by one or more processors to implement the steps of the method for automatically generating a user access record as described in the first embodiment. Please refer to the description of the first embodiment, which is not repeated herein.
It will be apparent to those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and optionally they may be implemented in program code executable by a computing device, such that they may be stored on a computer storage medium (ROM/RAM, magnetic disks, optical disks) and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The foregoing is a more detailed description of the present invention that is presented in conjunction with specific embodiments, and the practice of the invention is not to be considered limited to those descriptions. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.

Claims (10)

1. A method for automatically generating a user access record is characterized by comprising the following steps:
scanning swagger annotations of the application to be monitored by using a swagger unit in the running process of the application to be monitored to generate API interface data information;
when an access request of a user to the application to be monitored is received, intercepting the access request through a spring interceptor so as to record user access request information;
and acquiring the API interface data information and the user access request information, and generating an access record of the access user.
2. The method of claim 1, wherein the API interface data information includes at least one of a document description, an interface meaning, an interface parameter, and an interface response requirement.
3. The method of claim 1, wherein the user access request information comprises at least one of an access terminal IP address, an access timestamp, an access parameter, and an access response time.
4. The method of automatically generating user access records according to any of claims 1-3, wherein said obtaining said API interface data information comprises: and acquiring the API interface data information by calling a getDocumentation () method of the Swagger2Controller object.
5. The method for automatically generating user access records according to any one of claims 1-3, further comprising, after said obtaining said API interface data information, and said user access request information, and before said generating said access record of said accessing user:
and comparing the access URL in the user access request information with the URL document in the API interface data information, and judging that the access URL exists in the URL document.
6. An apparatus for automatically generating a user access record, comprising:
the swagger unit is used for scanning swagger notes of the application to be monitored in the running process of the application to be monitored and generating API (application programming interface) data information;
the spring interceptor is used for intercepting the access request when receiving the access request of the user to the application to be monitored so as to record the access request information of the user;
and the record generating unit is used for acquiring the API interface data information and the user access request information and generating the access record of the access user.
7. The apparatus of claim 6, wherein the API interface data information includes at least one of a document description, an interface meaning, an interface parameter, an interface response requirement; the user access request information comprises at least one of an access terminal IP address, an access timestamp, an access parameter and an access response time.
8. The automatic generation apparatus of user access record according to claim 6, wherein the record generation unit acquires the API interface data information by calling getDocumentation () function of Swagger2Controller object.
9. A network device, comprising a processor, a memory, and a communication bus;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is configured to execute one or more programs stored in the memory to implement the steps of the method for automatic generation of a user access record according to any of claims 1 to 5.
10. A storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the steps of the method for automatic generation of a user access record according to any one of claims 1 to 5.
CN201911291318.9A 2019-12-16 2019-12-16 Method and device for automatically generating user access record, network equipment and storage medium Active CN111092883B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911291318.9A CN111092883B (en) 2019-12-16 2019-12-16 Method and device for automatically generating user access record, network equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911291318.9A CN111092883B (en) 2019-12-16 2019-12-16 Method and device for automatically generating user access record, network equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111092883A true CN111092883A (en) 2020-05-01
CN111092883B CN111092883B (en) 2022-08-19

Family

ID=70395752

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911291318.9A Active CN111092883B (en) 2019-12-16 2019-12-16 Method and device for automatically generating user access record, network equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111092883B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111708684A (en) * 2020-05-06 2020-09-25 苏宁云计算有限公司 Recording method and device for page access and computer system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104317570A (en) * 2014-09-29 2015-01-28 北京掌中经纬技术有限公司 Device and method for dynamically analyzing web application
CN105915546A (en) * 2016-06-16 2016-08-31 北京奇虎科技有限公司 Traffic monitoring method and device of android application
CN108959076A (en) * 2018-06-25 2018-12-07 浙江网新恒天软件有限公司 A kind of API on-line debugging method
CN109033280A (en) * 2018-07-11 2018-12-18 平安科技(深圳)有限公司 Blog search method, system, computer equipment and storage medium
CN109039937A (en) * 2018-09-26 2018-12-18 深圳壹账通智能科技有限公司 Dynamic current limiting method, apparatus, computer equipment and storage medium
US20190066694A1 (en) * 2017-08-31 2019-02-28 International Business Machines Corporation Generating chat bots from web api specifications
US10289462B1 (en) * 2016-03-14 2019-05-14 Jpmorgan Chase Bank, N.A. Systems and methods for integration of websphere optimized local adapters with the spring framework
CN109769010A (en) * 2018-12-04 2019-05-17 平安科技(深圳)有限公司 Method, apparatus, equipment and storage medium based on SDK access CloudStack server
CN109829287A (en) * 2018-11-20 2019-05-31 新疆福禄网络科技有限公司 Api interface permission access method, equipment, storage medium and device
CN110245060A (en) * 2019-05-20 2019-09-17 北京奇艺世纪科技有限公司 Service monitoring method and equipment, service monitoring device and medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104317570A (en) * 2014-09-29 2015-01-28 北京掌中经纬技术有限公司 Device and method for dynamically analyzing web application
US10289462B1 (en) * 2016-03-14 2019-05-14 Jpmorgan Chase Bank, N.A. Systems and methods for integration of websphere optimized local adapters with the spring framework
CN105915546A (en) * 2016-06-16 2016-08-31 北京奇虎科技有限公司 Traffic monitoring method and device of android application
US20190066694A1 (en) * 2017-08-31 2019-02-28 International Business Machines Corporation Generating chat bots from web api specifications
CN108959076A (en) * 2018-06-25 2018-12-07 浙江网新恒天软件有限公司 A kind of API on-line debugging method
CN109033280A (en) * 2018-07-11 2018-12-18 平安科技(深圳)有限公司 Blog search method, system, computer equipment and storage medium
CN109039937A (en) * 2018-09-26 2018-12-18 深圳壹账通智能科技有限公司 Dynamic current limiting method, apparatus, computer equipment and storage medium
CN109829287A (en) * 2018-11-20 2019-05-31 新疆福禄网络科技有限公司 Api interface permission access method, equipment, storage medium and device
CN109769010A (en) * 2018-12-04 2019-05-17 平安科技(深圳)有限公司 Method, apparatus, equipment and storage medium based on SDK access CloudStack server
CN110245060A (en) * 2019-05-20 2019-09-17 北京奇艺世纪科技有限公司 Service monitoring method and equipment, service monitoring device and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
骆文亮等: "基于.Net的System._ComObject类型辨析", 《信息技术》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111708684A (en) * 2020-05-06 2020-09-25 苏宁云计算有限公司 Recording method and device for page access and computer system
CN111708684B (en) * 2020-05-06 2022-11-15 苏宁云计算有限公司 Recording method and device for page access and computer system

Also Published As

Publication number Publication date
CN111092883B (en) 2022-08-19

Similar Documents

Publication Publication Date Title
US10447560B2 (en) Data leakage protection in cloud applications
CN108304704B (en) Authority control method and device, computer equipment and storage medium
CN108959430B (en) Advertisement promotion data acquisition method, device and equipment
CN109766253B (en) Performance data sending method and device, computer equipment and storage medium
US9870303B2 (en) Monitoring and correlating a binary process in a distributed business transaction
US20160323160A1 (en) Detection of node.js memory leaks
CN111984896A (en) Buried point data acquisition method and device, computer equipment and readable storage medium
CN111694795A (en) File online preview method, device, terminal and medium
WO2020233013A1 (en) Data processing method and device, and storage medium
CN115357761A (en) Link tracking method and device, electronic equipment and storage medium
CN111092883B (en) Method and device for automatically generating user access record, network equipment and storage medium
CN112306826A (en) Method and apparatus for processing information for terminal
CN110650126A (en) Method and device for preventing website traffic attack, intelligent terminal and storage medium
CN115934537A (en) Interface test tool generation method, device, equipment, medium and product
US20210342240A1 (en) Method, electronic device, and computer program product for monitoring storage system
CN112347066B (en) Log processing method and device, server and computer readable storage medium
CN113761433A (en) Service processing method and device
CN113779122A (en) Method and apparatus for exporting data
CN111124365A (en) RPA demand collection method and device
CN113055243B (en) DPI interface data processing method and device
CN112528330B (en) Log scanning method, device and equipment
CN113783835B (en) Password sharing method, device, equipment and storage medium
CN111695986B (en) Method and device for controlling accumulated gold image
CN109525630B (en) Method, apparatus, medium, and electronic device for transmitting data analysis request
CN105528298A (en) Safety testing method and device

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
GR01 Patent grant
GR01 Patent grant