logstash_auditor 0.0.2 → 0.0.4

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: 3dd294589825e39ca26e59a6204bb9431b9d9fbb
4
- data.tar.gz: 98defbe2db36aec15e75cc2dad37befe9368487e
3
+ metadata.gz: 6f8dec6ba0d7de7778cc515f4e80f3d69a4a00b3
4
+ data.tar.gz: 2d65e403c26b261d8fc0f191764bc76ec46422f7
5
5
  SHA512:
6
- metadata.gz: dfcb70d7dd0684918804948477e1902f219fdeb1cfef70130191e8348659eaf8ed9b1a25dd1fb2db2673c2758b36245e79e46b9ffb8b4e564087cd5834814672
7
- data.tar.gz: 64c9352f29edb6c57d17426c22f1d4048082e7413acbfaef551a172f2f032a4fc7ebb20b6f7e66e4e0d5e190b20152d28af17e79d1f0eee98f545fbc0c3df743
6
+ metadata.gz: 65c93f8af9c1856a081a4f3464b3570d82004d57a727cb9975c27e5c37d69850d94610d92bf051759308c31721f7d783f76ae7d89994173612c038d1ec9a37a4
7
+ data.tar.gz: be829566efe2a0716662bf828c7449b9e5c482806e90f97b4215d8cc7f149d7a7d05a502e964f3e8b15174473f55d42c29c41b5a2c179822bee6af8616d71362
data/README.md CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
24
24
 
25
25
  ## Testing
26
26
 
27
- Behavioural driven testing can be performed by testing against an ELK docker image:
27
+ Behavioural driven testing can be performed by testing against a local ELK docker image:
28
28
 
29
29
  $ sudo docker run -d -v $(pwd)/spec/support/logstash_conf.d:/etc/logstash/conf.d -p 9300:9300 -p 9200:9200 -p 5000:5000 -p 5044:5044 -p 5601:5601 -p 8080:8080 sebp/elk
30
30
 
@@ -44,75 +44,45 @@ Debugging the docker image:
44
44
 
45
45
  ## Usage
46
46
 
47
-
48
- #TODO complete this section
49
- #TODO Extend the LogstashAuditor::AuditingProviderAPI to create an auditing provider:
50
-
51
- ```
52
- class MyAuditingProvider < LogstashAuditor::AuditingProviderAPI
53
- end
54
- ```
55
-
56
- Provide the required inversion of control method to configure (an) injected auditor(s):
47
+ Initialize and configure the auditor so:
57
48
 
58
49
  ```
59
- def configure_auditor(configuration = nil)
60
- @auditor.configure(configuration)
61
- end
62
- ```
63
-
64
- Initialize the provider so:
65
-
66
- ```
67
- auditor = MyAuditor.new
68
- auditor_configuration = { 'some' => 'configuration' }
69
- @iut = MyAuditingProvider.new(auditor, auditor_configuration)
50
+ @iut = LogstashAuditor::LogstashAuditor.new
51
+ @logstash_configuration =
52
+ { "host_url" => "http://localhost:8080",
53
+ "use_ssl" => false,
54
+ "username" => "something",
55
+ "password" => "something",
56
+ "timeout" => 3}
57
+ @iut.configure(@valid_logstash_configuration)
70
58
  ```
71
59
 
72
60
  Audit using the API methods, e.g.:
73
61
 
74
62
  ```
75
- @iut.info("This is info")
76
- @iut.debug(some_debug_object)
77
- @iut.warn("Statistics show that dropped packets have increased to #{dropped}%")
78
- @iut.error("Could not resend some dropped packets. They have been lost. All is still OK, I could compensate")
79
- @iut.fatal("Unable to perform action, too many dropped packets. Functional degradation.")
80
- @iut << 'Rack::CommonLogger requires this'
81
- ```
82
-
83
- The API also supports appending as below, enabling support, e.g. for Rack::CommonLogger, etc.:
84
-
85
- ```
86
- <<
63
+ @iut.event(flow_id, "This is a test event")
87
64
  ```
88
65
 
89
66
  ## Detailed example
90
67
 
91
68
  ```
92
- require 'log4r'
93
69
  require 'logstash_auditor'
94
70
 
95
- class Log4rAuditingProvider < LogstashAuditor::AuditingProviderAPI
96
- def configure_auditor(configuration = nil)
97
- @auditor.outputters = configuration['outputter']
98
- end
99
- end
100
-
101
71
  class Main
102
- include Log4r
103
-
104
72
  def test_sanity
105
- auditor = Logger.new 'sanity'
106
- auditor_configuration = { 'outputter' => Outputter.stdout }
107
- @iut = Log4rAuditingProvider.new(auditor, auditor_configuration)
108
-
109
- some_debug_object = 123
110
- @iut.info("This is info")
111
- @iut.debug(some_debug_object)
112
- dropped = 95
113
- @iut.warn("Statistics show that dropped packets have increased to #{dropped}%")
114
- @iut.error("Could not resend some dropped packets. They have been lost. All is still OK, I could compensate")
115
- @iut.fatal("Unable to perform action, too many dropped packets. Functional degradation.")
73
+ @iut = LogstashAuditor::LogstashAuditor.new
74
+ @valid_logstash_configuration =
75
+ { "host_url" => "http://localhost:8080",
76
+ "use_ssl" => false,
77
+ "username" => "something",
78
+ "password" => "something",
79
+ "timeout" => 3}
80
+ @iut.configure(@valid_logstash_configuration)
81
+
82
+ require 'digest'
83
+ flow_id = Digest::SHA256.hexdigest("#{Time.now.to_i}#{rand(4000000)}")
84
+
85
+ @iut.event(flow_id, "This is a test event")
116
86
  end
117
87
  end
118
88
 
@@ -126,7 +96,7 @@ Bug reports and feature requests are welcome by email to barney dot de dot villi
126
96
 
127
97
  ## Notes
128
98
 
129
- Though out of scope for the provider, auditors should take into account encoding, serialization, and other NFRs.
99
+ The interface for auditors is still not stable and therefore subject to change.
130
100
 
131
101
  ## License
132
102
 
@@ -1,3 +1,3 @@
1
1
  module LogstashAuditor
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
data/sanity/Gemfile CHANGED
@@ -1,7 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'byebug'
4
- gem 'logstash_auditor', "~> 0.0.1"
5
-
6
- gem 'http'
7
- gem 'net'
3
+ gem 'logstash_auditor'
data/sanity/sanity.rb CHANGED
@@ -1,12 +1,6 @@
1
1
  require 'logstash_auditor'
2
- require 'digest'
3
-
4
2
 
5
3
  class Main
6
- def create_flow_id
7
- return Digest::SHA256.hexdigest("#{Time.now.to_i}#{rand(4000000)}")
8
- end
9
-
10
4
  def test_sanity
11
5
  @iut = LogstashAuditor::LogstashAuditor.new
12
6
  @valid_logstash_configuration =
@@ -16,7 +10,11 @@ class Main
16
10
  "password" => "something",
17
11
  "timeout" => 3}
18
12
  @iut.configure(@valid_logstash_configuration)
19
- @iut.event(create_flow_id, "This is a test event")
13
+
14
+ require 'digest'
15
+ flow_id = Digest::SHA256.hexdigest("#{Time.now.to_i}#{rand(4000000)}")
16
+
17
+ @iut.event(flow_id, "This is a test event")
20
18
  end
21
19
  end
22
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash_auditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barney de Villiers