diff --git a/HISTORY b/HISTORY index 4b1ec44..5e43890 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,7 @@ -Version 5.11 2017-04-28 +Version 5.11 2017-05-25 * bug fixed: file_offset has no effect when use trunk file + * add storage access log header Version 5.10 2017-03-29 * use fc_safe_read instead of read, and fc_safe_write instead of write diff --git a/storage/storage_func.c b/storage/storage_func.c index 03e2054..dee900d 100644 --- a/storage/storage_func.c +++ b/storage/storage_func.c @@ -1041,6 +1041,14 @@ static int storage_load_paths(IniContext *pItemContext) return 0; } +void storage_set_access_log_header(struct log_context *pContext) +{ +#define STORAGE_ACCESS_HEADER_STR "client_ip action filename status time_used_ms req_len resp_len" +#define STORAGE_ACCESS_HEADER_LEN (sizeof(STORAGE_ACCESS_HEADER_STR) - 1) + + log_header(pContext, STORAGE_ACCESS_HEADER_STR, STORAGE_ACCESS_HEADER_LEN); +} + int storage_func_init(const char *filename, \ char *bind_addr, const int addr_size) { @@ -1655,6 +1663,7 @@ int storage_func_init(const char *filename, \ { break; } + log_set_header_callback(&g_access_log_context, storage_set_access_log_header); } g_rotate_access_log = iniGetBoolValue(NULL, "rotate_access_log",\