简体   繁体   English

解析日志文件-使用Java和绘图图

[英]parse log file - using java and plot graph

I am writing a log analyzer program which is supposed to plot a graph on search string against time after parsing log file(s). 我正在编写一个日志分析器程序,该程序应该在分析日志文件后根据时间在搜索字符串上绘制图形。 I am currently clueless about how would I parse and store the log file so that it could be processed to create multiple outputs, now I am parsing the entire log file all the time and process to do this – any suggestions? 我目前对如何解析和存储日志文件一无所知,以便可以对其进行处理以创建多个输出,现在我一直在解析整个日志文件以执行此操作-有什么建议吗?

You could use OtrosLogViewer along with Batch processing to process log files. 您可以将OtrosLogViewer批处理一起使用来处理日志文件。 Depending on scenario, you could create charts with JFreeChart or insert log events to database (mysql or MongoDB ) 根据情况,您可以使用JFreeChart创建图表或将日志事件插入数据库(mysql或MongoDB

Disclaimer : I am the author of OtrosLogViewer 免责声明 :我是OtrosLogViewer的作者

Don't. 别。

Use either Apache Chainsaw - http://logging.apache.org/chainsaw/index.html - or Lilith - http://lilith.huxhorn.de/ - to parse and view your log files. 使用Apache Chainsaw- http ://logging.apache.org/chainsaw/index.html-或Lilith- http://lilith.huxhorn.de/-来解析和查看日志文件。

You can preprocess your logfiles easily with Perl. 您可以使用Perl轻松地预处理日志文件。

在Java中,一旦您解析了日志,我就会查看JFreeChart来绘制图形。

Probably the easiest thing to do is to write a file for each search string. 可能最简单的方法是为每个搜索字符串编写一个文件。 In the file write each timestamp where the string occurs. 在文件中写入每个出现字符串的时间戳记。 Then process these files to create a list of search strings and counts. 然后处理这些文件以创建搜索字符串和计数列表。 You can then process these files to produce the graphs you want. 然后,您可以处理这些文件以生成所需的图形。

You could use the Pentaho suite to do this, its open source java with good backing and usage. 您可以使用Pentaho套件来做到这一点,它的开源Java具有良好的支持和用法。

  1. Use Pentaho Kettle to bulk load into MySql 使用Pentaho Kettle 批量加载到MySql中
  2. Use Report Designer to pull out the stats into a pretty picture 使用报表设计器将统计数据提取为漂亮的图片

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM