fluent-plugin-sakuraio 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-sakuraio.gemspec +1 -1
- data/lib/fluent/plugin/in_sakuraio.rb +34 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6712d46b36dde0fe009071239eb134000000772c
|
4
|
+
data.tar.gz: 6056609261455bfe84e5c6ea80870b5ac2eb1f49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32b94b4200dd4579a9bb50ba5a529c82e8a825ba4ba9943c6185e53f1954a09efae3cf4438c275a8a988e33303671b45f9ba0d90f08cc2bfeffd1dec7afb944c
|
7
|
+
data.tar.gz: c9033ee4c315d830bbc9aabb1bed03606ed154a5d665d624023b6f4ae3f727d79bfd421546412ad0c6998e35bbdd8897d332bf061dbb37537a6fb5765844ae91
|
@@ -61,6 +61,10 @@ module Fluent::Plugin
|
|
61
61
|
j = parser.parse(text)
|
62
62
|
records = []
|
63
63
|
case j['type']
|
64
|
+
when 'connection' then
|
65
|
+
parse_connection(records, j)
|
66
|
+
when 'location' then
|
67
|
+
parse_location(records, j)
|
64
68
|
when 'channels' then
|
65
69
|
parse_channels(records, j)
|
66
70
|
else
|
@@ -69,12 +73,41 @@ module Fluent::Plugin
|
|
69
73
|
records
|
70
74
|
end
|
71
75
|
|
76
|
+
def parse_connection(records, j)
|
77
|
+
record = {
|
78
|
+
'tag' => j['module'] + '.connection',
|
79
|
+
'record' => {
|
80
|
+
'is_online' => j['payload']['is_online']
|
81
|
+
},
|
82
|
+
'time' => Time.parse(j['datetime']).to_i
|
83
|
+
}
|
84
|
+
records.push(record)
|
85
|
+
records
|
86
|
+
end
|
87
|
+
|
88
|
+
def parse_location(records, j)
|
89
|
+
c = j['payload']['coordinate']
|
90
|
+
if c != 'null'
|
91
|
+
record = {
|
92
|
+
'tag' => j['module'] + '.location',
|
93
|
+
'record' => {
|
94
|
+
'latitude' => c['latitude'],
|
95
|
+
'longitude' => c['longitude'],
|
96
|
+
'range_m' => c['range_m']
|
97
|
+
},
|
98
|
+
'time' => Time.parse(j['datetime']).to_i
|
99
|
+
}
|
100
|
+
records.push(record)
|
101
|
+
end
|
102
|
+
records
|
103
|
+
end
|
104
|
+
|
72
105
|
def parse_channels(records, j)
|
73
106
|
message_time = Time.parse(j['datetime']).to_i
|
74
107
|
tag = j['module']
|
75
108
|
j['payload']['channels'].each do |c|
|
76
109
|
record = {
|
77
|
-
'tag' => tag + '.' + c['channel'].to_s,
|
110
|
+
'tag' => tag + '.channels.' + c['channel'].to_s,
|
78
111
|
'record' => {
|
79
112
|
'channel' => c['channel'],
|
80
113
|
'type' => c['type'],
|