report分析命令
命令功能
支持对采集生成的JSON文件进行分析,输出终端报告和Excel报告,其终端报告为Summary数据,Excel报告包含Summary数据和可视化时序图表。
命令格式
1 | ksys report [-h] -i INPUT [-o OUTPUT] [--parse TYPE LOG_DIRECTORY] [-c] [-l {0,1,2,3}] |
参数说明
参数 |
参数选项 |
参数说明 |
||
---|---|---|---|---|
-h/--help |
- |
可选参数,获取帮助信息。 |
||
-i/--input |
- |
必选参数,指定JSON文件的路径,该JSON文件必须是使用collect命令采集得到的。 |
||
-o/--output |
- |
可选参数,指定Excel文件的存放路径,不指定则在当前目录下生成格式为“Y_M_D_H_M_S_report”的Excel文件。 |
||
--parse |
- |
可选参数,指定应用类型以及对应日志文件的存放目录,需要先后输入应用类型,再输入对应日志的存放目录中间用空格隔开。 例如:
存放目录下各应用日志文件的格式要求如下:
|
||
-c/--cpu |
- |
可选参数,保存各CPU的时序数据到Excel结果文件中。 |
||
-l/--log-level |
0/1/2/3 |
可选参数,设置日志级别,默认为1。
|
使用示例
- 执行以下命令,查看report命令支持的功能信息:
1
ksys report -h
返回信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
USAGE ksys report [-h] -i INPUT [-o OUTPUT] [--parse TYPE LOG_DIRECTORY] [-c] [-l {0,1,2,3}] DESCRIPTION Create a report command line task. options: -h, --help show this help message and exit -i INPUT, --input INPUT Input the full path of the JSON file. This file must be collected by running the collect command. -o OUTPUT, --output OUTPUT Output the full path. --parse TYPE LOG_DIRECTORY Input the report type and directory. The following report types are supported: mysql: errorlog, generallog, and slowlog reports of MySQL 5.7.27 to 8.0.5. flink: jobmanager and taskmanager system-level logs of Flink 1.20.1 to 2.0.0. redis: Redis-server logs of Redis 5.0.12 to 6.0.20. spark: system-level logs of Spark 3.1.1 to 3.2.1. kafka: system-level logs of Kafka 2.8.2-1 to 2.13-4. openGauss: system-level logs of openGauss 5.0.0LTS to 7.0.0.RC. general: reports can be generated by performance test tools such as Sysbench. Other reports can also be generated but they must meet specific formats. For details, see README. -c, --cpu Save the time sequence data of each CPU to the Excel file. If the input JSON file is collected using the -p option, this option is invalid. -l {0,1,2,3}, --log-level {0,1,2,3} Set the log level (0=DEBUG, 1=INFO, 2=WARNING, 3=ERROR), which defaults to 1(INFO).
- 如果当前采集的业务存在日志,可以在分析时关联业务日志。
ksys report -i /home/test/2025_08_14_15_11_20_report.json --parse spark /home/test/
业务日志对齐分析任务可以实现业务数据和系统数据的时间线对齐,会正常返回分析后的Summary数据,基本和采集系统指标返回信息一样。区别在于如果时间线有交集且存在业务数据,会额外保存业务数据JSON文件,并在Excel文件的第一个表格页保存时序业务数据。
2025_08_14_15_11_20_report.json为通过ksys collect命令生成的JSON文件。
返回信息如下:
1 2 3
Save statistics and time series data to an Excel file. Please wait. Data saved successfully at /home/test/2025_08_14_16_04_57_service.json The report has been saved to /home/test/2025_08_14_16_04_57_report.xlsx
父主题: 鲲鹏系统性能方法论分析工具