> For the complete documentation index, see [llms.txt](https://bohans.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bohans.gitbook.io/devops/ngnix/ji-chu-zhi-shi/2.-nginx-pei-zhi/2.2-pei-zhi-zhi-ling/access_log.md).

# access\_log

**服务日志是指记录Nginx服务器提供服务过程应答前端请求的日志。**

Nginx服务器支持对服务日志的格式、大小、输出等进行配置，<mark style="color:blue;">**access\_log**</mark>指令的语法结构为：

```nginx
access_log path [format [buffer=size]];
```

* <mark style="color:blue;">**path**</mark>：配置服务日志的文件存放的路径和名称。
* <mark style="color:blue;">**format**</mark>：可选项，自定义服务日志的格式字符串，也可以通过“格式串的名称”使用**log\_format**指令定义好的格式。“格式串的名称”在log\_format指令中定义。
* <mark style="color:blue;">**size**</mark>：配置临时存放日志的内存缓存区大小。

{% hint style="info" %} <mark style="color:blue;">**此指令可以在http块、server块或者location块中进行设置**</mark>
{% endhint %}

{% hint style="info" %}
如果要取消记录服务日志的功能，则使用：

```nginx
access_log off;
```

{% endhint %}

*
