> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Ghi log

Bạn có thể sử dụng script `bin/logs` để xem log của các dịch vụ.

Ví dụ sử dụng cơ bản:

```bash theme={null}
# View the web service logs
bin/logs web

# Show help
bin/logs --help

# View logs for multiple services at once
bin/logs filestore docstore web clsi

# Follow log output (like tail -f)
bin/logs -f filestore docstore web clsi

# Limit the number of lines printed (default 50)
bin/logs -n 50 web

# Show all log lines
bin/logs -n all web

# Redirect output to a file
bin/logs -n all web > web.log
```

Bạn có thể sử dụng script `bin/logs` để xem log của các dịch vụ sau: `clsi`, `contacts`, `docstore`, `document-updater`, `filestore`, `git-bridge`, `mongo`, `notifications`, `real-time`, `redis`, `spelling`, `tags`, `track-changes`, `web`, `web-api`, `history-v1`, `project-history`.

## Sao chép log

Xem tài liệu gốc: [https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/logging#copying-logs](https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/logging#copying-logs)

Sao chép các tệp log từ container chính `sharelatex` về máy tính cục bộ của bạn:

```bash theme={null}
docker cp sharelatex:/var/log/overleaf/{service-name}.log {service-name}.log
```

## Lưu giữ log lâu dài

Các container Docker có tính tạm thời, nghĩa là các tệp/thư mục được tạo bên trong container trong quá trình chạy (bao gồm cả tệp log) sẽ bị xóa nếu container được tạo lại (ví dụ: khi chạy `bin/up`). Để giữ lại các tệp log giữa những lần tạo lại container:

* Đặt biến môi trường `OVERLEAF_LOG_PATH` trong tệp `config/overleaf.rc` mà Toolkit sử dụng. Đây phải là thư mục trên máy chủ (host) sẽ được bind-mount vào thư mục log bên trong container `sharelatex`.
* Sau khi thay đổi giá trị này và chạy `bin/up -d`, các tệp log sẽ được lưu giữ trên máy chủ và có thể truy cập trực tiếp.

<Warning>
  Bạn phải đặt chủ sở hữu của thư mục log trên máy chủ dùng cho bind-mount là người dùng `www-data` (uid=33) và đảm bảo quyền là `drwxr-xr-x` (755).

  Ví dụ:

  ```bash theme={null}
  chown 33:33 data/overleaf/logs
  chmod 755 data/overleaf/logs
  ```
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.