ipcad2squid 1.1 → 1.1.1
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/ipcad2squid.gemspec +1 -1
- data/lib/ipcad2squid.rb +10 -2
- metadata +1 -1
data/ipcad2squid.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'ipcad2squid'
|
3
|
-
s.version = '1.1'
|
3
|
+
s.version = '1.1.1'
|
4
4
|
s.date = '2013-01-03'
|
5
5
|
s.summary = "Convert ipcad logs to squid logs"
|
6
6
|
s.description = "Simple gem for converting and appending output from ipcad to squid logs formats"
|
data/lib/ipcad2squid.rb
CHANGED
@@ -8,7 +8,11 @@ class Ipcad2squid
|
|
8
8
|
@cmd2 = options[:cmd2] || 'netkit-rsh localhost show ip accounting checkpoint'
|
9
9
|
@net = options[:net] || '192.168.0'
|
10
10
|
@filename = options[:filename] || '/var/log/squid/access.log'
|
11
|
-
|
11
|
+
begin
|
12
|
+
@ttime = `#{@cmd1}`.split("\n").grep(/saved/) { |saved| saved.split.last }.first
|
13
|
+
rescue
|
14
|
+
@ttime = '0'
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
def output
|
@@ -24,7 +28,11 @@ class Ipcad2squid
|
|
24
28
|
|
25
29
|
def clear_accounting
|
26
30
|
# move statistics to checkpoint and clear
|
27
|
-
|
31
|
+
begin
|
32
|
+
`netkit-rsh localhost clear ip accounting`
|
33
|
+
rescue
|
34
|
+
puts "Couldn't clear ip accounting"
|
35
|
+
end
|
28
36
|
end
|
29
37
|
|
30
38
|
def write_to_file
|