How to use nginx to count url with specific parameters

problem description

there is a demand now. A website can be accessed directly with url. Or access it with an email link with an identified parameter. Now you need to record the number of times you visit the site through an e-mail link. Asked to do it in nginx.

the environmental background of the problems and what methods you have tried

has not used nginx. There is nothing I can do

related codes

/ / Please paste the code text below (do not replace the code with pictures)
none

Apr.25,2021

you can analyze the access.log of nginx


upstairs + 1. Nginx's default access log format already includes the query params parameter, so you can quickly count


even if you use grep | wc .

you can first write a Linux script to count the access log of nginx, and then call this script in Java
shell script content can be simple grep or awk

java call script code is as follows:

Process process = Runtime.getRuntime().exec("shell.sh");
int execSuccess = process.waitFor();
if (0 == execSuccess) {
    bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
    String resultAmount = "";
    while ((resultAmount = bufferedReader.readLine()) != null) {
        result.append(resultAmount);
    }
    return result.toString().trim();
}
The logical expression ability of

nginx itself is limited, so you can use lua, for analysis and statistics through Lua.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ad0a-2c259.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ad0a-2c259.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?