0

i'm using NGINX Openresty (version 1.4.3.4) in my project and i was wondering if i could make the access log to be aligned.

from this:

[06/Mar/2015:21:20:11 +0000] [0.028] [200] [54.162.222.95] ["GET /XXX"]
[06/Mar/2015:21:20:11 +0000] [0.020] [200] [108.177.223.182] ["GET /XXX"]
[06/Mar/2015:21:20:11 +0000] [0.022] [204] [208.43.79.196] ["POST /XXX"]
[06/Mar/2015:21:20:11 +0000] [0.018] [204] [173.192.139.113]  ["GET /XXX"]
[06/Mar/2015:21:20:11 +0000] [0.019] [200] [54.152.215.46]  ["GET /XXX"]

to look like this

[06/Mar/2015:21:20:11 +0000] [0.028] [200] [54.162.222.95]   ["GET /XXX"]
[06/Mar/2015:21:20:11 +0000] [0.020] [200] [108.177.223.182] ["GET /XXX"]
[06/Mar/2015:21:20:11 +0000] [0.022] [204] [208.43.79.196]   ["POST /XXX"]
[06/Mar/2015:21:20:11 +0000] [0.018] [204] [173.192.139.113] ["GET /XXX"]
[06/Mar/2015:21:20:11 +0000] [0.019] [200] [54.152.215.46]   ["GET /XXX"]

what i have currently in my settings is this:

log_format normal '[$time_local] [$request_time] [$status] [$http_x_forwarded_for] ["$request"]';

thanks.

koby meir
  • 327
  • 6
  • 16

1 Answers1

1

You can't align log with log_format to what you want.

You can make your own log with log_by_lua to any format you want.

fannheyward
  • 15,632
  • 10
  • 61
  • 99