# Logging format

**URL:** <https://community.nginx.org/t/logging-format/9734>\
**Category:** NGINX\
**Tags:** reverse-proxy\
**Created:** [June 16, 2026, 7:16am UTC](https://community.nginx.org/t/logging-format/9734 "2026-06-16T07:16:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xlf](https://avatars.discourse-cdn.com/v4/letter/x/e5b9ba/32.png) [@xlf](https://community.nginx.org/u/xlf)\
**Post date:** [June 16, 2026, 7:16am UTC](https://community.nginx.org/t/logging-format/9734/1 "2026-06-16T07:16:59Z")

</div>

How can I change the time zone and format of $time\_local in the log format?

Is there a way to get json logging without the paid version?

---

<div class="post-metadata">

**Author:** ![pothi](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/pothi/32/3901_2.png) [@pothi](https://community.nginx.org/u/pothi)\
**Post date:** [June 18, 2026, 8:29am UTC](https://community.nginx.org/t/logging-format/9734/2 "2026-06-18T08:29:00Z")

</div>

JSON logging is already free. Ref: [Module ngx\_http\_log\_module](https://nginx.org/r/log_format)

Not sure about how to change the timezone or the format of $time\_local, though.

---

<div class="post-metadata">

**Author:** ![FrancisD](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@FrancisD](https://community.nginx.org/u/FrancisD)\
**Post date:** [June 18, 2026, 12:42pm UTC](https://community.nginx.org/t/logging-format/9734/3 "2026-06-18T12:42:20Z")

</div>

Hi there,

The local time zone that nginx uses is based on the TZ environment variable that was in the environment when nginx was started; or is based on the server /etc/localtime file if there is no TZ.

So the common case is that it all Just Works by matching the server time zone; but if you want a time zone for nginx that is not the same as the time zone of the server, then you should change your nginx start-up script to set TZ. You _might_ be able to use env ( [Core functionality](http://nginx.org/r/env) ) within the nginx conf file, if you can’t change the start-up script; but that seems not to be preferred.

The format of $time\_local is not configurable.

You can configure json-format access logs by using log\_format ( [Module ngx\_http\_log\_module](http://nginx.org/r/log_format) ) with escape=json, with a reasonable-looking example external to nginx shown at [Nginx JSON Logging Setup for ML Production Systems](https://www.velebit.ai/blog/nginx-json-logging/) .

You cannot configure json-format error logs in stock nginx. According to [Core functionality](https://nginx.org/r/error_log) , that can be done as part of the commercial subscription.

Cheers,

---

<div class="post-metadata">

**Author:** ![system](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/system/32/19_2.png) [@system](https://community.nginx.org/u/system)\
**Post date:** [July 18, 2026, 12:42pm UTC](https://community.nginx.org/t/logging-format/9734/4 "2026-07-18T12:42:58Z")

</div>

Closed on July 18, 2026, 12:42pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
