Unit: No access log ?

Created on 13 Sep 2017  路  6Comments  路  Source: nginx/unit

There is no access log in unit ? Or it's desiged to have no access log ?

enhancement

Most helpful comment

There are no access logs at the moment. You can utilize nginx for logging requests.
This feature is planned. As for now we'd like to collect any ideas and requirements, so please feel free to share.

All 6 comments

There are no access logs at the moment. You can utilize nginx for logging requests.
This feature is planned. As for now we'd like to collect any ideas and requirements, so please feel free to share.

In change log, i find basic access logging is supported by now, but can't find any configure example anywhere. I don't know how to use it.

@binnnliu Just add a root element access_log pointing to a file, eg:

{
  "listeners": {
    "*:8300": {
      "application": "default"
    }
  },
  "applications": {
    "default": {
      "type": "php",
      "processes": 10,
      "root": "/app/public",
      "index": "index.php",
      "script": "index.php"
    }
  },
  "access_log": "/proc/self/fd/1"
}

It will generate something like:
192.168.99.1 - - [15/May/2018:14:19:58 +0000] "GET /foo HTTP/1.1" 200 65 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"

Got it. Thanks. @davide-romanini

unit is funy

Initial support for access logging has been added in https://github.com/nginx/unit/commit/204c39472166440f54435edcef8d286f429e0aae and released with Unit 1.0.

Was this page helpful?
0 / 5 - 0 ratings