logstash-output-monasca_log_api 0.3.3 → 0.4
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.
- checksums.yaml +4 -4
- data/LICENSE +9 -7
- data/README.md +82 -40
- data/lib/logstash/outputs/helper/url_helper.rb +15 -14
- data/lib/logstash/outputs/keystone/keystone_client.rb +49 -20
- data/lib/logstash/outputs/keystone/token.rb +47 -18
- data/lib/logstash/outputs/monasca/monasca_log_api_client.rb +32 -39
- data/lib/logstash/outputs/monasca_log_api.rb +159 -77
- data/logstash-output-monasca_log_api.gemspec +5 -4
- data/spec/outputs/helper/url_helper_spec.rb +27 -18
- data/spec/outputs/keystone/keystone_client_spec.rb +127 -39
- data/spec/outputs/keystone/token_spec.rb +31 -26
- data/spec/outputs/monasca/monasca_log_api_client_spec.rb +80 -0
- data/spec/outputs/monasca_log_api_spec.rb +433 -0
- data/spec/outputs/spec_helper.rb +13 -13
- metadata +26 -12
- data/spec/outputs/monasca/monasca_api_client_spec.rb +0 -105
- data/spec/outputs/monasca_api_spec.rb +0 -131
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59bde00a1b625fee42b79d0244c9f5bbb8852ca7
|
4
|
+
data.tar.gz: 906cf828c864a7b3f7d913d96cf26e47677afa10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53bbbb42df6fcd83d4e7c31fbb93382607d497bcb69cd9585ae06578bf65542422ac661632061aedc71e86d9deeefa009811ea0048e11e944acf83a7e28ea751
|
7
|
+
data.tar.gz: 1154db9689c90dc9fadbe66076efe87c26f54ad04babcda105f6a18467b1056d10d05e16d59ae9f22acaa0092aa44a8e2a4d47bf9de273f07b34af1583bb803b
|
data/LICENSE
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
Copyright
|
1
|
+
Copyright 2016 FUJITSU LIMITED
|
2
2
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
4
|
-
in compliance with the License. You may obtain a copy of
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
4
|
+
use this file except in compliance with the License. You may obtain a copy of
|
5
|
+
the License at
|
5
6
|
|
6
7
|
http://www.apache.org/licenses/LICENSE-2.0
|
7
8
|
|
8
|
-
Unless required by applicable law or agreed to in writing, software
|
9
|
-
is distributed on an "AS IS" BASIS, WITHOUT
|
10
|
-
|
11
|
-
the
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12
|
+
License for the specific language governing permissions and limitations under
|
13
|
+
the License.
|
data/README.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
# Logstash Output Monasca-Log-Api Plugin
|
2
|
+
This module is a logstash-output-plugin for the Monasca Log Api.
|
3
|
+
|
4
|
+
## Get latest stable version
|
5
|
+
https://rubygems.org/gems/logstash-output-monasca_log_api
|
6
|
+
|
7
|
+
```bash
|
8
|
+
gem install logstash-output-monasca_log_api
|
9
|
+
```
|
2
10
|
|
3
11
|
## Build from source
|
4
12
|
|
@@ -9,27 +17,15 @@
|
|
9
17
|
* Git
|
10
18
|
* bundler
|
11
19
|
|
12
|
-
###
|
13
|
-
|
14
|
-
#### Ubuntu 14.04
|
20
|
+
### Install requirements
|
15
21
|
|
16
|
-
|
22
|
+
#### RVM
|
17
23
|
```bash
|
18
24
|
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
|
19
25
|
\curl -sSL https://get.rvm.io | bash
|
20
26
|
source /home/vagrant/.rvm/scripts/rvm
|
21
27
|
```
|
22
28
|
|
23
|
-
#### Git
|
24
|
-
```bash
|
25
|
-
sudo apt-get install git
|
26
|
-
```
|
27
|
-
|
28
|
-
#### JDK
|
29
|
-
```bash
|
30
|
-
sudo apt-get install default-jdk
|
31
|
-
```
|
32
|
-
|
33
29
|
#### JRuby
|
34
30
|
```bash
|
35
31
|
rvm install jruby
|
@@ -41,7 +37,7 @@ rvm install jruby
|
|
41
37
|
git clone https://github.com/FujitsuEnablingSoftwareTechnologyGmbH/logstash-output-monasca_api.git
|
42
38
|
```
|
43
39
|
|
44
|
-
### Use
|
40
|
+
### Use jruby
|
45
41
|
```bash
|
46
42
|
rvm use jruby
|
47
43
|
```
|
@@ -75,8 +71,15 @@ JRUBY_OPTS="-Xcli.debug=true --debug" bundle exec rspec
|
|
75
71
|
|
76
72
|
Coverage report can be found in ./coverage
|
77
73
|
|
74
|
+
### Code style check
|
75
|
+
```bash
|
76
|
+
rubocop lib/
|
77
|
+
```
|
78
|
+
|
78
79
|
## Deploy Plugin to logstash
|
79
80
|
|
81
|
+
Source: [https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_output_plugin.html#_building_and_testing_4](https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_output_plugin.html#_building_and_testing_4)
|
82
|
+
|
80
83
|
### Build Gemfile
|
81
84
|
First we need to create a Gemfile.
|
82
85
|
|
@@ -89,7 +92,7 @@ gem build logstash-output-monasca_log_api.gemspec
|
|
89
92
|
|
90
93
|
### Deploy Gemfile to logstash
|
91
94
|
|
92
|
-
* [Download logstash](
|
95
|
+
* [Download logstash](https://download.elastic.co/logstash/logstash/logstash-2.2.2.tar.gz) (>=2.2.0)
|
93
96
|
* Extract logstash and navigate into the folder
|
94
97
|
* Add this line to the Gemfile
|
95
98
|
|
@@ -112,34 +115,57 @@ With ``bin/plugin list`` you can check installed plugins. There should be ``logs
|
|
112
115
|
|
113
116
|
### Configuration
|
114
117
|
|
115
|
-
|
118
|
+
Plugin name: monasca_log_api
|
116
119
|
|
117
|
-
|
118
|
-
| - | - | - | - |
|
119
|
-
| monasca_log_api | monasca log api url | yes | http://192.168.10.4:8080 |
|
120
|
-
| keystone_api | keystone api url | yes | http://192.168.10.5:5000 |
|
121
|
-
| project_name | User-credentials: keystone project name | yes | mini-mon |
|
122
|
-
| username | User-credentials: keystone username | yes | admin-agent |
|
123
|
-
| password | User-credentials: keystone user password | yes | password |
|
124
|
-
| domain_id | User-credentials: keystone user domain-id | yes | default |
|
125
|
-
| dimensions | Dictionary of key-value pairs to describe logs | no | hostname: monasca, ip: 192.168.10.4 |
|
126
|
-
| application_type_key | Application name | no | monasca |
|
120
|
+
Save the configfile wherever you like. For example ~/logstash.conf
|
127
121
|
|
128
|
-
|
122
|
+
| name | description | type | required | default | example |
|
123
|
+
| --- | --- | --- | --- | --- | --- |
|
124
|
+
| monasca_log_api | monasca log api url | string | true | | http://192.168.10.4:8080 |
|
125
|
+
| monasca_log_api_version | monasca log api version | string | false | v3.0 | |
|
126
|
+
| keystone_api | keystone api url | string | true | | http://192.168.10.5:35357/v3 |
|
127
|
+
| project_name | Keystone user credentials: project name | string | true | | monasca |
|
128
|
+
| username | Keystone user credentials: username | string | true | | admin-agent |
|
129
|
+
| password | Keystone user credentials: password | string | true | | password |
|
130
|
+
| domain_id | Keystone user credentials: domain-id | string | true | | default |
|
131
|
+
| dimensions | global array dimensions in form of key-value pairs to describe the monitored node | array | false | | ['app_type:kafka', 'priority:high'] |
|
132
|
+
| num_of_logs | maximum number of logs that are send by one request to monasca-log-api | number | false | 125 | |
|
133
|
+
| elapsed_time_sec | send logs if the maximum elapsed time in seconds is reached | number | false | 30 | |
|
134
|
+
| delay | delay time in seconds to wait before checking the elapsed_time_sec again | number | false | 10 | |
|
135
|
+
| max_data_size_kb | maximum size in kb of logs that are send by one request to monasca-log-api | number | false | 5120 | |
|
136
|
+
|
137
|
+
#### Example configuration files
|
138
|
+
|
139
|
+
##### Simple
|
129
140
|
```bash
|
130
|
-
|
131
|
-
|
141
|
+
output {
|
142
|
+
monasca_log_api {
|
143
|
+
monasca_log_api => "http://192.168.10.4:8074"
|
144
|
+
keystone_api => "http://192.168.10.5:35357/v3"
|
145
|
+
project_name => "cmm"
|
146
|
+
username => "cmm-operator"
|
147
|
+
password => "admin"
|
148
|
+
domain_id => "default"
|
149
|
+
}
|
132
150
|
}
|
151
|
+
```
|
152
|
+
|
153
|
+
##### Complete
|
154
|
+
```bash
|
133
155
|
output {
|
134
156
|
monasca_log_api {
|
135
|
-
monasca_log_api => "http://192.168.10.4:
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
157
|
+
monasca_log_api => "http://192.168.10.4:8074"
|
158
|
+
monasca_log_api_version => "v3.0"
|
159
|
+
keystone_api => "http://192.168.10.5:35357/v3"
|
160
|
+
project_name => "cmm"
|
161
|
+
username => "cmm-operator"
|
162
|
+
password => "admin"
|
140
163
|
domain_id => "default"
|
141
|
-
dimensions => "hostname:
|
142
|
-
|
164
|
+
dimensions => ["hostname:kamil", "ip:10.10.10.10"]
|
165
|
+
num_of_logs => 100
|
166
|
+
delay => 1
|
167
|
+
elapsed_time_sec => 600
|
168
|
+
max_data_size_kb => 5120
|
143
169
|
}
|
144
170
|
}
|
145
171
|
```
|
@@ -158,10 +184,26 @@ Specify log output file
|
|
158
184
|
```bash
|
159
185
|
bin/logstash -f ~/logstash.conf -l /var/log/monasca/log/agent/test-log-agent.log
|
160
186
|
```
|
161
|
-
|
162
|
-
|
187
|
+
|
188
|
+
### Logstash File Input plugin
|
189
|
+
https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html
|
190
|
+
|
191
|
+
#### Configuration
|
192
|
+
|
193
|
+
Local dimensions can be added with ```add_field``` setting
|
194
|
+
|
195
|
+
```bash
|
196
|
+
input {
|
197
|
+
file {
|
198
|
+
add_field => { "dimensions" => { "service" => "monasca-api" }}
|
199
|
+
add_field => { "dimensions" => { "language" => "java" }}
|
200
|
+
add_field => { "dimensions" => { "log_level" => "error" }}
|
201
|
+
path => "/var/log/monasca/api/error.log"
|
202
|
+
}
|
203
|
+
}
|
204
|
+
```
|
163
205
|
|
164
206
|
## Open tasks
|
165
207
|
* Language translations (Replace hardcoded String messages with a configuration/language file)
|
166
208
|
* Exception handling (monasca-api requests)
|
167
|
-
*
|
209
|
+
* https support
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
10
|
-
is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
-
|
12
|
-
the
|
13
|
-
|
1
|
+
# Copyright 2016 FUJITSU LIMITED
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
4
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
5
|
+
# the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12
|
+
# License for the specific language governing permissions and limitations under
|
13
|
+
# the License.
|
14
14
|
|
15
15
|
# encoding: utf-8
|
16
16
|
|
@@ -21,7 +21,8 @@ module LogStash::Outputs
|
|
21
21
|
class UrlHelper
|
22
22
|
def self.generate_url(host, path)
|
23
23
|
uri = URI.parse(host)
|
24
|
-
URI::HTTP.new(uri.scheme, nil, uri.host, uri.port, nil, path, nil,
|
24
|
+
URI::HTTP.new(uri.scheme, nil, uri.host, uri.port, nil, path, nil,
|
25
|
+
nil, nil)
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
10
|
-
is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
-
|
12
|
-
the
|
13
|
-
|
1
|
+
# Copyright 2016 FUJITSU LIMITED
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
4
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
5
|
+
# the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12
|
+
# License for the specific language governing permissions and limitations under
|
13
|
+
# the License.
|
14
14
|
|
15
15
|
# encoding: utf-8
|
16
16
|
|
@@ -42,23 +42,52 @@ module LogStash::Outputs
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def request(auth_hash)
|
45
|
-
@client.post(
|
45
|
+
@client.post(
|
46
|
+
auth_hash,
|
47
|
+
:content_type => 'application/json',
|
48
|
+
:accept => 'application/json')
|
46
49
|
end
|
47
50
|
|
48
51
|
def get_client(host, path)
|
49
|
-
RestClient::Resource.new(
|
52
|
+
RestClient::Resource.new(
|
53
|
+
LogStash::Outputs::Helper::UrlHelper.generate_url(host, path).to_s)
|
50
54
|
end
|
51
55
|
|
52
56
|
def generate_hash(domain_id, username, password, project_name)
|
53
|
-
|
57
|
+
{
|
58
|
+
"auth"=>{
|
59
|
+
"identity"=>{
|
60
|
+
"methods"=>["password"],
|
61
|
+
"password"=>{
|
62
|
+
"user"=>{
|
63
|
+
"domain"=>{"id"=>domain_id},
|
64
|
+
"name"=>username,
|
65
|
+
"password"=>password
|
66
|
+
}
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"scope"=>{
|
70
|
+
"project"=>{
|
71
|
+
"domain"=>{"id"=>domain_id},
|
72
|
+
"name"=>project_name
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}.to_json
|
54
77
|
end
|
55
78
|
|
56
|
-
def handle_response(response)
|
79
|
+
def handle_response(response)
|
57
80
|
case response.code
|
58
81
|
when 201
|
59
|
-
expires_at = DateTime.parse(
|
60
|
-
|
61
|
-
|
82
|
+
expires_at = DateTime.parse(
|
83
|
+
JSON.parse(response.body)["token"]["expires_at"])
|
84
|
+
|
85
|
+
@logger.debug("Authentication succeed: code=#{response.code}, "\
|
86
|
+
"auth-token=#{response.headers[:x_subject_token]}, "\
|
87
|
+
"expires_at=#{expires_at.to_time}")
|
88
|
+
|
89
|
+
{:token => response.headers[:x_subject_token],
|
90
|
+
:expires_at => expires_at}
|
62
91
|
else
|
63
92
|
@logger.info("Authentication failed. Response=#{response}")
|
64
93
|
end
|
@@ -1,31 +1,60 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
10
|
-
is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
-
|
12
|
-
the
|
13
|
-
|
1
|
+
# Copyright 2016 FUJITSU LIMITED
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
4
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
5
|
+
# the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12
|
+
# License for the specific language governing permissions and limitations under
|
13
|
+
# the License.
|
14
14
|
|
15
15
|
# encoding: utf-8
|
16
16
|
|
17
|
+
require 'singleton'
|
18
|
+
require 'logger'
|
19
|
+
require_relative 'keystone_client'
|
20
|
+
|
17
21
|
module LogStash::Outputs
|
18
22
|
module Keystone
|
19
23
|
class Token
|
20
|
-
|
21
|
-
|
24
|
+
include Singleton
|
25
|
+
attr_accessor :id, :expires_at, :keystone_client
|
26
|
+
|
27
|
+
def request_new_token(domain_id, username, password, project_name)
|
28
|
+
token = @keystone_client
|
29
|
+
.authenticate(domain_id, username, password, project_name)
|
30
|
+
set_token(token[:token], token[:expires_at])
|
31
|
+
@logger.info("New token requested")
|
32
|
+
@logger.debug("token=#{@id}, expire_at=#{@expires_at}")
|
33
|
+
end
|
34
|
+
|
35
|
+
def set_token id, expires_at
|
22
36
|
@id = id
|
23
|
-
@
|
37
|
+
@expires_at = expires_at
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_keystone_client keystone_api
|
41
|
+
@keystone_client = LogStash::Outputs::Keystone::KeystoneClient
|
42
|
+
.new keystone_api
|
24
43
|
end
|
25
44
|
|
26
|
-
def
|
27
|
-
|
45
|
+
def initialize
|
46
|
+
@logger = Cabin::Channel.get(LogStash)
|
28
47
|
end
|
48
|
+
|
49
|
+
def valid?
|
50
|
+
token_valid = true
|
51
|
+
now = DateTime.now + Rational(1, 1440)
|
52
|
+
if @id.nil? or now >= @expires_at
|
53
|
+
token_valid = false
|
54
|
+
end
|
55
|
+
token_valid
|
56
|
+
end
|
57
|
+
|
29
58
|
end
|
30
59
|
end
|
31
60
|
end
|
@@ -1,73 +1,66 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
|
9
|
-
Unless required by applicable law or agreed to in writing, software
|
10
|
-
is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
-
|
12
|
-
the
|
13
|
-
|
1
|
+
# Copyright 2016 FUJITSU LIMITED
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
4
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
5
|
+
# the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12
|
+
# License for the specific language governing permissions and limitations under
|
13
|
+
# the License.
|
14
14
|
|
15
15
|
# encoding: utf-8
|
16
16
|
|
17
17
|
require 'rest-client'
|
18
18
|
require 'logger'
|
19
|
+
require 'singleton'
|
19
20
|
|
20
21
|
# relative requirements
|
21
22
|
require_relative '../helper/url_helper'
|
22
23
|
|
23
|
-
# This class creates a connection to monasca-api
|
24
|
+
# This class creates a connection to monasca-log-api
|
24
25
|
module LogStash::Outputs
|
25
26
|
module Monasca
|
26
27
|
class MonascaLogApiClient
|
27
28
|
|
28
|
-
SUPPORTED_API_VERSION = %w(
|
29
|
+
SUPPORTED_API_VERSION = %w(3.0)
|
29
30
|
|
30
31
|
def initialize(host, version)
|
31
32
|
@logger = Cabin::Channel.get(LogStash)
|
32
|
-
|
33
|
-
|
33
|
+
rest_client_url = LogStash::Outputs::Helper::UrlHelper
|
34
|
+
.generate_url(host, '/' + check_version(version)).to_s
|
35
|
+
@rest_client = RestClient::Resource.new(rest_client_url)
|
34
36
|
end
|
35
37
|
|
36
|
-
|
37
|
-
def send_event(event, data, token, dimensions, application_type=nil)
|
38
|
+
def send_logs(logs, auth_token)
|
38
39
|
begin
|
39
|
-
|
40
|
-
|
40
|
+
post_header = {
|
41
|
+
'X-Auth-Token' => auth_token,
|
42
|
+
'Content-Type' => 'application/json',
|
43
|
+
}
|
44
|
+
request(logs.to_json, post_header)
|
41
45
|
rescue => e
|
42
|
-
@logger.warn('Sending event to monasca-log-api threw exception',
|
46
|
+
@logger.warn('Sending event to monasca-log-api threw exception',
|
47
|
+
:exceptionew => e)
|
43
48
|
end
|
44
49
|
end
|
45
50
|
|
46
51
|
private
|
47
52
|
|
48
|
-
def request(
|
49
|
-
|
50
|
-
|
51
|
-
:content_type => 'application/json',
|
52
|
-
}
|
53
|
-
if dimensions
|
54
|
-
post_headers[:x_dimensions] = dimensions
|
55
|
-
end
|
56
|
-
|
57
|
-
if application_type
|
58
|
-
post_headers[:x_application_type] = application_type
|
59
|
-
end
|
60
|
-
|
61
|
-
@logger.debug('Sending data to ', :url => @rest_client_url)
|
62
|
-
@rest_client['log']['single'].post(data, post_headers)
|
53
|
+
def request(body, header)
|
54
|
+
@logger.debug('Sending data to ', :url => @rest_client.url)
|
55
|
+
@rest_client['logs'].post(body, header)
|
63
56
|
end
|
64
57
|
|
65
|
-
|
66
58
|
def check_version(version)
|
67
59
|
tmp_version = version.sub('v','')
|
68
60
|
|
69
61
|
unless SUPPORTED_API_VERSION.include? tmp_version
|
70
|
-
raise "#{tmp_version} is not supported,
|
62
|
+
raise "#{tmp_version} is not supported, "\
|
63
|
+
"supported versions are #{SUPPORTED_API_VERSION}"
|
71
64
|
end
|
72
65
|
|
73
66
|
version
|