logeater 0.4.0 → 0.5.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/migrate/20171109171953_create_events.rb +26 -0
- data/db/migrate/20180116193728_change_user_id_to_be_string_in_requests.rb +9 -0
- data/db/schema.rb +26 -12
- data/lib/logeater/cli.rb +36 -16
- data/lib/logeater/event.rb +11 -0
- data/lib/logeater/eventfile.rb +19 -0
- data/lib/logeater/logfile.rb +25 -0
- data/lib/logeater/parser.rb +8 -2
- data/lib/logeater/reader.rb +7 -25
- data/lib/logeater/request.rb +2 -7
- data/lib/logeater/version.rb +1 -1
- data/lib/logeater.rb +3 -0
- data/logeater.gemspec +2 -4
- data/test/integration/logeater_test.rb +67 -8
- data/test/unit/parser_test.rb +18 -0
- metadata +22 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ccc1408222d5eb6f6af30a91d8cb63c51457c6a
|
4
|
+
data.tar.gz: 83254c545dba4b4217510653a6e1f54c95ebf8bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adc84e2364b1cb49120f206e21e007c6e0595567372c69cae4448a7bcaf360f17f23f0482de706f5f82b42db8d9870188c94a5b94a947ef460cb678342c6a748
|
7
|
+
data.tar.gz: 06481c37537675e13b0f17cfd78b0004459a560994f6aed86ef62c0cff592ae7cf94e77de93a521bba6ee02a076bfb1f882ba474d02372ef42c900f897ec8183
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateEvents < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :events do |t|
|
4
|
+
t.timestamp :emitted_at
|
5
|
+
t.timestamp :received_at
|
6
|
+
t.integer :priority
|
7
|
+
t.integer :syslog_version
|
8
|
+
t.string :hostname
|
9
|
+
t.string :appname
|
10
|
+
t.string :proc_id
|
11
|
+
t.string :msg_id
|
12
|
+
t.text :structured_data
|
13
|
+
t.text :message
|
14
|
+
t.text :original
|
15
|
+
t.string :ep_app
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index :events, :ep_app
|
19
|
+
execute "ALTER TABLE events ALTER COLUMN received_at SET DEFAULT now()"
|
20
|
+
end
|
21
|
+
|
22
|
+
def down
|
23
|
+
remove_index :events, :ep_app
|
24
|
+
drop_table :events
|
25
|
+
end
|
26
|
+
end
|
data/db/schema.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# This file is auto-generated from the current state of the database. Instead
|
3
2
|
# of editing this file, please use the migrations feature of Active Record to
|
4
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -11,11 +10,27 @@
|
|
11
10
|
#
|
12
11
|
# It's strongly recommended that you check this file into your version control system.
|
13
12
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20180116193728) do
|
15
14
|
|
16
15
|
# These are extensions that must be enabled in order to support this database
|
17
16
|
enable_extension "plpgsql"
|
18
17
|
|
18
|
+
create_table "events", force: :cascade do |t|
|
19
|
+
t.datetime "emitted_at"
|
20
|
+
t.datetime "received_at", default: -> { "now()" }
|
21
|
+
t.integer "priority"
|
22
|
+
t.integer "syslog_version"
|
23
|
+
t.string "hostname"
|
24
|
+
t.string "appname"
|
25
|
+
t.string "proc_id"
|
26
|
+
t.string "msg_id"
|
27
|
+
t.text "structured_data"
|
28
|
+
t.text "message"
|
29
|
+
t.text "original"
|
30
|
+
t.string "ep_app"
|
31
|
+
t.index ["ep_app"], name: "index_events_on_ep_app", using: :btree
|
32
|
+
end
|
33
|
+
|
19
34
|
create_table "requests", force: :cascade do |t|
|
20
35
|
t.string "app", null: false
|
21
36
|
t.string "logfile", null: false
|
@@ -34,17 +49,16 @@ ActiveRecord::Schema.define(version: 20160502131002) do
|
|
34
49
|
t.integer "http_status"
|
35
50
|
t.datetime "created_at"
|
36
51
|
t.datetime "updated_at"
|
37
|
-
t.
|
52
|
+
t.string "user_id"
|
38
53
|
t.boolean "tester_bar"
|
54
|
+
t.index ["app"], name: "index_requests_on_app", using: :btree
|
55
|
+
t.index ["completed_at"], name: "index_requests_on_completed_at", using: :btree
|
56
|
+
t.index ["controller", "action"], name: "index_requests_on_controller_and_action", using: :btree
|
57
|
+
t.index ["http_status"], name: "index_requests_on_http_status", using: :btree
|
58
|
+
t.index ["logfile"], name: "index_requests_on_logfile", using: :btree
|
59
|
+
t.index ["params"], name: "index_requests_on_params", using: :gin
|
60
|
+
t.index ["subdomain"], name: "index_requests_on_subdomain", using: :btree
|
61
|
+
t.index ["uuid"], name: "index_requests_on_uuid", unique: true, using: :btree
|
39
62
|
end
|
40
63
|
|
41
|
-
add_index "requests", ["app"], name: "index_requests_on_app", using: :btree
|
42
|
-
add_index "requests", ["completed_at"], name: "index_requests_on_completed_at", using: :btree
|
43
|
-
add_index "requests", ["controller", "action"], name: "index_requests_on_controller_and_action", using: :btree
|
44
|
-
add_index "requests", ["http_status"], name: "index_requests_on_http_status", using: :btree
|
45
|
-
add_index "requests", ["logfile"], name: "index_requests_on_logfile", using: :btree
|
46
|
-
add_index "requests", ["params"], name: "index_requests_on_params", using: :gin
|
47
|
-
add_index "requests", ["subdomain"], name: "index_requests_on_subdomain", using: :btree
|
48
|
-
add_index "requests", ["uuid"], name: "index_requests_on_uuid", unique: true, using: :btree
|
49
|
-
|
50
64
|
end
|
data/lib/logeater/cli.rb
CHANGED
@@ -13,7 +13,7 @@ module Logeater
|
|
13
13
|
|
14
14
|
started_all = Time.now
|
15
15
|
files.each_with_index do |file, i|
|
16
|
-
reader = Logeater::Reader.new(app, file, progress: true)
|
16
|
+
reader = Logeater::Reader.new(app, Logeater::Logfile.new(file), progress: true)
|
17
17
|
|
18
18
|
started_at = Time.now
|
19
19
|
requests = reader.parse
|
@@ -63,24 +63,23 @@ module Logeater
|
|
63
63
|
i + 1,
|
64
64
|
files.length ]
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
started_at = Time.now
|
69
|
-
count = reader.remove_existing_entries!
|
70
|
-
finished_at = Time.now
|
66
|
+
import_file Logeater::Logfile.new(file), app, options
|
67
|
+
end
|
71
68
|
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
finished_all = Time.now
|
70
|
+
seconds = finished_all - started_all
|
71
|
+
minutes = (seconds / 60).to_i
|
72
|
+
seconds -= (minutes * 60)
|
73
|
+
$stderr.puts "Total time %d minutes, %.2f seconds" % [minutes, seconds]
|
74
|
+
end
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
desc "import_since APP TIMESTAMP", "imports log events since timestamp"
|
77
|
+
def import_since(app, timestamp)
|
78
|
+
started_all = Time.now
|
79
|
+
$stderr.puts " > \e[34mImporting events since \e[1m#{timestamp}\e[0m\n"
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
finished_at - started_at ]
|
83
|
-
end
|
81
|
+
events = Logeater::Event.where(app: app).since(timestamp)
|
82
|
+
import_file Logeater::Eventfile.new(events), app
|
84
83
|
|
85
84
|
finished_all = Time.now
|
86
85
|
seconds = finished_all - started_all
|
@@ -89,5 +88,26 @@ module Logeater
|
|
89
88
|
$stderr.puts "Total time %d minutes, %.2f seconds" % [minutes, seconds]
|
90
89
|
end
|
91
90
|
|
91
|
+
|
92
|
+
def import_file(file, app, options={})
|
93
|
+
reader = Logeater::Reader.new(app, file, options.slice(:progress, :verbose))
|
94
|
+
|
95
|
+
started_at = Time.now
|
96
|
+
count = reader.remove_existing_entries!
|
97
|
+
finished_at = Time.now
|
98
|
+
|
99
|
+
$stderr.puts " \e[34mDeleted \e[1m%d\e[0;34m requests for #{reader.filename} in \e[1m%.2f\e[0;34m seconds\e[0m\n" % [
|
100
|
+
count,
|
101
|
+
finished_at - started_at ]
|
102
|
+
|
103
|
+
started_at = Time.now
|
104
|
+
count = reader.import
|
105
|
+
finished_at = Time.now
|
106
|
+
|
107
|
+
$stderr.puts " \e[34mImported \e[1m%d\e[0;34m requests in \e[1m%.2f\e[0;34m seconds\e[0m\n\n" % [
|
108
|
+
count,
|
109
|
+
finished_at - started_at ]
|
110
|
+
end
|
111
|
+
|
92
112
|
end
|
93
113
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Logeater
|
2
|
+
class Eventfile
|
3
|
+
attr_reader :events, :filename
|
4
|
+
attr_accessor :show_progress
|
5
|
+
alias :show_progress? :show_progress
|
6
|
+
|
7
|
+
def initialize(events)
|
8
|
+
@events = events
|
9
|
+
@filename = "events_#{events.count}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def each_line
|
13
|
+
events.pluck(:original).each do |event|
|
14
|
+
yield event
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Logeater
|
2
|
+
class Logfile
|
3
|
+
attr_reader :path, :filename
|
4
|
+
attr_accessor :show_progress
|
5
|
+
alias :show_progress? :show_progress
|
6
|
+
|
7
|
+
def initialize(path)
|
8
|
+
@path = path
|
9
|
+
@filename = File.basename(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def each_line
|
13
|
+
File.open(path) do |file|
|
14
|
+
io = File.extname(path) == ".gz" ? Zlib::GzipReader.new(file) : file
|
15
|
+
pbar = ProgressBar.create(title: filename, total: file.size, autofinish: false, output: $stderr) if show_progress?
|
16
|
+
io.each_line do |line|
|
17
|
+
yield line
|
18
|
+
pbar.progress = file.pos if show_progress?
|
19
|
+
end
|
20
|
+
pbar.finish if show_progress?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/logeater/parser.rb
CHANGED
@@ -17,7 +17,7 @@ module Logeater
|
|
17
17
|
REQUEST_LINE_MATCHER = /^
|
18
18
|
\[(?<subdomain>[^\]]+)\]\s
|
19
19
|
\[(?<uuid>[\w\-]{36})\]\s+
|
20
|
-
(?:\[(?:guest|user\.(?<user_id>\d+)(?<tester_bar>:cph)
|
20
|
+
(?:\[(?:guest|user\.(?<user_id>\d+)(?<tester_bar>:cph)?|(?<email>.+@[^\]]+))\]\s+)?
|
21
21
|
(?<message>.*)
|
22
22
|
$/x.freeze
|
23
23
|
|
@@ -69,7 +69,7 @@ module Logeater
|
|
69
69
|
{ subdomain: match["subdomain"],
|
70
70
|
uuid: match["uuid"],
|
71
71
|
type: :request_line,
|
72
|
-
user_id: match
|
72
|
+
user_id: user_id_for(match),
|
73
73
|
tester_bar: !!match["tester_bar"],
|
74
74
|
message: message
|
75
75
|
}.merge(
|
@@ -121,6 +121,12 @@ module Logeater
|
|
121
121
|
duration: match["duration"].to_i }
|
122
122
|
end
|
123
123
|
|
124
|
+
def user_id_for(match)
|
125
|
+
return match["user_id"].to_i if match["user_id"]
|
126
|
+
return match["email"] if match["email"]
|
127
|
+
nil
|
128
|
+
end
|
129
|
+
|
124
130
|
|
125
131
|
|
126
132
|
def log(statement)
|
data/lib/logeater/reader.rb
CHANGED
@@ -5,14 +5,13 @@ require "oj"
|
|
5
5
|
|
6
6
|
module Logeater
|
7
7
|
class Reader
|
8
|
-
attr_reader :app, :
|
8
|
+
attr_reader :app, :file, :batch_size
|
9
9
|
|
10
|
-
def initialize(app,
|
10
|
+
def initialize(app, file, options={})
|
11
11
|
@app = app
|
12
|
-
@
|
13
|
-
@
|
12
|
+
@file = file
|
13
|
+
@file.show_progress = options.fetch :progress, false
|
14
14
|
@parser = Logeater::Parser.new
|
15
|
-
@show_progress = options.fetch :progress, false
|
16
15
|
@batch_size = options.fetch :batch_size, 500
|
17
16
|
@verbose = options.fetch :verbose, false
|
18
17
|
@count = 0
|
@@ -54,33 +53,16 @@ module Logeater
|
|
54
53
|
end
|
55
54
|
|
56
55
|
def remove_existing_entries!
|
57
|
-
Logeater::Request.where(app: app, logfile: filename).delete_all
|
58
|
-
end
|
59
|
-
|
60
|
-
def show_progress?
|
61
|
-
@show_progress
|
56
|
+
Logeater::Request.where(app: app, logfile: file.filename).delete_all
|
62
57
|
end
|
63
58
|
|
64
59
|
def verbose?
|
65
60
|
@verbose
|
66
61
|
end
|
67
62
|
|
68
|
-
def each_line
|
69
|
-
File.open(path) do |file|
|
70
|
-
io = File.extname(path) == ".gz" ? Zlib::GzipReader.new(file) : file
|
71
|
-
pbar = ProgressBar.create(title: filename, total: file.size, autofinish: false, output: $stderr) if show_progress?
|
72
|
-
io.each_line do |line|
|
73
|
-
yield line
|
74
|
-
pbar.progress = file.pos if show_progress?
|
75
|
-
end
|
76
|
-
pbar.finish if show_progress?
|
77
|
-
end
|
78
|
-
end
|
79
|
-
alias :scan :each_line
|
80
|
-
|
81
63
|
def each_request
|
82
64
|
count = 0
|
83
|
-
each_line do |line|
|
65
|
+
file.each_line do |line|
|
84
66
|
process_line! line do |request|
|
85
67
|
yield request
|
86
68
|
count += 1
|
@@ -102,7 +84,7 @@ module Logeater
|
|
102
84
|
if attributes[:type] == :request_started
|
103
85
|
requests[attributes[:uuid]] = attributes
|
104
86
|
.slice(:uuid, :subdomain, :http_method, :path, :remote_ip, :user_id, :tester_bar)
|
105
|
-
.merge(started_at: attributes[:timestamp], logfile: filename, app: app)
|
87
|
+
.merge(started_at: attributes[:timestamp], logfile: file.filename, app: app)
|
106
88
|
return
|
107
89
|
end
|
108
90
|
|
data/lib/logeater/request.rb
CHANGED
@@ -6,14 +6,9 @@ module Logeater
|
|
6
6
|
self.table_name = "requests"
|
7
7
|
|
8
8
|
def self.import(values)
|
9
|
-
# values have to be unique by uuid
|
10
|
-
values = values.uniq { |request| request.uuid }
|
11
|
-
|
12
|
-
super values
|
13
|
-
rescue PG::UniqueViolation, ActiveRecord::RecordNotUnique
|
14
|
-
# try again after skipping requests with existing uuids
|
9
|
+
# values have to be unique by uuid so we pull already saved ones out before trying to insert
|
15
10
|
existing_uuids = where(uuid: values.map(&:uuid)).pluck(:uuid)
|
16
|
-
values = values.reject { |request| existing_uuids.member?(request.uuid) }
|
11
|
+
values = values.uniq(&:uuid).reject { |request| existing_uuids.member?(request.uuid) }
|
17
12
|
|
18
13
|
super values
|
19
14
|
end
|
data/lib/logeater/version.rb
CHANGED
data/lib/logeater.rb
CHANGED
data/logeater.gemspec
CHANGED
@@ -20,15 +20,13 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_dependency "activerecord", ">= 4.2.7", "< 5.1.0"
|
22
22
|
spec.add_dependency "activesupport", ">= 4.2.7", "< 5.1.0"
|
23
|
-
|
24
|
-
# spec.add_dependency "activesupport", "~> 5.0.0"
|
25
|
-
spec.add_dependency "pg", "~> 0.18.3"
|
23
|
+
spec.add_dependency "pg", ">= 0.18.0", "< 1.0"
|
26
24
|
spec.add_dependency "standalone_migrations", "~> 5.0.0"
|
27
25
|
spec.add_dependency "addressable"
|
28
26
|
spec.add_dependency "ruby-progressbar"
|
29
27
|
spec.add_dependency "activerecord-import", "~> 0.10"
|
30
28
|
spec.add_dependency "thor", "~> 0.19.1"
|
31
|
-
spec.add_dependency "oj", "
|
29
|
+
spec.add_dependency "oj", ">= 2.15"
|
32
30
|
|
33
31
|
spec.add_development_dependency "bundler", "~> 1.7"
|
34
32
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class LogeaterTest < ActiveSupport::TestCase
|
4
|
-
attr_reader :logfile
|
4
|
+
attr_reader :logfile, :events
|
5
5
|
|
6
6
|
|
7
7
|
context "Given the log of a single request, it" do
|
@@ -10,17 +10,17 @@ class LogeaterTest < ActiveSupport::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
should "identify the name of the logfile" do
|
13
|
-
assert_equal "single_request.log",
|
13
|
+
assert_equal "single_request.log", logfile_reader.file.filename
|
14
14
|
end
|
15
15
|
|
16
16
|
should "create an entry in the database" do
|
17
17
|
assert_difference "Logeater::Request.count", +1 do
|
18
|
-
|
18
|
+
logfile_reader.import
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
should "set all the attributes" do
|
23
|
-
|
23
|
+
logfile_reader.import
|
24
24
|
request = Logeater::Request.first
|
25
25
|
|
26
26
|
params = {"refresh_page" => "true", "id" => "1035826228"}
|
@@ -47,7 +47,7 @@ class LogeaterTest < ActiveSupport::TestCase
|
|
47
47
|
Logeater::Request.create!(app: app, logfile: "single_request.log", uuid: "3")
|
48
48
|
|
49
49
|
assert_difference "Logeater::Request.count", -2 do
|
50
|
-
|
50
|
+
logfile_reader.reimport
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -60,7 +60,62 @@ class LogeaterTest < ActiveSupport::TestCase
|
|
60
60
|
|
61
61
|
should "create an entry in the database" do
|
62
62
|
assert_difference "Logeater::Request.count", +1 do
|
63
|
-
|
63
|
+
logfile_reader.import
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
context "Given an app and a timestamp, import_since" do
|
70
|
+
setup do
|
71
|
+
log_sample = File.open(File.expand_path("./test/data/single_request.log"))
|
72
|
+
log_sample.lines do |line|
|
73
|
+
Logeater::Event.create(ep_app: app, original: line)
|
74
|
+
end
|
75
|
+
@events = Logeater::Event.all
|
76
|
+
end
|
77
|
+
|
78
|
+
should "import events since that given timestamp" do
|
79
|
+
assert_difference "Logeater::Request.count", +1 do
|
80
|
+
eventfile_reader.import
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
should "not reimport events if given twice" do
|
85
|
+
assert_difference "Logeater::Request.count", +1 do
|
86
|
+
eventfile_reader.import
|
87
|
+
end
|
88
|
+
|
89
|
+
assert_no_difference "Logeater::Request.count" do
|
90
|
+
eventfile_reader.import
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context "Given a partial request in one import and the rest in a subsiquent import, it" do
|
96
|
+
setup do
|
97
|
+
@lines = File.open(File.expand_path("./test/data/single_request.log")).lines.to_a
|
98
|
+
end
|
99
|
+
|
100
|
+
should "save the request after having the full request" do
|
101
|
+
# The first two lines will not be enough to describe a complete request
|
102
|
+
# so Logeater will not be able to create a request from them...
|
103
|
+
@lines[0...2].each do |line|
|
104
|
+
Logeater::Event.create(ep_app: app, original: line)
|
105
|
+
end
|
106
|
+
@events = Logeater::Event.all
|
107
|
+
assert_no_difference "Logeater::Request.count" do
|
108
|
+
eventfile_reader.import
|
109
|
+
end
|
110
|
+
|
111
|
+
# ...but if we later discover the rest of the lines that describe a complete
|
112
|
+
# request, it'd be good if Logeater could then recognize and import it.
|
113
|
+
@lines[2..-1].each do |line|
|
114
|
+
Logeater::Event.create(ep_app: app, original: line)
|
115
|
+
end
|
116
|
+
@events = Logeater::Event.all
|
117
|
+
assert_difference "Logeater::Request.count", +1 do
|
118
|
+
eventfile_reader.import
|
64
119
|
end
|
65
120
|
end
|
66
121
|
end
|
@@ -72,8 +127,12 @@ private
|
|
72
127
|
"test"
|
73
128
|
end
|
74
129
|
|
75
|
-
def
|
76
|
-
Logeater::Reader.new(app, logfile)
|
130
|
+
def logfile_reader
|
131
|
+
Logeater::Reader.new(app, Logeater::Logfile.new(logfile))
|
132
|
+
end
|
133
|
+
|
134
|
+
def eventfile_reader
|
135
|
+
Logeater::Reader.new(app, Logeater::Eventfile.new(events))
|
77
136
|
end
|
78
137
|
|
79
138
|
end
|
data/test/unit/parser_test.rb
CHANGED
@@ -104,11 +104,29 @@ class ParserTest < ActiveSupport::TestCase
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
+
context "that indicates the current user via email, it" do
|
108
|
+
setup do
|
109
|
+
@line = "I, [2015-01-10T15:18:05.850839 #18070] INFO -- : [livingsaviorco] [2d89d962-57c4-47c9-a9e9-6a16a5f22a12] [example@user.com] [gzip] Compress reponse by 42.2 KB (83.3%) (1.4ms)"
|
110
|
+
end
|
111
|
+
|
112
|
+
should "identify the user's email" do
|
113
|
+
assert_parses user_id: "example@user.com"
|
114
|
+
end
|
115
|
+
|
116
|
+
should "identify the remainder of the log message" do
|
117
|
+
assert_parses message: "[gzip] Compress reponse by 42.2 KB (83.3%) (1.4ms)"
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
107
121
|
context "that indicates that the user is logged out, it" do
|
108
122
|
setup do
|
109
123
|
@line = "I, [2015-01-10T15:18:05.850839 #18070] INFO -- : [livingsaviorco] [2d89d962-57c4-47c9-a9e9-6a16a5f22a12] [guest] [gzip] Compress reponse by 42.2 KB (83.3%) (1.4ms)"
|
110
124
|
end
|
111
125
|
|
126
|
+
should "identify the user as a guest" do
|
127
|
+
assert_parses user_id: nil
|
128
|
+
end
|
129
|
+
|
112
130
|
should "identify the remainder of the log message" do
|
113
131
|
assert_parses message: "[gzip] Compress reponse by 42.2 KB (83.3%) (1.4ms)"
|
114
132
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logeater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -54,16 +54,22 @@ dependencies:
|
|
54
54
|
name: pg
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.18.0
|
60
|
+
- - "<"
|
58
61
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0
|
62
|
+
version: '1.0'
|
60
63
|
type: :runtime
|
61
64
|
prerelease: false
|
62
65
|
version_requirements: !ruby/object:Gem::Requirement
|
63
66
|
requirements:
|
64
|
-
- - "
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.18.0
|
70
|
+
- - "<"
|
65
71
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0
|
72
|
+
version: '1.0'
|
67
73
|
- !ruby/object:Gem::Dependency
|
68
74
|
name: standalone_migrations
|
69
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,14 +144,14 @@ dependencies:
|
|
138
144
|
name: oj
|
139
145
|
requirement: !ruby/object:Gem::Requirement
|
140
146
|
requirements:
|
141
|
-
- - "
|
147
|
+
- - ">="
|
142
148
|
- !ruby/object:Gem::Version
|
143
149
|
version: '2.15'
|
144
150
|
type: :runtime
|
145
151
|
prerelease: false
|
146
152
|
version_requirements: !ruby/object:Gem::Requirement
|
147
153
|
requirements:
|
148
|
-
- - "
|
154
|
+
- - ">="
|
149
155
|
- !ruby/object:Gem::Version
|
150
156
|
version: '2.15'
|
151
157
|
- !ruby/object:Gem::Dependency
|
@@ -269,9 +275,14 @@ files:
|
|
269
275
|
- db/migrate/20150602022241_add_user_id_and_tester_bar_to_requests.rb
|
270
276
|
- db/migrate/20160218230227_add_indexes.rb
|
271
277
|
- db/migrate/20160502131002_drop_http_response.rb
|
278
|
+
- db/migrate/20171109171953_create_events.rb
|
279
|
+
- db/migrate/20180116193728_change_user_id_to_be_string_in_requests.rb
|
272
280
|
- db/schema.rb
|
273
281
|
- lib/logeater.rb
|
274
282
|
- lib/logeater/cli.rb
|
283
|
+
- lib/logeater/event.rb
|
284
|
+
- lib/logeater/eventfile.rb
|
285
|
+
- lib/logeater/logfile.rb
|
275
286
|
- lib/logeater/params_parser.rb
|
276
287
|
- lib/logeater/parser.rb
|
277
288
|
- lib/logeater/parser_errors.rb
|
@@ -300,12 +311,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
300
311
|
version: '0'
|
301
312
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
302
313
|
requirements:
|
303
|
-
- - "
|
314
|
+
- - ">"
|
304
315
|
- !ruby/object:Gem::Version
|
305
|
-
version:
|
316
|
+
version: 1.3.1
|
306
317
|
requirements: []
|
307
318
|
rubyforge_project:
|
308
|
-
rubygems_version: 2.
|
319
|
+
rubygems_version: 2.6.11
|
309
320
|
signing_key:
|
310
321
|
specification_version: 4
|
311
322
|
summary: Parses log files and imports them into a database
|