logstash-input-azurewadtable 0.9.6 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -3
- data/LICENSE +17 -17
- data/README.md +63 -165
- data/lib/logstash/inputs/azurewadtable.rb +132 -132
- data/logstash-input-azurewadtable.gemspec +25 -25
- data/spec/inputs/azurewadtable_spec.rb +0 -0
- metadata +16 -18
- data/Rakefile +0 -1
- data/ubuntu-wad-logstash-install.sh +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bf50a9b0fb75e275dbd142301cda0e5c672d8e1
|
4
|
+
data.tar.gz: e3af78f75b37ce6b77790a09521fd597ac282846
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 845bffd92c1cb80625ee8424f53994587e097b6e8831d51c13b7dcae3a68db8bd3e0b9ce105705c68a8240ce87376af14aca82c2a74d46b480c853e012a52d64
|
7
|
+
data.tar.gz: 47c5e6c641bb0fdf2394e0a00f99c107974d137ba11e7f1fa2729d67da3e3f1c48256b9a67ab109ba8ff4c9799a33460519c47a6dac5d1d31179484686befe94
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
gemspec
|
3
|
-
gem 'azure', '~> 0.7.1'
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
gemspec
|
data/LICENSE
CHANGED
@@ -1,17 +1,17 @@
|
|
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
|
-
|
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
CHANGED
@@ -1,165 +1,63 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
```
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
vagrant up --provider hyperv
|
65
|
-
vagrant ssh
|
66
|
-
```
|
67
|
-
|
68
|
-
This will let you ssh into the machine. Navigate to /vagrant (`cd /vagrant`). This is the shared folder between the windows file system and the Ubuntu VM.
|
69
|
-
|
70
|
-
Clone the repo to this directory. You can do all your edits on the Windows side (if you so choose, remember that Windows has different line endings so you'll need to run dos2unix if you go this route).
|
71
|
-
Or if you want to do it ubuntu you can do as well. I like to keep things in this folder so that when I come back to this environment I know what I was working on without having to start the VM.
|
72
|
-
|
73
|
-
Once you have a VM, you'll need to install a bunch of dependencies to get going. I'll list them out (I will likely write a script for this as well):
|
74
|
-
|
75
|
-
Java, RVM (This is ruby env manager), Jruby (Install this through RVM), Logstash.
|
76
|
-
|
77
|
-
Below are more instructions on how to actually run a plugin locally, but this should be enough to get going.
|
78
|
-
|
79
|
-
# Logstash Plugin
|
80
|
-
`The following is default documentation when you create a new plugin. Left as notes.`
|
81
|
-
|
82
|
-
This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
|
83
|
-
|
84
|
-
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.
|
85
|
-
|
86
|
-
## Documentation
|
87
|
-
|
88
|
-
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/).
|
89
|
-
|
90
|
-
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
91
|
-
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
|
92
|
-
|
93
|
-
## Need Help?
|
94
|
-
|
95
|
-
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
96
|
-
|
97
|
-
## Developing
|
98
|
-
|
99
|
-
### 1. Plugin Developement and Testing
|
100
|
-
|
101
|
-
#### Code
|
102
|
-
- To get started, you'll need JRuby with the Bundler gem installed.
|
103
|
-
|
104
|
-
- 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).
|
105
|
-
|
106
|
-
- Install dependencies
|
107
|
-
```sh
|
108
|
-
bundle install
|
109
|
-
```
|
110
|
-
|
111
|
-
#### Test
|
112
|
-
|
113
|
-
- Update your dependencies
|
114
|
-
|
115
|
-
```sh
|
116
|
-
bundle install
|
117
|
-
```
|
118
|
-
|
119
|
-
- Run tests
|
120
|
-
|
121
|
-
```sh
|
122
|
-
bundle exec rspec
|
123
|
-
```
|
124
|
-
|
125
|
-
### 2. Running your unpublished Plugin in Logstash
|
126
|
-
|
127
|
-
#### 2.1 Run in a local Logstash clone
|
128
|
-
|
129
|
-
- Edit Logstash `Gemfile` and add the local plugin path, for example:
|
130
|
-
```ruby
|
131
|
-
gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
132
|
-
```
|
133
|
-
- Install plugin
|
134
|
-
```sh
|
135
|
-
bin/plugin install --no-verify
|
136
|
-
```
|
137
|
-
- Run Logstash with your plugin
|
138
|
-
```sh
|
139
|
-
bin/logstash -e 'filter {awesome {}}'
|
140
|
-
```
|
141
|
-
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
|
142
|
-
|
143
|
-
#### 2.2 Run in an installed Logstash
|
144
|
-
|
145
|
-
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:
|
146
|
-
|
147
|
-
- Build your plugin gem
|
148
|
-
```sh
|
149
|
-
gem build logstash-filter-awesome.gemspec
|
150
|
-
```
|
151
|
-
- Install the plugin from the Logstash home
|
152
|
-
```sh
|
153
|
-
bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
|
154
|
-
```
|
155
|
-
- Start Logstash and proceed to test the plugin
|
156
|
-
|
157
|
-
## Contributing
|
158
|
-
|
159
|
-
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
160
|
-
|
161
|
-
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.
|
162
|
-
|
163
|
-
It is more important to the community that you are able to contribute.
|
164
|
-
|
165
|
-
For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
|
1
|
+
# Logstash input plugin for Azure diagnostics data from Storage Tables
|
2
|
+
|
3
|
+
## Summary
|
4
|
+
This plugin reads Azure diagnostics data from specified Azure Storage Table and parses the data for output.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
You can install this plugin using the Logstash "plugin" or "logstash-plugin" (for newer versions of Logstash) command:
|
8
|
+
```sh
|
9
|
+
logstash-plugin install logstash-input-azurewadtable
|
10
|
+
```
|
11
|
+
For more information, see Logstash reference [Working with plugins](https://www.elastic.co/guide/en/logstash/current/working-with-plugins.html).
|
12
|
+
|
13
|
+
## Configuration
|
14
|
+
### Required Parameters
|
15
|
+
__*account_name*__
|
16
|
+
|
17
|
+
The Azure Storage account name.
|
18
|
+
|
19
|
+
__*access_key*__
|
20
|
+
|
21
|
+
The access key to the storage account.
|
22
|
+
|
23
|
+
__*table_name*__
|
24
|
+
|
25
|
+
The storage table to pull data from.
|
26
|
+
|
27
|
+
### Optional Parameters
|
28
|
+
__*entity_count_to_process*__
|
29
|
+
|
30
|
+
The plugin queries and processes table entities in a loop, this parameter is to specify the maximum number of entities it should query and process per loop. The default value is 100.
|
31
|
+
|
32
|
+
__*collection_start_time_utc*__
|
33
|
+
|
34
|
+
Specifies the point of time after which the entities created should be included in the query results. The default value is when the plugin gets initialized:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
Time.now.utc.iso8601
|
38
|
+
```
|
39
|
+
__*etw_pretty_print*__
|
40
|
+
|
41
|
+
True to pretty print ETW files, otherwise False. The default value is False.
|
42
|
+
|
43
|
+
__*idle_delay_seconds*__
|
44
|
+
|
45
|
+
Specifies the seconds to wait between each processing loop. The default value is 15.
|
46
|
+
|
47
|
+
### Examples
|
48
|
+
```
|
49
|
+
input
|
50
|
+
{
|
51
|
+
azurewadeventhub
|
52
|
+
{
|
53
|
+
account_name => "mystorageaccount"
|
54
|
+
access_key => "VGhpcyBpcyBhIGZha2Uga2V5Lg=="
|
55
|
+
table_name => "WADWindowsEventLogsTable"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
```
|
59
|
+
|
60
|
+
## More information
|
61
|
+
The source code of this plugin is hosted in GitHub repo [Microsoft Azure Diagnostics with ELK](https://github.com/Azure/azure-diagnostics-tools). We welcome you to provide feedback and/or contribute to the project.
|
62
|
+
|
63
|
+
Please also see [Analyze Diagnostics Data with ELK template](https://github.com/Azure/azure-quickstart-templates/tree/master/diagnostics-with-elk) for quick deployment of ELK to Azure.
|
@@ -1,132 +1,132 @@
|
|
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
|
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.iso8601
|
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::Table::TableService.new
|
34
|
-
@last_timestamp = @collection_start_time_utc
|
35
|
-
@idle_delay = @idle_delay_seconds
|
36
|
-
@continuation_token = nil
|
37
|
-
end # register
|
38
|
-
|
39
|
-
public
|
40
|
-
def run(output_queue)
|
41
|
-
|
42
|
-
|
43
|
-
process(output_queue)
|
44
|
-
|
45
|
-
|
46
|
-
end #
|
47
|
-
end # run
|
48
|
-
|
49
|
-
public
|
50
|
-
def teardown
|
51
|
-
end
|
52
|
-
|
53
|
-
def process(output_queue)
|
54
|
-
@logger.debug(@last_timestamp)
|
55
|
-
# query data using start_from_time
|
56
|
-
query_filter = "(PartitionKey gt '#{partitionkey_from_datetime(@last_timestamp)}')"
|
57
|
-
for i in 0..99
|
58
|
-
query_filter << " or (PartitionKey gt '#{i.to_s.rjust(19, '0')}___#{partitionkey_from_datetime(@last_timestamp)}' and PartitionKey lt '#{i.to_s.rjust(19, '0')}___9999999999999999999')"
|
59
|
-
end # for block
|
60
|
-
query_filter = query_filter.gsub('"','')
|
61
|
-
@logger.debug("Query filter: " + query_filter)
|
62
|
-
query = { :top => @entity_count_to_process, :filter => query_filter, :continuation_token => @continuation_token }
|
63
|
-
result = @azure_table_service.query_entities(@table_name, query)
|
64
|
-
@continuation_token = result.continuation_token
|
65
|
-
|
66
|
-
if result and result.length > 0
|
67
|
-
result.each do |entity|
|
68
|
-
event = LogStash::Event.new(entity.properties)
|
69
|
-
event["type"] = @table_name
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
output_queue << event
|
96
|
-
end # each block
|
97
|
-
@idle_delay = 0
|
98
|
-
@last_timestamp = result.last.properties["TIMESTAMP"].iso8601 unless @continuation_token
|
99
|
-
else
|
100
|
-
@logger.debug("No new results found.")
|
101
|
-
|
102
|
-
end # if block
|
103
|
-
|
104
|
-
rescue => e
|
105
|
-
@logger.error("Oh My, An error occurred.", :exception => e)
|
106
|
-
raise
|
107
|
-
end # process
|
108
|
-
|
109
|
-
# Windows Azure Diagnostic's algorithm for determining the partition key based on time is as follows:
|
110
|
-
# 1. Take time in UTC without seconds.
|
111
|
-
# 2. Convert it into .net ticks
|
112
|
-
# 3. add a '0' prefix.
|
113
|
-
def partitionkey_from_datetime(time_string)
|
114
|
-
collection_time = Time.parse(time_string)
|
115
|
-
if collection_time
|
116
|
-
@logger.debug("collection time parsed successfully #{collection_time}")
|
117
|
-
else
|
118
|
-
raise(ArgumentError, "Could not parse the time_string")
|
119
|
-
end # if else block
|
120
|
-
|
121
|
-
collection_time -= collection_time.sec
|
122
|
-
ticks = to_ticks(collection_time)
|
123
|
-
"0#{ticks}"
|
124
|
-
end # partitionkey_from_datetime
|
125
|
-
|
126
|
-
# Convert time to ticks
|
127
|
-
def to_ticks(time_to_convert)
|
128
|
-
@logger.debug("Converting time to ticks")
|
129
|
-
time_to_convert.to_i * 10000000 - TICKS_SINCE_EPOCH
|
130
|
-
end # to_ticks
|
131
|
-
|
132
|
-
end # LogStash::Inputs::AzureWADTable
|
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 1
|
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.iso8601
|
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::Table::TableService.new
|
34
|
+
@last_timestamp = @collection_start_time_utc
|
35
|
+
@idle_delay = @idle_delay_seconds
|
36
|
+
@continuation_token = nil
|
37
|
+
end # register
|
38
|
+
|
39
|
+
public
|
40
|
+
def run(output_queue)
|
41
|
+
while !stop?
|
42
|
+
@logger.debug("Starting process method @" + Time.now.to_s);
|
43
|
+
process(output_queue)
|
44
|
+
@logger.debug("Starting delay of: " + @idle_delay_seconds.to_s + " seconds @" + Time.now.to_s);
|
45
|
+
sleep @idle_delay
|
46
|
+
end # while
|
47
|
+
end # run
|
48
|
+
|
49
|
+
public
|
50
|
+
def teardown
|
51
|
+
end
|
52
|
+
|
53
|
+
def process(output_queue)
|
54
|
+
@logger.debug(@last_timestamp)
|
55
|
+
# query data using start_from_time
|
56
|
+
query_filter = "(PartitionKey gt '#{partitionkey_from_datetime(@last_timestamp)}')"
|
57
|
+
for i in 0..99
|
58
|
+
query_filter << " or (PartitionKey gt '#{i.to_s.rjust(19, '0')}___#{partitionkey_from_datetime(@last_timestamp)}' and PartitionKey lt '#{i.to_s.rjust(19, '0')}___9999999999999999999')"
|
59
|
+
end # for block
|
60
|
+
query_filter = query_filter.gsub('"','')
|
61
|
+
@logger.debug("Query filter: " + query_filter)
|
62
|
+
query = { :top => @entity_count_to_process, :filter => query_filter, :continuation_token => @continuation_token }
|
63
|
+
result = @azure_table_service.query_entities(@table_name, query)
|
64
|
+
@continuation_token = result.continuation_token
|
65
|
+
|
66
|
+
if result and result.length > 0
|
67
|
+
result.each do |entity|
|
68
|
+
event = LogStash::Event.new(entity.properties)
|
69
|
+
event["type"] = @table_name
|
70
|
+
|
71
|
+
# Help pretty print etw files
|
72
|
+
if (@etw_pretty_print && !event["EventMessage"].nil? && !event["Message"].nil?)
|
73
|
+
logger.debug("event: " + event.to_s)
|
74
|
+
eventMessage = event["EventMessage"].to_s
|
75
|
+
message = event["Message"].to_s
|
76
|
+
logger.debug("EventMessage: " + eventMessage)
|
77
|
+
logger.debug("Message: " + message)
|
78
|
+
if (eventMessage.include? "%")
|
79
|
+
logger.debug("starting pretty print")
|
80
|
+
toReplace = eventMessage.scan(/%\d+/)
|
81
|
+
payload = message.scan(/(?<!\\S)([a-zA-Z]+)=(\"[^\"]*\")(?!\\S)/)
|
82
|
+
# Split up the format string to seperate all of the numbers
|
83
|
+
toReplace.each do |key|
|
84
|
+
logger.debug("Replacing key: " + key.to_s)
|
85
|
+
index = key.scan(/\d+/).join.to_i
|
86
|
+
newValue = payload[index - 1][1]
|
87
|
+
logger.debug("New Value: " + newValue)
|
88
|
+
eventMessage[key] = newValue
|
89
|
+
end # do block
|
90
|
+
event["EventMessage"] = eventMessage
|
91
|
+
logger.debug("pretty print end. result: " + event["EventMessage"].to_s)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
output_queue << event
|
96
|
+
end # each block
|
97
|
+
@idle_delay = 0
|
98
|
+
@last_timestamp = result.last.properties["TIMESTAMP"].iso8601 unless @continuation_token
|
99
|
+
else
|
100
|
+
@logger.debug("No new results found.")
|
101
|
+
@idle_delay = @idle_delay_seconds
|
102
|
+
end # if block
|
103
|
+
|
104
|
+
rescue => e
|
105
|
+
@logger.error("Oh My, An error occurred.", :exception => e)
|
106
|
+
raise
|
107
|
+
end # process
|
108
|
+
|
109
|
+
# Windows Azure Diagnostic's algorithm for determining the partition key based on time is as follows:
|
110
|
+
# 1. Take time in UTC without seconds.
|
111
|
+
# 2. Convert it into .net ticks
|
112
|
+
# 3. add a '0' prefix.
|
113
|
+
def partitionkey_from_datetime(time_string)
|
114
|
+
collection_time = Time.parse(time_string)
|
115
|
+
if collection_time
|
116
|
+
@logger.debug("collection time parsed successfully #{collection_time}")
|
117
|
+
else
|
118
|
+
raise(ArgumentError, "Could not parse the time_string")
|
119
|
+
end # if else block
|
120
|
+
|
121
|
+
collection_time -= collection_time.sec
|
122
|
+
ticks = to_ticks(collection_time)
|
123
|
+
"0#{ticks}"
|
124
|
+
end # partitionkey_from_datetime
|
125
|
+
|
126
|
+
# Convert time to ticks
|
127
|
+
def to_ticks(time_to_convert)
|
128
|
+
@logger.debug("Converting time to ticks")
|
129
|
+
time_to_convert.to_i * 10000000 - TICKS_SINCE_EPOCH
|
130
|
+
end # to_ticks
|
131
|
+
|
132
|
+
end # LogStash::Inputs::AzureWADTable
|
@@ -1,25 +1,25 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name
|
3
|
-
s.version = '0.9.
|
4
|
-
s.licenses
|
5
|
-
s.summary
|
6
|
-
s.description
|
7
|
-
s.authors
|
8
|
-
s.email
|
9
|
-
s.homepage
|
10
|
-
s.require_paths
|
11
|
-
|
12
|
-
# Files
|
13
|
-
s.files =
|
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', '
|
22
|
-
s.add_runtime_dependency 'azure', '~> 0.7.3'
|
23
|
-
s.add_development_dependency 'logstash-devutils', '
|
24
|
-
end
|
25
|
-
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'logstash-input-azurewadtable'
|
3
|
+
s.version = '0.9.8'
|
4
|
+
s.licenses = ['Apache License (2.0)']
|
5
|
+
s.summary = "This plugin collects Microsoft Azure Diagnostics data from Azure Storage Tables."
|
6
|
+
s.description = "This gem is a Logstash plugin. It reads and parses diagnostics data from Azure Storage Tables."
|
7
|
+
s.authors = ["Microsoft Corporation"]
|
8
|
+
s.email = 'azdiag@microsoft.com'
|
9
|
+
s.homepage = "https://github.com/Azure/azure-diagnostics-tools"
|
10
|
+
s.require_paths = ["lib"]
|
11
|
+
|
12
|
+
# Files
|
13
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','Gemfile','LICENSE']
|
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', '~> 2.0'
|
22
|
+
s.add_runtime_dependency 'azure', '~> 0.7.3'
|
23
|
+
s.add_development_dependency 'logstash-devutils', '>= 0.0.16'
|
24
|
+
end
|
25
|
+
|
File without changes
|
metadata
CHANGED
@@ -1,33 +1,33 @@
|
|
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.8
|
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
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- -
|
16
|
+
- - ~>
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
18
|
+
version: '2.0'
|
19
19
|
name: logstash-core
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.7.3
|
33
33
|
name: azure
|
@@ -35,24 +35,24 @@ dependencies:
|
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.7.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.0.
|
46
|
+
version: 0.0.16
|
47
47
|
name: logstash-devutils
|
48
48
|
prerelease: false
|
49
49
|
type: :development
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.
|
55
|
-
description: This gem is a
|
54
|
+
version: 0.0.16
|
55
|
+
description: This gem is a Logstash plugin. It reads and parses diagnostics data from Azure Storage Tables.
|
56
56
|
email: azdiag@microsoft.com
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
@@ -62,11 +62,9 @@ files:
|
|
62
62
|
- Gemfile
|
63
63
|
- LICENSE
|
64
64
|
- README.md
|
65
|
-
- Rakefile
|
66
65
|
- lib/logstash/inputs/azurewadtable.rb
|
67
66
|
- logstash-input-azurewadtable.gemspec
|
68
67
|
- spec/inputs/azurewadtable_spec.rb
|
69
|
-
- ubuntu-wad-logstash-install.sh
|
70
68
|
homepage: https://github.com/Azure/azure-diagnostics-tools
|
71
69
|
licenses:
|
72
70
|
- Apache License (2.0)
|
@@ -79,12 +77,12 @@ require_paths:
|
|
79
77
|
- lib
|
80
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
79
|
requirements:
|
82
|
-
- -
|
80
|
+
- - '>='
|
83
81
|
- !ruby/object:Gem::Version
|
84
82
|
version: '0'
|
85
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
84
|
requirements:
|
87
|
-
- -
|
85
|
+
- - '>='
|
88
86
|
- !ruby/object:Gem::Version
|
89
87
|
version: '0'
|
90
88
|
requirements: []
|
@@ -92,6 +90,6 @@ rubyforge_project:
|
|
92
90
|
rubygems_version: 2.4.8
|
93
91
|
signing_key:
|
94
92
|
specification_version: 4
|
95
|
-
summary: This plugin
|
93
|
+
summary: This plugin collects Microsoft Azure Diagnostics data from Azure Storage Tables.
|
96
94
|
test_files:
|
97
95
|
- spec/inputs/azurewadtable_spec.rb
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "logstash/devutils/rake"
|
@@ -1,63 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
#
|
3
|
-
# ========================================================================================
|
4
|
-
# Microsoft patterns & practices (http://microsoft.com/practices)
|
5
|
-
# SEMANTIC LOGGING APPLICATION BLOCK
|
6
|
-
# ========================================================================================
|
7
|
-
#
|
8
|
-
# Copyright (c) Microsoft. All rights reserved.
|
9
|
-
# Microsoft would like to thank its contributors, a list
|
10
|
-
# of whom are at http://aka.ms/entlib-contributors
|
11
|
-
#
|
12
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
13
|
-
# may not use this file except in compliance with the License. You may
|
14
|
-
# obtain a copy of the License at
|
15
|
-
#
|
16
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
17
|
-
#
|
18
|
-
# Unless required by applicable law or agreed to in writing, software
|
19
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
20
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
21
|
-
# implied. See the License for the specific language governing permissions
|
22
|
-
# and limitations under the License.
|
23
|
-
#
|
24
|
-
help()
|
25
|
-
{
|
26
|
-
echo ""
|
27
|
-
echo ""
|
28
|
-
echo "This script installs Java, Logstash, and the Azure WAD plugin"
|
29
|
-
echo "Currently requires no parameters"
|
30
|
-
echo ""
|
31
|
-
echo ""
|
32
|
-
}
|
33
|
-
|
34
|
-
log()
|
35
|
-
{
|
36
|
-
echo "$1"
|
37
|
-
}
|
38
|
-
|
39
|
-
# Install Utilities
|
40
|
-
log "Installing utilities."
|
41
|
-
sudo apt-get update
|
42
|
-
sudo apt-get -y --force-yes install python-software-properties debconf-utils
|
43
|
-
|
44
|
-
# Install Java
|
45
|
-
log "Installing Java."
|
46
|
-
sudo add-apt-repository -y ppa:webupd8team/java
|
47
|
-
sudo apt-get update
|
48
|
-
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections
|
49
|
-
sudo apt-get install -y --force-yes oracle-java8-installer
|
50
|
-
|
51
|
-
# Install Logstash
|
52
|
-
log "Installing Logstash."
|
53
|
-
echo 'deb http://packages.elastic.co/logstash/2.2/debian stable main' | sudo tee /etc/apt/sources.list.d/logstash-2.2.x.list
|
54
|
-
sudo apt-get update
|
55
|
-
sudo apt-get -y --force-yes install logstash
|
56
|
-
|
57
|
-
# Install Azure Plugin
|
58
|
-
log "Installing Azure WAD Table Plugin"
|
59
|
-
sudo /opt/logstash/bin/plugin install logstash-input-azurewadtable
|
60
|
-
|
61
|
-
log "Complete"
|
62
|
-
|
63
|
-
|