知识库

如何使用调试日志解析器脚本

要分析 Neo4j 的 debug.log,请阅读本指南,了解如何使用 debugInfo.sh 解析脚本。

这个脚本是什么?

debug.log 内容非常冗长,包含大量有助于了解 Neo4j 服务器实例或集群健康状况和行为的有用信息。为了帮助支持团队更快速、高效地判断 Neo4j 服务器是否健康,Neo4j 支持部门推出了 debugInfo.sh 脚本,用于将 debug.log 文件解析为简明、可用的信息摘要。

我该如何使用?

首先,从此处下载脚本及辅助文件。

在 Linux 系统上运行 debugInfo.sh 脚本,请按以下步骤操作

以 neo4j 用户身份

  1. debugInfo.sh 脚本以及 debugLogErrorsFile.neo4jdebugLogExcludeFile.neo4j 文件复制到 $NEO4J_HOME/logs 目录。

  2. 根据需要检查并修改脚本中的用户变量。

  3. 默认日志位置是执行脚本的当前工作目录。默认输出文件名为 debugInfo.txt

  4. 运行 chmod 750 debugInfo.sh 为脚本设置执行权限。

  5. 脚本用法

  $ ./debugInfo.sh debug.log

注意 1:debugInfo.sh 脚本接受一个输入,即要处理的 Neo4j debug.log 文件名。

注意 2:debugLogErrorsFile.neo4j 文件用于解析 debug.log 中的特定错误值,可根据需要进行修改。debugLogExcludeFile.neo4j 文件用于在解析错误时排除特定错误值,也可根据需要进行修改。

注意 3:debugInfo.sh 脚本会将结果输出到屏幕,同时写入工作目录下名为 debugInfo.txt 的默认输出文件。

若从其他位置运行脚本,只需提供要分析的 debug.log 的完整路径

$ pwd
/home/neo4j

$ ls -la
total 40
drwxrwxr-x   2 neo4j neo4j   112 Dec 19 13:23 .
drwx------. 13 neo4j neo4j  4096 Dec 13 17:01 ..
-rwx------   1 neo4j neo4j 17521 Dec 13 17:04 debugInfo.sh
-rw-rw-r--   1 neo4j neo4j   427 Dec 13 16:47 debugLogErrorsFile.neo4j
-rw-rw-r--   1 neo4j neo4j  1671 Dec 13 16:51 debugLogExcludeFile.neo4j

$ ./debugInfo.sh debug.log $NEO4J_HOME/logs/debug.log

注意 1:脚本会解析指定位置的 debug.log,并将结果输出到屏幕,同时写入工作目录下默认的 debugInfo.txt 输出文件。

© . This site is unofficial and not affiliated with Neo4j, Inc.