logstash-output-application_insights 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/logstash/outputs/application_insights.rb +9 -6
- data/lib/logstash/outputs/application_insights/blob.rb +3 -0
- data/lib/logstash/outputs/application_insights/config.rb +4 -0
- data/lib/logstash/outputs/application_insights/constants.rb +1 -0
- data/lib/logstash/outputs/application_insights/test_storage.rb +20 -3
- data/lib/logstash/outputs/application_insights/validate_storage.rb +3 -2
- data/lib/logstash/outputs/application_insights/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfd7fa91c562aaf482965ae4b0243dc64529f053
|
4
|
+
data.tar.gz: 605bd30348073847a7eb42cc2d492f8c8b088fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 019136969939d09b9fc152155f226c118aef4328909a94bd168ca76b212f69b73f4eb52b5c1aa5e953e3c1601be14712cc8fdf370506d60ecaa4e20252b0ed65
|
7
|
+
data.tar.gz: e9b0cddd450f56f5afd3379418e71494d7d88ded7f365d8bcf6f4add8233e933b7367aa1fb542ed38ec80d75963debccbf9cb30a90ed244bbe216aca2de03252
|
data/README.md
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
|
15
15
|
* Logstash 2.3.2
|
16
16
|
* Logstash 2.3.4
|
17
|
+
* Logstash 2.4.0
|
18
|
+
* Logstash 5.0.0
|
17
19
|
|
18
20
|
Note:
|
19
21
|
|
@@ -122,6 +124,7 @@ storage_account_name_key => [ ["my-storage-account1", "key1"], "my-storage-accou
|
|
122
124
|
|
123
125
|
storage_account_name_key => [ ["my-storage-account1", ["key11", "key12"]], ["my-storage-account1", "key2"], ["my-storage-account1", ["key3"] ]
|
124
126
|
```
|
127
|
+
**Note: the storage account must be of "General purpose" kind.**
|
125
128
|
|
126
129
|
### azure_storage_table_prefix
|
127
130
|
A prefix for the azure storage tables name used by this Logstash instance. Default host name
|
@@ -309,6 +309,10 @@ class LogStash::Outputs::Application_insights < LogStash::Outputs::Base
|
|
309
309
|
|
310
310
|
def register
|
311
311
|
|
312
|
+
# puts "++ SETTINGS: #{LogStash::SETTINGS.to_hash}"
|
313
|
+
# @logger.info("test test", :xx => "xx", :yy => 1)
|
314
|
+
# puts "++ LOGSTASH_HOME: #{LogStash::Environment::LOGSTASH_HOME}"
|
315
|
+
|
312
316
|
# logstash define: @original_params = original_params
|
313
317
|
# logstash define: @config = params
|
314
318
|
|
@@ -321,7 +325,6 @@ class LogStash::Outputs::Application_insights < LogStash::Outputs::Base
|
|
321
325
|
|
322
326
|
# be careful don't use here @logger, as it will override Logstash @logger, and may create starnge behaviour
|
323
327
|
@private_logger = configuration[:logger]
|
324
|
-
|
325
328
|
@private_logger.info { "configuration: #{masked_configuration}" }
|
326
329
|
|
327
330
|
@telemetry = Telemetry.instance
|
@@ -334,14 +337,14 @@ class LogStash::Outputs::Application_insights < LogStash::Outputs::Base
|
|
334
337
|
@shutdown_recovery = Shutdown_recovery.instance
|
335
338
|
|
336
339
|
if @validate_notification
|
337
|
-
|
338
|
-
raise ConfigurationError, "Failed to access application insights at #{configuration[:application_insights_endpoint]}, due to error #{
|
340
|
+
result = Validate_notification.new.validate
|
341
|
+
raise ConfigurationError, "Failed to access application insights at #{configuration[:application_insights_endpoint]}, due to error #{result[:error].inspect}" unless result[:success]
|
339
342
|
end
|
340
343
|
|
341
344
|
if @validate_storage
|
342
|
-
|
343
|
-
|
344
|
-
raise ConfigurationError, "Failed
|
345
|
+
results = Validate_storage.new.validate
|
346
|
+
results.each do |result|
|
347
|
+
raise ConfigurationError, "Failed to #{result[:test]} in azure storage account #{result[:storage_account_name]}, due to error #{result[:error].inspect}" unless result[:success]
|
345
348
|
end
|
346
349
|
end
|
347
350
|
|
@@ -269,6 +269,9 @@ class LogStash::Outputs::Application_insights
|
|
269
269
|
elsif 500 == e.status_code && "Unknown" == e.type && e.description.include?("Processing error")
|
270
270
|
:notification_process_down
|
271
271
|
|
272
|
+
elsif 501 == e.status_code
|
273
|
+
:not_implemented
|
274
|
+
|
272
275
|
elsif 503 == e.status_code
|
273
276
|
:service_unavailable
|
274
277
|
|
@@ -215,6 +215,7 @@ class LogStash::Outputs::Application_insights
|
|
215
215
|
|
216
216
|
configuration[:state_table_name] = AZURE_STORAGE_TABLE_LOGSTASH_PREFIX + configuration[:azure_storage_table_prefix] + STATE_TABLE_NAME
|
217
217
|
configuration[:test_storage_container] = AZURE_STORAGE_CONTAINER_LOGSTASH_PREFIX + configuration[:azure_storage_container_prefix] + "-" + STORAGE_TEST_CONTAINER_NAME
|
218
|
+
configuration[:test_storage_table] = AZURE_STORAGE_TABLE_LOGSTASH_PREFIX + configuration[:azure_storage_table_prefix] + STORAGE_TEST_TABLE_NAME
|
218
219
|
configuration[:partition_key_prefix] = configuration[:azure_storage_blob_prefix].gsub( "/", "" )
|
219
220
|
configuration[:local_file_prefix] = LOCAL_FS_FILE_PREFIX + configuration[:azure_storage_blob_prefix].gsub( "/", "_" )
|
220
221
|
|
@@ -231,6 +232,9 @@ class LogStash::Outputs::Application_insights
|
|
231
232
|
masked_keys = keys.map { |key| "*****************" }
|
232
233
|
[ name, masked_keys ]
|
233
234
|
}
|
235
|
+
masked_configuration.each_pair do |key, value|
|
236
|
+
masked_configuration[key] = "nil" if value.nil?
|
237
|
+
end
|
234
238
|
masked_configuration[:storage_account_name_key] = masked_storage_account_name_key
|
235
239
|
masked_configuration
|
236
240
|
end
|
@@ -152,6 +152,7 @@ class LogStash::Outputs::Application_insights
|
|
152
152
|
|
153
153
|
STATE_TABLE_NAME = "BlobsState"
|
154
154
|
STORAGE_TEST_CONTAINER_NAME = "test-container"
|
155
|
+
STORAGE_TEST_TABLE_NAME = "TestTable"
|
155
156
|
|
156
157
|
AZURE_STORAGE_CONTAINER_LOGSTASH_PREFIX = "logstash" # lower case only, dash allowed
|
157
158
|
AZURE_STORAGE_BLOB_LOGSTASH_PREFIX = "logstash"
|
@@ -26,17 +26,34 @@ class LogStash::Outputs::Application_insights
|
|
26
26
|
# super first parameter must be nil. blob first parameter is channel, otherwise it will pass storage_account_name as channel
|
27
27
|
super( nil )
|
28
28
|
@storage_account_name = storage_account_name
|
29
|
+
@test_storage_container = @configuration[:test_storage_container]
|
30
|
+
@test_storage_table = @configuration[:test_storage_table]
|
29
31
|
@action = :test_storage
|
30
|
-
@
|
31
|
-
@recoverable = [ :invalid_storage_key, :container_exist, :create_container ]
|
32
|
+
@base_info = "#{@action} #{@storage_account_name}"
|
33
|
+
@recoverable = [ :invalid_storage_key, :container_exist, :create_container, :table_exist, :create_table ]
|
32
34
|
@force_client = true # to enable get a client even if all storage_accounts marked dead
|
33
35
|
end
|
34
36
|
|
35
37
|
def test
|
38
|
+
test_container
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_container
|
42
|
+
@max_tries = 1
|
43
|
+
@info = "#{@base_info} - create #{@test_storage_container} container"
|
44
|
+
storage_io_block {
|
45
|
+
if @recovery.nil? || :invalid_storage_key == @recovery
|
46
|
+
@client.blobClient.create_container( @test_storage_container ) unless @configuration[:disable_blob_upload]
|
47
|
+
end
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_table
|
36
52
|
@max_tries = 1
|
53
|
+
@info = "#{@base_info} - create #{@test_storage_table} table"
|
37
54
|
storage_io_block {
|
38
55
|
if @recovery.nil? || :invalid_storage_key == @recovery
|
39
|
-
@client.
|
56
|
+
@client.tableClient.create_table( @test_storage_table ) unless @configuration[:disable_blob_upload]
|
40
57
|
end
|
41
58
|
}
|
42
59
|
end
|
@@ -30,10 +30,11 @@ class LogStash::Outputs::Application_insights
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def validate
|
33
|
-
result =
|
33
|
+
result = []
|
34
34
|
@storage_account_name_key.each do |storage_account_name, storage_account_keys|
|
35
35
|
test_storage = Test_storage.new( storage_account_name )
|
36
|
-
result
|
36
|
+
result << { :storage_account_name => storage_account_name, :test => "create container", :success => test_storage.test_container, :error => test_storage.last_io_exception }
|
37
|
+
result << { :storage_account_name => storage_account_name, :test => "create table", :success => test_storage.test_table, :error => test_storage.last_io_exception }
|
37
38
|
end
|
38
39
|
result
|
39
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-application_insights
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|