Class: LogAnalysis

Inherits:
Object
  • Object
show all
Defined in:
lib/log_analysis.rb,
lib/log_analysis/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
'0.1.3'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, type = nil) ⇒ LogAnalysis

Returns a new instance of LogAnalysis.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/log_analysis.rb', line 15

def initialize(path, type = nil)
  @path         = path
  @type         = type
  @cleaned_data = PreProcess.input(path, type) do |record|
    if block_given?
      yield(record) ? record : nil
    else
      record
    end
  end
end

Instance Attribute Details

#cleaned_dataObject (readonly)

Your code goes here…



13
14
15
# File 'lib/log_analysis.rb', line 13

def cleaned_data
  @cleaned_data
end

#pathObject (readonly)

Your code goes here…



13
14
15
# File 'lib/log_analysis.rb', line 13

def path
  @path
end

#typeObject (readonly)

Your code goes here…



13
14
15
# File 'lib/log_analysis.rb', line 13

def type
  @type
end

Instance Method Details

#identified_sessionObject



31
32
33
# File 'lib/log_analysis.rb', line 31

def identified_session
  SessionIdentification.execute(@cleaned_data)
end

#identified_userObject



27
28
29
# File 'lib/log_analysis.rb', line 27

def identified_user
  UserIdentification.execute(@cleaned_data)
end

#move_dataObject



45
46
47
48
49
# File 'lib/log_analysis.rb', line 45

def move_data
  system('mv', "transform_data_#{Time.now.strftime('%Y%m%d')}.txt", '/home/app/data/waazabag/')
  system('mv', "output_#{Time.now.strftime('%Y%m%d')}.txt", '/home/app/data/waazabag/')
  system('mv', "map_uri_#{Time.now.strftime('%Y%m%d')}.txt", '/home/app/data/waazabag/')
end

#rule_generation(conf = 0.5, sup = 60) ⇒ Object



39
40
41
42
43
# File 'lib/log_analysis.rb', line 39

def rule_generation(conf = 0.5, sup = 60)
  result = RuleGeneration.execute(transformation, conf, sup)
  move_data
  result
end

#transformationObject



35
36
37
# File 'lib/log_analysis.rb', line 35

def transformation
  Transformation.execute(identified_session)
end