> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/on-premises/vi/cau-hinh/overleaf-toolkit/logging.md).

# Ghi log

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

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

```bash
# Xem log của dịch vụ web
bin/logs web

# Hiển thị trợ giúp
bin/logs --help

# Xem log cho nhiều dịch vụ cùng lúc
bin/logs filestore docstore web clsi

# Theo dõi đầu ra log (giống tail -f)
bin/logs -f filestore docstore web clsi

# Giới hạn số dòng được in ra (mặc định 50)
bin/logs -n 50 web

# Hiển thị tất cả các dòng log
bin/logs -n all web

# Chuyển hướng đầu ra sang một tệp
bin/logs -n all web > web.log
```

Bạn có thể sử dụng `bin/logs` script để xem log cho 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>

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

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

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

Các container Docker là tạm thời, nghĩa là các tệp/thư mục được tạo bên trong container trong thời gian chạy (bao gồm cả tệp log) sẽ bị loại bỏ 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 các lần tạo lại container:

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

{% hint style="warning" %}
Bạn phải đặt chủ sở hữu của thư mục log trên host được dùng cho bind-mount thành `www-data` người dùng (uid=33) và đảm bảo quyền là `drwxr-xr-x` (755).

Ví dụ:

```bash
chown 33:33 data/overleaf/logs
chmod 755 data/overleaf/logs
```

{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/on-premises/vi/cau-hinh/overleaf-toolkit/logging.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
