logs-cf-plugin 0.0.32.pre → 0.0.33.pre
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 +8 -8
- data/lib/logs-cf-plugin/loggregator_client.rb +12 -5
- data/lib/logs-cf-plugin/plugin.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGZkN2I0YWQ1OThkOWQ3OGIxYzJkODBmZDE3MmIxMWRiNmU1NzZkZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTBhODJmZjkwZjc2NWUxZDM0MWY4NGE0ZjE0Yjg4NzQzZWQyYzBkMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MThkMjRiMTViMmIzZWUyMDUxMDllOWVlYzIxN2I1NWFiZDFiYWI0MDhmM2Ni
|
10
|
+
NzI3YjZiNTZlMTYyZWI1YzQ2MmE0ODU0ZWI5MDllODFjZjY1ZDViY2FjOGYy
|
11
|
+
ODE4N2FhYzk5OGYxZWY1NTAxY2E0NjY4ODM5ZWQwOWFiZjM4ZjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmU0NjZhMjlmOTkwY2Q2OGMwZGNkNDhiZDJlNjJjOWI4NDQ3ZGYzOTc3ZDll
|
14
|
+
MTQ3ZTllN2Q3NzhjNjk5Zjk0YmNmZmFjNmI5MDFiODRhNDJjMjI4NjZlNTNk
|
15
|
+
NDc3MWE2YmExOTgwZGM1YzA0YWVkNjEyYTRkZGU2MDQ2MDk4ZTc=
|
@@ -3,15 +3,21 @@ module LogsCfPlugin
|
|
3
3
|
include CFoundry::TraceHelpers
|
4
4
|
include MessageWriter
|
5
5
|
|
6
|
-
def initialize(loggregator_host, user_token, output, trace)
|
6
|
+
def initialize(loggregator_host, user_token, output, trace, use_ssl = true)
|
7
7
|
@output = output
|
8
8
|
@loggregator_host = loggregator_host
|
9
9
|
@user_token = user_token
|
10
10
|
@trace = trace
|
11
|
+
@use_ssl = use_ssl
|
11
12
|
end
|
12
13
|
|
13
14
|
def listen(query_params)
|
14
|
-
|
15
|
+
if use_ssl
|
16
|
+
websocket_address = "wss://#{loggregator_host}:4443/tail/?#{hash_to_query(query_params)}"
|
17
|
+
else
|
18
|
+
websocket_address = "ws://#{loggregator_host}/tail/?#{hash_to_query(query_params)}"
|
19
|
+
end
|
20
|
+
|
15
21
|
output.puts "websocket_address: #{websocket_address}" if trace
|
16
22
|
|
17
23
|
EM.run {
|
@@ -58,9 +64,10 @@ module LogsCfPlugin
|
|
58
64
|
end
|
59
65
|
|
60
66
|
def dump_messages(query_params)
|
61
|
-
|
67
|
+
prefix = use_ssl ? 'https' : 'http'
|
68
|
+
uri = URI.parse("#{prefix}://#{loggregator_host}/dump/?#{hash_to_query(query_params)}")
|
62
69
|
http = Net::HTTP.new(uri.host, uri.port)
|
63
|
-
http.use_ssl =
|
70
|
+
http.use_ssl = use_ssl
|
64
71
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
65
72
|
|
66
73
|
request = Net::HTTP::Get.new(uri.request_uri)
|
@@ -126,6 +133,6 @@ module LogsCfPlugin
|
|
126
133
|
return URI.encode(hash.map { |k, v| "#{k}=#{v}" }.join("&"))
|
127
134
|
end
|
128
135
|
|
129
|
-
attr_reader :output, :loggregator_host, :user_token, :trace
|
136
|
+
attr_reader :output, :loggregator_host, :user_token, :trace, :use_ssl
|
130
137
|
end
|
131
138
|
end
|
@@ -29,7 +29,7 @@ module LogsCfPlugin
|
|
29
29
|
fail "Please provide an application to log."
|
30
30
|
end
|
31
31
|
|
32
|
-
loggregator_client = LoggregatorClient.new(loggregator_host, client.token.auth_header, STDOUT, input[:trace])
|
32
|
+
loggregator_client = LoggregatorClient.new(loggregator_host, client.token.auth_header, STDOUT, input[:trace], use_ssl)
|
33
33
|
|
34
34
|
if input[:recent]
|
35
35
|
loggregator_client.dump_messages(log_target.query_params)
|
@@ -46,5 +46,9 @@ module LogsCfPlugin
|
|
46
46
|
target_base = client.target.sub(/^https?:\/\/([^\.]+\.)?(.+)\/?/, '\2')
|
47
47
|
"loggregator.#{target_base}"
|
48
48
|
end
|
49
|
+
|
50
|
+
def use_ssl
|
51
|
+
client.target.start_with?('https')
|
52
|
+
end
|
49
53
|
end
|
50
|
-
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logs-cf-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.33.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pivotal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cf
|