A
A
Anatoly2018-06-07 14:28:03
Nginx
Anatoly, 2018-06-07 14:28:03

How to set date and time mask in Nginx logs?

Tell me how to set your own time and date format in the Nginx logs?
The nginx site has scant information and no examples, it just states that there are 2 formats time_local and time_iso8601.
I want something like: [18:34:02 07.06]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-06-08
@Tolly

map $time_iso8601 $my_time {
    ~^\d+-(\d+)-(\d+)T(\d+:\d+:\d+)  "$3 $1.$2";
}

And in log_format already use $my_time instead of $time_iso8601.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question