Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

A logging method based on openresty

A recording method and log technology, which is applied in the field of information security, can solve problems such as log loss, large number of log files, and cumbersome deduplication, and achieve the effect of alleviating disk pressure and improving server performance

Active Publication Date: 2021-08-06
SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] The purpose of the present invention is to provide a log recording method based on openresty, which is used to solve the problem that enterprise-level servers in the prior art have tens of thousands of visits per day, and the number of log files generated by the server every day is large. For servers with small hard drives It is likely to fill up the disk, resulting in the loss of subsequent logs, and the cumbersome problem of deduplication

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A logging method based on openresty
  • A logging method based on openresty
  • A logging method based on openresty

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0025] combined with figure 1 As shown, a logging method based on openresty, the method includes the following steps:

[0026] Step 1: Define a custom-named memory space in the shared memory API in openresty, define the memory size according to your needs, call the timer through the timer interface of openresty, and set 1s when storing data in the shared memory Expiration time, set the timer to read data from the shared memory every second;

[0027] Step 2: When the processing of the first request reaches the logging stage, according to the defined log format, all the fields to be recorded will be obtained by the built-in variables of Nginx, and all the fields to be recorded will be spliced ​​into a string in the form of key-value;

[0028] Step 3: Use the string obtained in step 2 as the index, and the number of records as value, and store the key-value pair in the shared memory defined in step 1;

[0029] Step 4: When the subsequent request comes, generate the index key va...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses an openresty-based log recording method, which relates to the technical field of information security. The method includes step 1: defining a memory space with a custom name in the shared memory API in openresty, and the memory size is defined according to requirements; Step 2: When the processing of the first request reaches the log record stage, according to the defined log format, all the fields to be recorded are obtained by Nginx built-in variables, and all the fields to be recorded are concatenated into strings in the form of key-value; Step 3: Use the string obtained in Step 2 as the index, and the number of records as the value, and store the key-value pair in the shared memory defined in Step 1; Step 4: When a subsequent request comes, generate the index key value as in Step 2, And get the value of the index from the shared memory, if the read value is not empty, add 1 to the value; if the read value is empty, put the key value and access times into the shared memory , solved the problem of generating too many duplicate logs in the server.

Description

technical field [0001] The invention relates to the technical field of information security, in particular, an openresty-based log recording method. Background technique [0002] Nowadays, with the continuous rapid development of Internet technology, people have higher and higher performance requirements for servers. Traditional Apache, tomcat and other synchronous processing servers often struggle with efficiency and In terms of performance, it seems powerless, so all major websites have turned their attention to nginx. [0003] Nginx is a very lightweight HTTP server written by Russians. It is a high-performance HTTP and reverse proxy server, and it is also an IMAP / POP3 / SMTP proxy server. Nginx is specially developed for performance optimization, and its implementation pays great attention to efficiency. It supports the kernel Poll model, can withstand the test of high load, and has high stability. Other HTTP servers, when encountering access peaks, or when someone mali...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F16/17G06F11/30
CPCG06F11/3006G06F11/3079
Inventor 杨川
Owner SICHUAN CHANGHONG ELECTRIC CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products