log_analysis 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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/log_analysis.rb +10 -4
- data/lib/log_analysis/session_identification.rb +1 -1
- data/lib/log_analysis/transformation.rb +1 -1
- data/lib/log_analysis/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f63a6053850f8364bfa54b513bb100c2d12352772ec59c7f7031752b54105856
|
4
|
+
data.tar.gz: aab9770c4db131b7edbc876d23d25fea5b5f60d5fb5c3ccec5e326c476ae5a49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca85c721af6999332ce3cf2adbab6d48ad89c54733a97881851e023ba254aedbcfe8a2d7cb2f246a599b7db6a0cfbabd056f200a27468d3b764d563065ee9d39
|
7
|
+
data.tar.gz: baa3db4cb9b51ad88edf7a85577b4cb709e0d363b609be22d3b947efffed98b5f263f0c98ff8ef32f555349e95c7b134cd94bb0d2be335c839c32c3b4cea920e
|
data/Gemfile.lock
CHANGED
data/lib/log_analysis.rb
CHANGED
@@ -26,23 +26,29 @@ class LogAnalysis
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def preprocessing_data
|
29
|
-
|
29
|
+
data = selecting_data
|
30
|
+
return if data.nil? || data.empty?
|
31
|
+
|
32
|
+
filter = data.select { |record| record.status_200? && record.method_get? && record.uri_without_data && !record.robot? }
|
30
33
|
user = UserIdentification.execute(filter)
|
31
34
|
session = SessionIdentification.execute(user)
|
32
35
|
session
|
33
36
|
end
|
34
37
|
|
35
38
|
def transformation
|
36
|
-
|
39
|
+
data = preprocessing_data
|
40
|
+
Transformation.execute(data) unless data.nil? || data.empty?
|
37
41
|
end
|
38
42
|
|
39
43
|
def data_mining
|
44
|
+
data = transformation
|
40
45
|
@conf ||= 0.5
|
41
46
|
@sup ||= 60
|
42
|
-
DataMining.execute(
|
47
|
+
DataMining.execute(data, @conf, @sup) unless data.nil? || data.empty?
|
43
48
|
end
|
44
49
|
|
45
50
|
def intepretation
|
46
|
-
|
51
|
+
data = data_mining
|
52
|
+
Intepretation.execute(data) unless data.nil? || data.empty?
|
47
53
|
end
|
48
54
|
end
|
@@ -9,8 +9,8 @@ module SessionIdentification
|
|
9
9
|
|
10
10
|
def self.execute(identified_user)
|
11
11
|
identified_user.each_with_object([]) do |user, arr|
|
12
|
+
isession = arr.rindex { |s| s.user == user }
|
12
13
|
user.records.each do |record|
|
13
|
-
isession = arr.rindex { |s| s.user == user }
|
14
14
|
isession.present? && validate_time_session(arr[isession].records.last.time, record.time) ? arr[isession].records << record : arr << SessionIdentity.new(session_identity_params(record))
|
15
15
|
end
|
16
16
|
end
|
@@ -7,7 +7,7 @@ module Transformation
|
|
7
7
|
# Your code goes here...
|
8
8
|
|
9
9
|
def self.execute(identified_session)
|
10
|
-
map_uri = []
|
10
|
+
map_uri = ['-']
|
11
11
|
transform = identified_session.each_with_object({}) do |v, hash|
|
12
12
|
uries = v.records.map(&:uri)
|
13
13
|
uries.each { |i| map_uri.push(i) unless map_uri.include?(i) }
|
data/lib/log_analysis/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class LogAnalysis
|
2
|
-
VERSION = '0.1.
|
2
|
+
VERSION = '0.1.6'.freeze
|
3
3
|
TRANSFORM_DATA_PATH = "transform_data_#{Time.now.strftime('%Y%m%d')}.txt".freeze
|
4
4
|
RULE_FILE_PATH = "output_#{Time.now.strftime('%Y%m%d')}.txt".freeze
|
5
5
|
MAP_URI_FILE_PATH = "map_uri_#{Time.now.strftime('%Y%m%d')}.txt".freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_analysis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Tran
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: useragent
|