Files
nginx-unit/src
Zhidao HONG 4c91bebb50 HTTP: enhanced access log with conditional filtering.
This feature allows users to specify conditions to control if access log
should be recorded. The "if" option supports a string and JavaScript code.
If its value is empty, 0, false, null, or undefined, the logs will not be
recorded. And the '!' as a prefix inverses the condition.

Example 1: Only log requests that sent a session cookie.

    {
        "access_log": {
            "if": "$cookie_session",
            "path": "..."
        }
    }

Example 2: Do not log health check requests.

    {
        "access_log": {
            "if": "`${uri == '/health' ? false : true}`",
            "path": "..."
        }
    }

Example 3: Only log requests when the time is before 22:00.

    {
        "access_log": {
            "if": "`${new Date().getHours() < 22}`",
            "path": "..."
        }
    }

or

    {
        "access_log": {
            "if": "!`${new Date().getHours() >= 22}`",
            "path": "..."
        }
    }

Closes: https://github.com/nginx/unit/issues/594
2024-01-29 13:48:53 +08:00
..
2024-01-16 15:37:07 +00:00
2020-08-13 02:46:54 +03:00
2022-05-03 12:11:14 +02:00
2023-11-10 02:59:49 +00:00
2022-05-03 12:11:14 +02:00
2021-08-03 13:59:27 +03:00
2022-05-03 12:11:14 +02:00
2020-05-28 14:57:41 +01:00
2020-03-09 16:28:25 +00:00
2022-05-03 12:11:14 +02:00
2024-01-16 15:37:07 +00:00
2023-02-17 21:24:18 +00:00
2023-04-24 19:40:16 +01:00
2023-09-07 23:13:34 +01:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2021-08-03 13:59:27 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2023-04-11 19:08:12 +01:00
2023-04-11 19:08:12 +01:00
2017-01-17 20:00:00 +03:00
2022-04-26 12:38:48 +02:00
2017-01-17 20:00:00 +03:00
2019-03-11 17:31:59 +03:00
2022-05-03 12:11:14 +02:00
2019-11-14 16:39:54 +03:00
2022-11-20 23:16:51 +08:00
2022-08-18 15:43:03 +02:00
2022-05-03 12:11:14 +02:00
2023-05-08 16:00:25 +08:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2021-03-24 08:05:07 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2023-09-07 23:13:34 +01:00
2023-06-19 16:29:22 +08:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2020-08-13 02:46:54 +03:00
2017-01-17 20:00:00 +03:00
2022-07-18 19:09:30 +02:00
2022-07-18 19:09:30 +02:00
2024-01-16 15:37:07 +00:00
2017-01-17 20:00:00 +03:00
2019-03-11 17:31:59 +03:00
2022-10-28 03:18:33 +01:00
2023-05-08 16:00:25 +08:00
2017-03-14 19:03:49 +03:00
2023-04-11 19:08:32 +01:00
2023-05-08 16:00:25 +08:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2017-01-17 20:00:00 +03:00
2024-01-16 15:37:07 +00:00
2023-05-08 16:00:25 +08:00
2023-05-08 16:00:25 +08:00
2023-05-08 16:00:25 +08:00
2017-01-17 20:00:00 +03:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2023-09-07 23:13:34 +01:00
2022-05-03 12:11:14 +02:00
2022-08-11 18:43:12 +02:00
2024-01-16 15:37:07 +00:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2023-10-10 14:30:02 +08:00
2017-01-17 20:00:00 +03:00
2022-08-29 14:32:20 +08:00
2017-01-17 20:00:00 +03:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2017-01-27 11:35:11 +03:00
2022-05-03 12:11:14 +02:00
2022-05-03 12:11:14 +02:00
2017-01-17 20:00:00 +03:00
2022-05-03 12:11:14 +02:00
2019-03-11 17:31:59 +03:00
2023-06-30 14:38:34 +02:00
2023-06-19 16:29:22 +08:00
2018-06-25 16:51:47 +03:00
2019-03-11 17:31:59 +03:00
2019-11-14 16:39:54 +03:00
2018-08-06 17:27:33 +03:00
2018-08-06 17:27:33 +03:00
2023-11-14 16:48:16 +00:00
2020-03-06 18:28:54 +03:00
2023-06-19 16:29:22 +08:00
2023-06-19 16:29:22 +08:00
2022-05-03 12:11:14 +02:00
2019-10-10 19:42:41 +03:00
2018-02-07 15:34:42 +03:00
2022-05-03 12:11:14 +02:00
2023-08-01 10:16:17 -07:00