#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#if (NGX_ZLIB)
#include <zlib.h>
#endif
ngx_http_log_op_t;
ngx_http_log_op_run_pt;
ngx_http_log_op_getlen_pt;
struct ngx_http_log_op_s { … };
ngx_http_log_fmt_t;
ngx_http_log_main_conf_t;
ngx_http_log_buf_t;
ngx_http_log_script_t;
ngx_http_log_t;
ngx_http_log_loc_conf_t;
ngx_http_log_var_t;
#define NGX_HTTP_LOG_ESCAPE_DEFAULT …
#define NGX_HTTP_LOG_ESCAPE_JSON …
#define NGX_HTTP_LOG_ESCAPE_NONE …
static void ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log,
u_char *buf, size_t len);
static ssize_t ngx_http_log_script_write(ngx_http_request_t *r,
ngx_http_log_script_t *script, u_char **name, u_char *buf, size_t len);
#if (NGX_ZLIB)
static ssize_t ngx_http_log_gzip(ngx_fd_t fd, u_char *buf, size_t len,
ngx_int_t level, ngx_log_t *log);
static void *ngx_http_log_gzip_alloc(void *opaque, u_int items, u_int size);
static void ngx_http_log_gzip_free(void *opaque, void *address);
#endif
static void ngx_http_log_flush(ngx_open_file_t *file, ngx_log_t *log);
static void ngx_http_log_flush_handler(ngx_event_t *ev);
static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_iso8601(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_bytes_sent(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_body_bytes_sent(ngx_http_request_t *r,
u_char *buf, ngx_http_log_op_t *op);
static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static ngx_int_t ngx_http_log_variable_compile(ngx_conf_t *cf,
ngx_http_log_op_t *op, ngx_str_t *value, ngx_uint_t escape);
static size_t ngx_http_log_variable_getlen(ngx_http_request_t *r,
uintptr_t data);
static u_char *ngx_http_log_variable(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static uintptr_t ngx_http_log_escape(u_char *dst, u_char *src, size_t size);
static size_t ngx_http_log_json_variable_getlen(ngx_http_request_t *r,
uintptr_t data);
static u_char *ngx_http_log_json_variable(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static size_t ngx_http_log_unescaped_variable_getlen(ngx_http_request_t *r,
uintptr_t data);
static u_char *ngx_http_log_unescaped_variable(ngx_http_request_t *r,
u_char *buf, ngx_http_log_op_t *op);
static void *ngx_http_log_create_main_conf(ngx_conf_t *cf);
static void *ngx_http_log_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent,
void *child);
static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static char *ngx_http_log_compile_format(ngx_conf_t *cf,
ngx_array_t *flushes, ngx_array_t *ops, ngx_array_t *args, ngx_uint_t s);
static char *ngx_http_log_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static ngx_int_t ngx_http_log_init(ngx_conf_t *cf);
static ngx_command_t ngx_http_log_commands[] = …;
static ngx_http_module_t ngx_http_log_module_ctx = …;
ngx_module_t ngx_http_log_module = …;
static ngx_str_t ngx_http_access_log = …;
static ngx_str_t ngx_http_combined_fmt = …;
static ngx_http_log_var_t ngx_http_log_vars[] = …;
static ngx_int_t
ngx_http_log_handler(ngx_http_request_t *r)
{ … }
static void
ngx_http_log_write(ngx_http_request_t *r, ngx_http_log_t *log, u_char *buf,
size_t len)
{ … }
static ssize_t
ngx_http_log_script_write(ngx_http_request_t *r, ngx_http_log_script_t *script,
u_char **name, u_char *buf, size_t len)
{ … }
#if (NGX_ZLIB)
static ssize_t
ngx_http_log_gzip(ngx_fd_t fd, u_char *buf, size_t len, ngx_int_t level,
ngx_log_t *log)
{ … }
static void *
ngx_http_log_gzip_alloc(void *opaque, u_int items, u_int size)
{ … }
static void
ngx_http_log_gzip_free(void *opaque, void *address)
{ … }
#endif
static void
ngx_http_log_flush(ngx_open_file_t *file, ngx_log_t *log)
{ … }
static void
ngx_http_log_flush_handler(ngx_event_t *ev)
{ … }
static u_char *
ngx_http_log_copy_short(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_copy_long(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_time(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_iso8601(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_msec(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_bytes_sent(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_body_bytes_sent(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ … }
static u_char *
ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ … }
static ngx_int_t
ngx_http_log_variable_compile(ngx_conf_t *cf, ngx_http_log_op_t *op,
ngx_str_t *value, ngx_uint_t escape)
{ … }
static size_t
ngx_http_log_variable_getlen(ngx_http_request_t *r, uintptr_t data)
{ … }
static u_char *
ngx_http_log_variable(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ … }
static uintptr_t
ngx_http_log_escape(u_char *dst, u_char *src, size_t size)
{ … }
static size_t
ngx_http_log_json_variable_getlen(ngx_http_request_t *r, uintptr_t data)
{ … }
static u_char *
ngx_http_log_json_variable(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ … }
static size_t
ngx_http_log_unescaped_variable_getlen(ngx_http_request_t *r, uintptr_t data)
{ … }
static u_char *
ngx_http_log_unescaped_variable(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ … }
static void *
ngx_http_log_create_main_conf(ngx_conf_t *cf)
{ … }
static void *
ngx_http_log_create_loc_conf(ngx_conf_t *cf)
{ … }
static char *
ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{ … }
static char *
ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{ … }
static char *
ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{ … }
static char *
ngx_http_log_compile_format(ngx_conf_t *cf, ngx_array_t *flushes,
ngx_array_t *ops, ngx_array_t *args, ngx_uint_t s)
{ … }
static char *
ngx_http_log_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{ … }
static ngx_int_t
ngx_http_log_init(ngx_conf_t *cf)
{ … }