logstash-input-azurewadtable 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +25 -34
- data/CHANGELOG.md +0 -0
- data/Gemfile +0 -3
- data/LICENSE +0 -17
- data/README.md +0 -91
- data/Rakefile +0 -1
- data/lib/logstash/inputs/azurewadtable.rb +0 -125
- data/logstash-input-azurewadtable.gemspec +0 -24
- data/spec/inputs/azurewadtable_spec.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f6de3a1e70eaf98e44d3363ebf01b2d64f3f37e
|
4
|
+
data.tar.gz: dee366f2ec4288ad9fa364c00f5d27dec133bd47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7880dfd70b8e3356934594525f20c1faa8688fd6af6805fc63d9b47c70fefd1ac8b1509a1b26eb0e0dcb37c5987c3b8b2b5dfc55d181500c4ae09dc8dcbb511
|
7
|
+
data.tar.gz: 15ff8a51d2ab6cd6af2c213d31e98cc77be6990ca1d24ba6945ad18224c8f7d43e434ece5ea94a5ce24aba8bc606ce9c128c8fc77b9d1733841524410ed3d7d9
|
metadata
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-azurewadtable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - '>='
|
18
17
|
- !ruby/object:Gem::Version
|
@@ -20,7 +19,10 @@ dependencies:
|
|
20
19
|
- - <
|
21
20
|
- !ruby/object:Gem::Version
|
22
21
|
version: 2.0.0
|
23
|
-
|
22
|
+
name: logstash-core
|
23
|
+
prerelease: false
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
26
|
requirements:
|
25
27
|
- - '>='
|
26
28
|
- !ruby/object:Gem::Version
|
@@ -28,51 +30,41 @@ dependencies:
|
|
28
30
|
- - <
|
29
31
|
- !ruby/object:Gem::Version
|
30
32
|
version: 2.0.0
|
31
|
-
prerelease: false
|
32
|
-
type: :runtime
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name: azure
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ~>
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 0.6.4
|
40
34
|
requirement: !ruby/object:Gem::Requirement
|
41
35
|
requirements:
|
42
36
|
- - ~>
|
43
37
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.
|
38
|
+
version: 0.7.1
|
39
|
+
name: azure
|
45
40
|
prerelease: false
|
46
41
|
type: :runtime
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: logstash-devutils
|
49
42
|
version_requirements: !ruby/object:Gem::Requirement
|
50
43
|
requirements:
|
51
44
|
- - ~>
|
52
45
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
46
|
+
version: 0.7.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
54
48
|
requirement: !ruby/object:Gem::Requirement
|
55
49
|
requirements:
|
56
|
-
- -
|
50
|
+
- - '>='
|
57
51
|
- !ruby/object:Gem::Version
|
58
|
-
version: 0
|
52
|
+
version: '0'
|
53
|
+
name: logstash-devutils
|
59
54
|
prerelease: false
|
60
55
|
type: :development
|
61
|
-
|
62
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program.
|
62
|
+
email: azdiag@microsoft.com
|
63
63
|
executables: []
|
64
64
|
extensions: []
|
65
65
|
extra_rdoc_files: []
|
66
|
-
files:
|
67
|
-
|
68
|
-
- Gemfile
|
69
|
-
- LICENSE
|
70
|
-
- README.md
|
71
|
-
- Rakefile
|
72
|
-
- lib/logstash/inputs/azurewadtable.rb
|
73
|
-
- logstash-input-azurewadtable.gemspec
|
74
|
-
- spec/inputs/azurewadtable_spec.rb
|
75
|
-
homepage: https://github.com/juliusl/logstash-input-azurewadtable/
|
66
|
+
files: []
|
67
|
+
homepage: https://github.com/juliusl/logstash-input-azurewadtable
|
76
68
|
licenses:
|
77
69
|
- Apache License (2.0)
|
78
70
|
metadata:
|
@@ -94,9 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
86
|
version: '0'
|
95
87
|
requirements: []
|
96
88
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.4.
|
89
|
+
rubygems_version: 2.4.8
|
98
90
|
signing_key:
|
99
91
|
specification_version: 4
|
100
92
|
summary: This plugin will collect Microsoft Azure Diagnostics data from Azure Storage.
|
101
|
-
test_files:
|
102
|
-
- spec/inputs/azurewadtable_spec.rb
|
93
|
+
test_files: []
|
data/CHANGELOG.md
DELETED
File without changes
|
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
Copyright (c) Microsoft. All rights reserved.
|
3
|
-
Microsoft would like to thank its contributors, a list
|
4
|
-
of whom are at http://aka.ms/entlib-contributors
|
5
|
-
|
6
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you
|
7
|
-
may not use this file except in compliance with the License. You may
|
8
|
-
obtain a copy of the License at
|
9
|
-
|
10
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
|
12
|
-
Unless required by applicable law or agreed to in writing, software
|
13
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
15
|
-
implied. See the License for the specific language governing permissions
|
16
|
-
and limitations under the License.
|
17
|
-
|
data/README.md
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
# Notice
|
2
|
-
This plugin is a part of [Microsoft Azure Diagnostics with ELK](https://github.com/mspnp/semantic-logging/tree/v3/ELK).
|
3
|
-
|
4
|
-
[See more documentation.](https://github.com/mspnp/semantic-logging/blob/v3/ELK/md/LogstashExtensions.md#azure-wad-table)
|
5
|
-
|
6
|
-
# Logstash Plugin
|
7
|
-
|
8
|
-
This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
|
9
|
-
|
10
|
-
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
|
11
|
-
|
12
|
-
## Documentation
|
13
|
-
|
14
|
-
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elasticsearch.org/guide/en/logstash/current/).
|
15
|
-
|
16
|
-
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
17
|
-
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
|
18
|
-
|
19
|
-
## Need Help?
|
20
|
-
|
21
|
-
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
22
|
-
|
23
|
-
## Developing
|
24
|
-
|
25
|
-
### 1. Plugin Developement and Testing
|
26
|
-
|
27
|
-
#### Code
|
28
|
-
- To get started, you'll need JRuby with the Bundler gem installed.
|
29
|
-
|
30
|
-
- Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
|
31
|
-
|
32
|
-
- Install dependencies
|
33
|
-
```sh
|
34
|
-
bundle install
|
35
|
-
```
|
36
|
-
|
37
|
-
#### Test
|
38
|
-
|
39
|
-
- Update your dependencies
|
40
|
-
|
41
|
-
```sh
|
42
|
-
bundle install
|
43
|
-
```
|
44
|
-
|
45
|
-
- Run tests
|
46
|
-
|
47
|
-
```sh
|
48
|
-
bundle exec rspec
|
49
|
-
```
|
50
|
-
|
51
|
-
### 2. Running your unpublished Plugin in Logstash
|
52
|
-
|
53
|
-
#### 2.1 Run in a local Logstash clone
|
54
|
-
|
55
|
-
- Edit Logstash `Gemfile` and add the local plugin path, for example:
|
56
|
-
```ruby
|
57
|
-
gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
58
|
-
```
|
59
|
-
- Install plugin
|
60
|
-
```sh
|
61
|
-
bin/plugin install --no-verify
|
62
|
-
```
|
63
|
-
- Run Logstash with your plugin
|
64
|
-
```sh
|
65
|
-
bin/logstash -e 'filter {awesome {}}'
|
66
|
-
```
|
67
|
-
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
|
68
|
-
|
69
|
-
#### 2.2 Run in an installed Logstash
|
70
|
-
|
71
|
-
You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
|
72
|
-
|
73
|
-
- Build your plugin gem
|
74
|
-
```sh
|
75
|
-
gem build logstash-filter-awesome.gemspec
|
76
|
-
```
|
77
|
-
- Install the plugin from the Logstash home
|
78
|
-
```sh
|
79
|
-
bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
|
80
|
-
```
|
81
|
-
- Start Logstash and proceed to test the plugin
|
82
|
-
|
83
|
-
## Contributing
|
84
|
-
|
85
|
-
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
86
|
-
|
87
|
-
Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
|
88
|
-
|
89
|
-
It is more important to the community that you are able to contribute.
|
90
|
-
|
91
|
-
For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "logstash/devutils/rake"
|
@@ -1,125 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "logstash/inputs/base"
|
3
|
-
require "logstash/namespace"
|
4
|
-
|
5
|
-
require "azure"
|
6
|
-
|
7
|
-
class LogStash::Inputs::AzureWADTable < LogStash::Inputs::Base
|
8
|
-
class Interrupted < StandardError; end
|
9
|
-
|
10
|
-
config_name "azurewadtable"
|
11
|
-
milestone 0
|
12
|
-
|
13
|
-
config :account_name, :validate => :string
|
14
|
-
config :access_key, :validate => :string
|
15
|
-
config :table_name, :validate => :string
|
16
|
-
config :entity_count_to_process, :validate => :string, :default => 100
|
17
|
-
config :collection_start_time_utc, :validate => :string, :default => Time.now.utc.inspect
|
18
|
-
config :etw_pretty_print, :validate => :boolean, :default => false
|
19
|
-
config :idle_delay_seconds, :validate => :number, :default => 15
|
20
|
-
|
21
|
-
TICKS_SINCE_EPOCH = Time.utc(0001, 01, 01).to_i * 10000000
|
22
|
-
|
23
|
-
def initialize(*args)
|
24
|
-
super(*args)
|
25
|
-
end # initialize
|
26
|
-
|
27
|
-
public
|
28
|
-
def register
|
29
|
-
Azure.configure do |config|
|
30
|
-
config.storage_account_name = @account_name
|
31
|
-
config.storage_access_key = @access_key
|
32
|
-
end
|
33
|
-
@azure_table_service = Azure::TableService.new
|
34
|
-
@last_timestamp = @collection_start_time_utc
|
35
|
-
@idle_delay = @idle_delay_seconds
|
36
|
-
end # register
|
37
|
-
|
38
|
-
public
|
39
|
-
def run(output_queue)
|
40
|
-
loop do
|
41
|
-
@logger.debug("Starting process method @" + Time.now.to_s);
|
42
|
-
process(output_queue)
|
43
|
-
@logger.debug("Starting delay of: " + @idle_delay_seconds.to_s + " seconds @" + Time.now.to_s);
|
44
|
-
sleep @idle_delay
|
45
|
-
end # loop
|
46
|
-
end # run
|
47
|
-
|
48
|
-
public
|
49
|
-
def teardown
|
50
|
-
end
|
51
|
-
|
52
|
-
def process(output_queue)
|
53
|
-
@logger.debug(@last_timestamp)
|
54
|
-
# query data using start_from_time
|
55
|
-
query_filter = "PartitionKey gt '#{partitionkey_from_datetime(@last_timestamp)}' and PreciseTimeStamp gt datetime'#{@last_timestamp}'".gsub('"','')
|
56
|
-
query = { :top => @entity_count_to_process, :filter => query_filter }
|
57
|
-
result = @azure_table_service.query_entities(@table_name, query)
|
58
|
-
|
59
|
-
if result and result.length > 0
|
60
|
-
result.each do |entity|
|
61
|
-
event = LogStash::Event.new(entity.properties)
|
62
|
-
event["type"] = @table_name
|
63
|
-
|
64
|
-
# Help pretty print etw files
|
65
|
-
if (@etw_pretty_print && !event["EventMessage"].nil? && !event["Message"].nil?)
|
66
|
-
logger.debug("event: " + event.to_s)
|
67
|
-
eventMessage = event["EventMessage"].to_s
|
68
|
-
message = event["Message"].to_s
|
69
|
-
logger.debug("EventMessage: " + eventMessage)
|
70
|
-
logger.debug("Message: " + message)
|
71
|
-
if (eventMessage.include? "%")
|
72
|
-
logger.debug("starting pretty print")
|
73
|
-
toReplace = eventMessage.scan(/%\d+/)
|
74
|
-
payload = message.scan(/(?<!\\S)([a-zA-Z]+)=(\"[^\"]*\")(?!\\S)/)
|
75
|
-
# Split up the format string to seperate all of the numbers
|
76
|
-
toReplace.each do |key|
|
77
|
-
logger.debug("Replacing key: " + key.to_s)
|
78
|
-
index = key.scan(/\d+/).join.to_i
|
79
|
-
newValue = payload[index - 1][1]
|
80
|
-
logger.debug("New Value: " + newValue)
|
81
|
-
eventMessage[key] = newValue
|
82
|
-
end
|
83
|
-
event["EventMessage"] = eventMessage
|
84
|
-
logger.debug("pretty print end. result: " + event["EventMessage"].to_s)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
output_queue << event
|
89
|
-
end # each block
|
90
|
-
@idle_delay = 0
|
91
|
-
@last_timestamp = result.last.properties["PreciseTimeStamp"].inspect
|
92
|
-
else
|
93
|
-
@logger.debug("No new results found.")
|
94
|
-
@idle_delay = @idle_delay_seconds
|
95
|
-
end # if block
|
96
|
-
|
97
|
-
rescue => e
|
98
|
-
@logger.error("Oh My, An error occurred.", :exception => e)
|
99
|
-
raise
|
100
|
-
end # process
|
101
|
-
|
102
|
-
# Windows Azure Diagnostic's algorithm for determining the partition key based on time is as follows:
|
103
|
-
# 1. Take time in UTC without seconds.
|
104
|
-
# 2. Convert it into .net ticks
|
105
|
-
# 3. add a '0' prefix.
|
106
|
-
def partitionkey_from_datetime(time_string)
|
107
|
-
collection_time = Time.parse(time_string)
|
108
|
-
if collection_time
|
109
|
-
@logger.debug("collection time parsed successfully #{collection_time}")
|
110
|
-
else
|
111
|
-
raise(ArgumentError, "Could not parse the time_string")
|
112
|
-
end # if else block
|
113
|
-
|
114
|
-
collection_time -= collection_time.sec
|
115
|
-
ticks = to_ticks(collection_time)
|
116
|
-
"0#{ticks}"
|
117
|
-
end # partitionkey_from_datetime
|
118
|
-
|
119
|
-
# Convert time to ticks
|
120
|
-
def to_ticks(time_to_convert)
|
121
|
-
@logger.debug("Converting time to ticks")
|
122
|
-
time_to_convert.to_i * 10000000 - TICKS_SINCE_EPOCH
|
123
|
-
end # to_ticks
|
124
|
-
|
125
|
-
end # LogStash::Inputs::AzureWADTable
|
@@ -1,24 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = 'logstash-input-azurewadtable'
|
3
|
-
s.version = '0.9.2'
|
4
|
-
s.licenses = ['Apache License (2.0)']
|
5
|
-
s.summary = "This plugin will collect Microsoft Azure Diagnostics data from Azure Storage."
|
6
|
-
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
|
7
|
-
s.authors = ["Microsoft Corporation"]
|
8
|
-
s.email = 'juliusl@microsoft.com'
|
9
|
-
s.homepage = "https://github.com/juliusl/logstash-input-azurewadtable/"
|
10
|
-
s.require_paths = ["lib"]
|
11
|
-
|
12
|
-
# Files
|
13
|
-
s.files = `git ls-files`.split($\)
|
14
|
-
# Tests
|
15
|
-
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
|
-
|
17
|
-
# Special flag to let us know this is actually a logstash plugin
|
18
|
-
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
|
19
|
-
|
20
|
-
# Gem dependencies
|
21
|
-
s.add_runtime_dependency 'logstash-core', '>= 1.4.0', '< 2.0.0'
|
22
|
-
s.add_runtime_dependency 'azure', '~> 0.6.4'
|
23
|
-
s.add_development_dependency 'logstash-devutils', '~> 0.0.14'
|
24
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require "logstash/devutils/rspec/spec_helper"
|