> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/knowledge-base/zh/troubleshooting/configuring-remote-log-forwarding.md).

# 配置远程日志转发（Syslog）

VergeOS 可配置为将日志转发到远程 Syslog 服务器，这对于利用日志聚合进行集中管理、日志归档和合规性的组织来说是一项重要能力。

{% hint style="success" %}
**日志保留**

记录的活动通常可在 VergeOS 用户界面中保留最长为 **45 天**. 配置远程日志转发以更长时间保留日志。
{% endhint %}

## 前提条件

* VergeOS 与远程 syslog 服务器之间的网络连接
* 允许 syslog 流量（通常为 514 端口）的适当防火墙规则
* 可访问 VergeOS 系统设置

## 配置步骤

要将日志转发配置到远程 syslog 服务器：

### 1. 导航到高级设置

导航到 **系统 > 设置 > 高级设置**.

### 2. 配置远程 Syslog 服务器

1. 在“Setting”列标题下，输入 `syslog` 并按 ++enter++ 进行搜索
2. 选择并编辑 **远程 syslog 服务器（tcp: @@name/ip:port, udp: @name/ip:port）**
3. 请根据远程服务器期望的语法配置此设置：

{% hint style="info" %}
**服务器配置示例**

* **对于 TCP：** `@@10.10.10.10:514`
* **对于 UDP：** `@10.10.10.10:514`
  {% endhint %}

4. 点击 **提交** 在页面底部以保存

### 3. 配置格式模板

1. 搜索 `syslog` 在设置中再次
2. 选择并编辑 **为 syslog 服务器定义的模板（格式请参见 rsyslog）**
3. 输入与您的远程 syslog 服务器兼容的 syslog 模板格式

{% hint style="info" %}
**模板示例**

```plaintext
   GRAYLOGRFC5424,"<%PRI%>%PROTOCOL-VERSION% %TIMESTAMP:::date-rfc3339% %HOSTNAME%.your-hostname-here %APP-NAME% %PROCID% %MSGID% %STRUCTURED-DATA% %msg%\n"
```

{% endhint %}

{% hint style="info" %}
将 `your-hostname-here` 替换为您的实际主机名，或者保留为 `.HOSTNAME_HERE` 以使用默认系统主机名。
{% endhint %}

4. 点击 **提交** 在页面底部以保存格式

## 其他资源

有关 syslog 模板和格式选项的更多信息，请访问 [Rsyslog 文档](https://www.rsyslog.com/doc/master/configuration/examples.html).

## 验证

完成配置后，日志将开始转发到指定的 syslog 服务器。检查您的远程服务器日志，以验证是否已成功接收到 VergeOS 日志。


---

# 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://docs.verge.io/knowledge-base/zh/troubleshooting/configuring-remote-log-forwarding.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.
