ruby-splunk 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/splunk.rb +7 -2
- metadata +1 -1
data/lib/splunk.rb
CHANGED
@@ -28,7 +28,7 @@ class Splunk
|
|
28
28
|
if field.has_key? "@k"
|
29
29
|
case field["@k"]
|
30
30
|
when '_raw'
|
31
|
-
rres[:"#{field["@k"]}"] = field["v"].to_s
|
31
|
+
rres[:"#{field["@k"]}"] = field["v"].to_s.gsub /<sgh="1">([^<]*)<\/sg>/, '\1'
|
32
32
|
when '_si'
|
33
33
|
# FIXME do nothing - we don't handle this yet
|
34
34
|
else
|
@@ -36,7 +36,12 @@ class Splunk
|
|
36
36
|
when '_time'
|
37
37
|
rres[:"#{field["@k"]}"] = Time.parse field["value"]["text"].to_s
|
38
38
|
else
|
39
|
-
|
39
|
+
if field["value"].instance_of? Array
|
40
|
+
rres[:"#{field["@k"]}"] = Array.new unless rres[:"#{field["@k"]}"]
|
41
|
+
field["value"].each { |value| rres[:"#{field["@k"]}"] << value["text"].to_s }
|
42
|
+
else
|
43
|
+
rres[:"#{field["@k"]}"] = field["value"]["text"].to_s
|
44
|
+
end
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|