logstash-input-azurewadtable 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c52175d384a4df303c5ae93cb37868cfdd410bd
4
- data.tar.gz: 475b6e9fa71710960df7bf2f774e49f969881235
3
+ metadata.gz: beb23cfe2ea41fa12ddda3b4621787935dd2702c
4
+ data.tar.gz: 47d847d746dfc9bc09c26cc9635a6b1d704866a2
5
5
  SHA512:
6
- metadata.gz: d90bded3dd0d45faf847404bf011ef6487d8c314b920f76d79e4b502a5bf9eb44a863ee903e01cfae84bd5511f7ddc9d7c50264f5aa54090525a1ef3b4c32303
7
- data.tar.gz: 77e5c43625b91bdf5dd5145f08a65d89f9d96c4227d7c33ce6bf3d175bd4539d3b031de22f65bd6de1a4699750d98d6904538287533d89b6274d7108f76c44cc
6
+ metadata.gz: fe7208633ee481551f0da0a69713cd7e3160423cf2cbb345ed8345da3c36c0cdbaf48ed5d14a8dc51c11439e2b5559d47e142c835f796dfe208536a3ba5ac7f2
7
+ data.tar.gz: f4ac28d8cfb5b2fa7f51682c082fc44e9529655ff0bbcfa230ba574da8e0ce1276dde40d2a225df869a66c708c7b88ba285f6b0b9929588eb445d630c9adbc17
@@ -15,6 +15,8 @@ class LogStash::Inputs::AzureWADTable < LogStash::Inputs::Base
15
15
  config :table_name, :validate => :string
16
16
  config :entity_count_to_process, :validate => :string, :default => 100
17
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
18
20
 
19
21
  TICKS_SINCE_EPOCH = Time.utc(0001, 01, 01).to_i * 10000000
20
22
 
@@ -30,12 +32,16 @@ class LogStash::Inputs::AzureWADTable < LogStash::Inputs::Base
30
32
  end
31
33
  @azure_table_service = Azure::TableService.new
32
34
  @last_timestamp = @collection_start_time_utc
35
+ @idle_delay = @idle_delay_seconds
33
36
  end # register
34
37
 
35
38
  public
36
39
  def run(output_queue)
37
- while true
40
+ loop do
41
+ @logger.debug("Starting process method @" + Time.now.to_s);
38
42
  process(output_queue)
43
+ @logger.debug("Starting delay of: " + @idle_delay_seconds.to_s + " seconds @" + Time.now.to_s);
44
+ sleep @idle_delay
39
45
  end # loop
40
46
  end # run
41
47
 
@@ -44,6 +50,7 @@ class LogStash::Inputs::AzureWADTable < LogStash::Inputs::Base
44
50
  end
45
51
 
46
52
  def process(output_queue)
53
+ @logger.debug(@last_timestamp)
47
54
  # query data using start_from_time
48
55
  query_filter = "PartitionKey gt '#{partitionkey_from_datetime(@last_timestamp)}' and PreciseTimeStamp gt datetime'#{@last_timestamp}'".gsub('"','')
49
56
  query = { :top => @entity_count_to_process, :filter => query_filter }
@@ -53,12 +60,38 @@ class LogStash::Inputs::AzureWADTable < LogStash::Inputs::Base
53
60
  result.each do |entity|
54
61
  event = LogStash::Event.new(entity.properties)
55
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
+
56
88
  output_queue << event
57
89
  end # each block
58
-
90
+ @idle_delay = 0
59
91
  @last_timestamp = result.last.properties["PreciseTimeStamp"].inspect
60
92
  else
61
- @logger.warn("No new results found. This is not an error.")
93
+ @logger.debug("No new results found.")
94
+ @idle_delay = @idle_delay_seconds
62
95
  end # if block
63
96
 
64
97
  rescue => e
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-azurewadtable'
3
- s.version = '0.9.1'
3
+ s.version = '0.9.2'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "This plugin will collect Microsoft Azure Diagnostics data from Azure Storage."
6
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
7
  s.authors = ["Microsoft Corporation"]
8
8
  s.email = 'juliusl@microsoft.com'
9
- s.homepage = "https://github.com/juliusl/logstash-input-azurewadtable/tree/0.9.1"
9
+ s.homepage = "https://github.com/juliusl/logstash-input-azurewadtable/"
10
10
  s.require_paths = ["lib"]
11
11
 
12
12
  # Files
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-azurewadtable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-11 00:00:00.000000000 Z
11
+ date: 2015-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core
@@ -72,7 +72,7 @@ files:
72
72
  - lib/logstash/inputs/azurewadtable.rb
73
73
  - logstash-input-azurewadtable.gemspec
74
74
  - spec/inputs/azurewadtable_spec.rb
75
- homepage: https://github.com/juliusl/logstash-input-azurewadtable/tree/0.9.1
75
+ homepage: https://github.com/juliusl/logstash-input-azurewadtable/
76
76
  licenses:
77
77
  - Apache License (2.0)
78
78
  metadata: