fluent-plugin-anomalydetect 0.1.5 → 0.1.6

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: 85a6c9f30ea4c80eba3c4bb42f02f28ad32d1ce7
4
- data.tar.gz: af58f39de4592757c801d16fbf2fe3847d959cd5
3
+ metadata.gz: 193c7abd26eb078d99d3416843c9428dad7c7286
4
+ data.tar.gz: eeef27f7321efc4601999760621fa0ff17e25cd3
5
5
  SHA512:
6
- metadata.gz: bd32d62aef8924d6df33e4cb09f89e87e531820bc1450a370c1184c07f0aa3ab7a2cda6c9fa1faf56b39d6bca99ee6aa263d935a3d65854acf85e07e05b104b5
7
- data.tar.gz: 49b6bc57171e1223be3a3ce5a2f8370c4ebffc4cec794ca61b0890916664323c1291a4915a989b89d6e1ac09747bd78acd7293245d14e90cf8138e6fde607c71
6
+ metadata.gz: 38525e1c1920369159807d6a6aa0d59f22cf895aedd150f1ab18c4117bf0acbe598002766544de62ee3b236d0ebf6aeae0755781dd86413a74d3c7ba2e6e633f
7
+ data.tar.gz: 359c059e74f214ad23d7c016d7742b4917240cc871bbdd159d5389509d299b4cfb187f46e1348db156ba24d3c3e6f8b6ad65e816bb3c58e75ebd9a88aff56d42
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Fluent::Plugin::Anomalydetect
1
+ # Fluent::Plugin::Anomalydetect [![Build Status](https://travis-ci.org/muddydixon/fluent-plugin-anomalydetect.png?branch=master)](https://travis-ci.org/muddydixon/fluent-plugin-anomalydetect)
2
2
 
3
3
  To detect anomaly for log stream, use this plugin.
4
4
  Then you can find changes in logs casually.
@@ -3,7 +3,7 @@ lib = File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "fluent-plugin-anomalydetect"
6
- gem.version = "0.1.5"
6
+ gem.version = "0.1.6"
7
7
  gem.authors = ["Muddy Dixon"]
8
8
  gem.email = ["muddydixon@gmail.com"]
9
9
  gem.description = %q{detect anomal sequential input casually}
@@ -19,5 +19,6 @@ Gem::Specification.new do |gem|
19
19
  gem.add_development_dependency "rake"
20
20
  gem.add_development_dependency "pry"
21
21
  gem.add_development_dependency "pry-nav"
22
+ gem.add_development_dependency "octorelease"
22
23
  gem.add_runtime_dependency "fluentd"
23
24
  end
@@ -1,15 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module Fluent
3
3
  class ChangeFinder
4
- # To support log_level option implemented by Fluentd v0.10.43
5
- unless method_defined?(:log)
6
- define_method("log") { $log }
7
- end
8
-
9
4
  require 'matrix'
5
+ require 'ostruct'
10
6
  attr_reader :mu
7
+ attr_accessor :log
11
8
 
12
- def initialize(term, r)
9
+ def initialize(log, term, r)
10
+ @log = log
13
11
  @term = term
14
12
  @r = r
15
13
  @data = []
@@ -18,6 +16,26 @@ module Fluent
18
16
  @c = (0..@term - 1).map { |i| rand }
19
17
  end
20
18
 
19
+ def marshal_dump
20
+ struct = OpenStruct.new
21
+ struct.term = @term
22
+ struct.r = @r
23
+ struct.data = @data
24
+ struct.mu = @mu
25
+ struct.sigma = @sigma
26
+ struct.c = @c
27
+ struct
28
+ end
29
+
30
+ def marshal_load(struct)
31
+ @term = struct.term
32
+ @r = struct.r
33
+ @data = struct.data
34
+ @mu = struct.mu
35
+ @sigma = struct.sigma
36
+ @c = struct.c
37
+ end
38
+
21
39
  def next(x)
22
40
  len = @data.size
23
41
 
@@ -149,12 +149,12 @@ module Fluent
149
149
 
150
150
  def outliers(tag, target = nil)
151
151
  @outliers[tag] ||= {}
152
- @outliers[tag][target] ||= ChangeFinder.new(@outlier_term, @outlier_discount)
152
+ @outliers[tag][target] ||= ChangeFinder.new(log, @outlier_term, @outlier_discount)
153
153
  end
154
154
 
155
155
  def scores(tag, target = nil)
156
156
  @scores[tag] ||= {}
157
- @scores[tag][target] ||= ChangeFinder.new(@score_term, @score_discount)
157
+ @scores[tag][target] ||= ChangeFinder.new(log, @score_term, @score_discount)
158
158
  end
159
159
 
160
160
  def init_records(tags)
@@ -319,6 +319,7 @@ module Fluent
319
319
  @outliers = stored[:outliers]
320
320
  @outlier_bufs = stored[:outlier_bufs]
321
321
  @scores = stored[:scores]
322
+ @outiers.each {|outlier| outlier.log = log } # @log is not dumped, so have to set at here
322
323
  else
323
324
  log.warn "anomalydetect: configuration param was changed. ignore stored data"
324
325
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-anomalydetect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muddy Dixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: octorelease
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: fluentd
57
71
  requirement: !ruby/object:Gem::Requirement