logtrend 0.3.20101204155928 → 0.4.20101204161637
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/logtrend.rb +7 -3
- data/samples/example.rb +2 -2
- data/samples/test.log +7 -0
- metadata +4 -4
data/lib/logtrend.rb
CHANGED
@@ -37,7 +37,11 @@ class LogTrend
|
|
37
37
|
def build_graph(graphs_dir, rrd_dir, graph)
|
38
38
|
RRD.graph File.join(graphs_dir,"#{graph.name}.png"), :title => graph.name, :width => 800, :height => 250, :color => ["FONT#000000", "BACK#FFFFFF"] do
|
39
39
|
graph.points.each do |point|
|
40
|
-
|
40
|
+
if point[:style] == :line
|
41
|
+
line File.join(rrd_dir,"#{point[:name]}.rrd"), "#{point[:name]}_count" => :average, :color => point[:color], :label => point[:name].to_s
|
42
|
+
elsif point[:style] == :area
|
43
|
+
area File.join(rrd_dir,"#{point[:name]}.rrd"), "#{point[:name]}_count" => :average, :color => point[:color], :label => point[:name].to_s
|
44
|
+
end
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -97,7 +101,7 @@ class Graph
|
|
97
101
|
@points = []
|
98
102
|
end
|
99
103
|
|
100
|
-
def
|
101
|
-
@points << {:name => name, :color => color}
|
104
|
+
def add_point(style,name,color)
|
105
|
+
@points << {:style => style, :name => name, :color => color}
|
102
106
|
end
|
103
107
|
end
|
data/samples/example.rb
CHANGED
@@ -15,8 +15,8 @@ LogTrend.start('test.log', "/tmp/rrd", "/tmp/graphs") do |l|
|
|
15
15
|
l.add_trend(:kod) {|line| line.match /kilnhg.com/}
|
16
16
|
|
17
17
|
l.add_graph(:requests_per_minute) do |g|
|
18
|
-
g.
|
19
|
-
g.
|
18
|
+
g.add_point :area, :fbod, "#0066cc"
|
19
|
+
g.add_point :area, :kod, "#993333"
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
data/samples/test.log
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logtrend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 40202408323269
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 20101204161637
|
10
|
+
version: 0.4.20101204161637
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Gorsuch
|