【问题标题】:gnuplot, graphing individual occurrences over a time periodgnuplot,绘制一段时间内的单个事件
【发布时间】:2012-11-09 18:19:31
【问题描述】:

我有一些来自日志文件的数据。我想绘制一个时间段内发生错误的次数。

例如:

09:00:01,error_1,等等等等 09:00:10,error_1,等等等等 09:00:23,error_1,等等等等 09:01:10,error_2,等等等等 09:07:01,error_1,等等等等 09:07:43,error_1,等等等等 09:11:03,error_1,等等等等 09:18:10,error_1,等等等等 09:40:57,error_2,等等等等 09:41:23,error_1,等等等等 ... 23:32:20 错误_1

因此,对于上述内容,我想绘制这些值,以便我可以显示一个星期,其中各个点以小时为间隔,并显示该小时的“error_1”总和......希望这是有道理的。

如果有人可以帮助我,将不胜感激!如果有办法完全使用 gnuplot 做到这一点,那就更好了。

谢谢!

【问题讨论】:

  • 你怎么知道今天是星期几?日志文件似乎不包含该信息..

标签: gnuplot


【解决方案1】:

您希望让 gnuplot 进行分箱以生成 histogram。唯一的技巧是您需要根据错误代码过滤掉行。您可以可能在 gnuplot 中进行过滤,但使用 grep 之类的东西要容易得多

set xdata time
set timefmt '%H:%M:%S'
set datafile sep ','
binwidth = 3600  #3600 seconds in an hour.
bin(x,width) = width*floor(x/width)
plot for [ERR in "error_1 error_2"] sprintf('<grep %s test.dat',ERR) u (bin($1,binwidth)):(1.0) smooth freq w boxes ti ERR

【讨论】:

  • 谢谢!我想我得到了你在这里所做的大部分事情...... :(1.0) 在做什么?此外,我收到一个错误“所有点 y 未定义!”错误一直指向行尾。
  • (1.0) 是字面常量 1。它为落入特定 bin 的每个数据的值加一。
  • 您好,感谢您的帮助!我遇到了一些错误,无法弄清楚我做错了什么。这是我正在使用的 gnuplot 命令。 set timefmt "%m/%d/%Y %H:%M" set xdata time set terminal png size 1024,768 set output "xxx.png"\n set format x "%m/%d\n%H:%M" set xrange ["11/6/2012 20:19":"11/7/2012 10:00"] binwidth = 3600 #3600 seconds in an hour. bin(x,width) = width*floor(x/width) plot for [ERR in "HBER RX_FAILURE"] sprintf('&lt;grep %s alarms.csv', ERR) u (bin($5,binwidth)):(1.0) smooth freq w boxes ti ERR
  • 这是我试图绘制的日志样本。 xxxx/radio-1.4.123123132.1,RX_FAILURE,MAJOR,,11/7/2012 16:52,11/7/2012 16:52&lt;br/&gt; xxxx/radio-1.4.123123123.1,HBER,MAJOR,,11/7/2012 16:52,11/7/2012 16:52
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多