> ## 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.

# ログ

`bin/logs` スクリプトを使用して、各サービスのログを表示できます。

基本的な使用例:

```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
```

`bin/logs` スクリプトでは、次のサービスのログを表示できます: `clsi`、`contacts`、`docstore`、`document-updater`、`filestore`、`git-bridge`、`mongo`、`notifications`、`real-time`、`redis`、`spelling`、`tags`、`track-changes`、`web`、`web-api`、`history-v1`、`project-history`。

## ログのコピー

元のドキュメントを参照してください: [https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/logging#copying-logs](https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/logging#copying-logs)

メインの `sharelatex` コンテナからローカルコンピューターにログファイルをコピーします:

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

## ログの永続化

Docker コンテナは一時的なものです。つまり、実行中にコンテナ内で作成されたファイルやディレクトリ（ログファイルを含む）は、コンテナが再作成されると（たとえば `bin/up` を実行したとき）破棄されます。コンテナを再作成してもログファイルを保持するには:

* Toolkit が使用する `config/overleaf.rc` ファイルで環境変数 `OVERLEAF_LOG_PATH` を設定します。これには、`sharelatex` コンテナ内のログディレクトリにバインドマウントされるホスト上のディレクトリを指定します。
* これを変更して `bin/up -d` を実行すると、ログファイルがホスト上に永続化され、直接アクセスできるようになります。

<Warning>
  バインドマウントに使用するホストのログディレクトリの所有者を `www-data` ユーザー（uid=33）に設定し、パーミッションが `drwxr-xr-x`（755）であることを確認する必要があります。

  例:

  ```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.