概要: 域名日志浏览器会通过分析 web 服务器日志以及显示 Plesk 中相关警告和错误信息来帮助您解决问题。

In this topic, you will learn how to view the contents of log files for any given domain in Plesk. You will also learn how to add custom log files to the list of logs monitored by Plesk.

概要

在 Linux,会默认显示来自以下日志文件的信息:

  • Apache 访问 (access_log) 。该日志会记录由 Apache web 服务器处理的所有 HTTP 请求。
  • Apache ssl 访问 (access_ssl_log) 。该日志会记录由 Apache web 服务器处理的所有 HTTPS 请求。
  • Apache 错误 (error_log) 。该日志包含诊断信息。还记录了Apache web 服务器在处理请求时遇到的任何问题。
  • nginx 访问 (proxy_access_log)。 该日志会记录由 nginx 代理 web 服务器处理的所有 HTTP 请求。
  • nginx ssl 访问 (proxy_access_ssl_log) 。该日志会记录由 nginx 代理 web 服务器处理的所有 HTTPS 请求。
  • nginx 错误 (proxy_error_log) 。该日志包含诊断信息。还记录了 nginx 代理 web 服务器在处理请求时遇到的任何问题。

在 Windows 上,会显示来自 IIS 日志的信息。该日志记录了由 web 服务器处理的所有请求,包括 HTTP 和 HTTPS,以及 web 服务器在处理请求时遇到的任何问题。

此外,您还可以添加任何来自您网站目录的自定义日志文件以在域名日志浏览器中进行跟踪,具体阐述如下。

访问域名日志浏览器

To access the domain log browser, go to Websites and Domains, find the domain whose logs you want to see, and then click Logs (under “Dev Tools”).

image logs button

您将会看到从日志收集来的相关信息列表。默认域名日志浏览器会显示打开时出现在监控日志中的信息。如果您想要刷新列表,出现打开域名日志浏览器后新增的信息,请点击 刷新 。或者,如果您想要不断的添加新信息,则可以点击 启动实时更新

image log browser interface

To select the logs from which you want to view messages, click this button

image logs selector menu

and then select the desired logs from the menu.

image selected log sources

管理日志文件

To view all the messages in a log, go to Websites and Domains, find the domain whose logs you want to see, click Logs, and then click Manage Log Files. The list of all tracked log files will be displayed.

image tracked log files

您可在此处点击日志文件名称以直接在域名日志浏览器中查看文件内容。您可以点击日志文件旁边的 image view log icon 图标以在独立的窗口中打开用于浏览,或点击 image download log icon 图标进行下载。

To save disk space, you can enable log rotation - that is, automatic compression and/or deletion of outdated website log files. To set up log rotation, go to Websites and Domains, find the domain whose logs you want to rotate, click Logs, and then click Log Rotation.

您还可以删除已经循环的日志文件(还未循环的日志文件无法被移除)。

添加自定义日志文件

You can add any custom log file from your web site directory to track its changes in the domain log browser. To do this, go to Websites and Domains, find the domain you want to add a custom log for, click Logs, click Manage Log Files, and then click Add Custom Log. The tree with your web site folders will be displayed. Select the file that you want to add to the domain log browser and click OK.

注解: 只能选择纯文本文件。为了显示正常,您的自定义日志文件中每个日志项都必须有时间戳,否则无法正常解析。

image add custom log

因此,选定的日志文件将会在管理的日志文件列表中显示。

image added custom log

如果您不再需要监控该自定义日志文件,请点击旁边的 image remove custom log 图标。这样不会从您的文件系统移除文件,但是会从域名日志浏览器中可用文件列表中移除该文件。

您还可以使用 在日志浏览器中打开 选项直接从文件管理器在域名日志浏览器中打开文本文件。

image open in log browser

但您从文件管理器在域名日志浏览器中打开一个日志文件时,文件不会被添加到可在域名日志浏览器中永久查看的日志列表中。若要添加文件到域名日志浏览器中,请点击 以自定义文件形式添加到域名日志浏览器 按钮。

image add as custom file

注解: 自定义日志文件无法使用日志循环功能。