rails_log_parser 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/rails_log_parser/not_parseable_lines.rb +7 -1
- data/lib/rails_log_parser/parser.rb +21 -5
- data/rails_log_parser.gemspec +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: 6570aad9bd2c13fe7c8e86ad2ddece7a64319043122e195b2ce57fb89916cb44
|
|
4
|
+
data.tar.gz: 0e70389c743ca8f08bcd581726e3b48741ebe690b320b63d5bcdd0ef31955af2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 422df67cbf2cf72dbe7a84a1fe7bf865a9895010ef220c19f2c9c6209ca3b1d4b450ef3c52f38ad8facc4f5b5b89c89a08bcace3ad12701a0e8daf695b5cac2a
|
|
7
|
+
data.tar.gz: c5d900bd03d0c6786972ba3ef4b1b399bb47fe015b5697e31d3e270a9ec942f89b6ce07809c4df92fbdc4e96cde842d973a53426c5de74f46663d7be99cb1f16
|
data/README.md
CHANGED
|
@@ -45,6 +45,11 @@ parser = RailsLogParser::Parser.from_file(log_path)
|
|
|
45
45
|
print parser.summary(last_minutes: 22) # print summary for the last 22 minutes
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
```ruby
|
|
49
|
+
parser = RailsLogParser::Parser.from_journalctl(unit: "myapp.service", since: "1 hour ago")
|
|
50
|
+
print parser.summary(last_minutes: 22) # print summary for the last 22 minutes
|
|
51
|
+
```
|
|
52
|
+
|
|
48
53
|
You can configure filters:
|
|
49
54
|
|
|
50
55
|
```ruby
|
|
@@ -60,6 +65,14 @@ end
|
|
|
60
65
|
|
|
61
66
|
## Changelog
|
|
62
67
|
|
|
68
|
+
### 0.0.21
|
|
69
|
+
|
|
70
|
+
* Use `ignore_lines` on not parsable lines
|
|
71
|
+
|
|
72
|
+
### 0.0.20
|
|
73
|
+
|
|
74
|
+
* Add support for journald
|
|
75
|
+
|
|
63
76
|
### 0.0.19
|
|
64
77
|
|
|
65
78
|
* Ignore lines after ActiveJob lines
|
|
@@ -12,7 +12,7 @@ class RailsLogParser::NotParseableLines
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def push(line)
|
|
15
|
-
@lines.push(line) unless
|
|
15
|
+
@lines.push(line) unless ignore?(line)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def save
|
|
@@ -31,6 +31,12 @@ class RailsLogParser::NotParseableLines
|
|
|
31
31
|
@stats[Date.today.to_s] || []
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def ignore?(line)
|
|
35
|
+
return true if today_lines.include?(line)
|
|
36
|
+
|
|
37
|
+
RailsLogParser.ignore_lines.any? {|ignore| line.match?(ignore) }
|
|
38
|
+
end
|
|
39
|
+
|
|
34
40
|
def load_file
|
|
35
41
|
@stats = JSON.parse(File.read(@path))
|
|
36
42
|
@stats ||= {}
|
|
@@ -8,15 +8,31 @@ class RailsLogParser::Parser
|
|
|
8
8
|
@log_path || ENV['LOG_PATH'] || raise('no log_path given')
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
def
|
|
11
|
+
def from_io(io)
|
|
12
12
|
parser = new
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
end
|
|
13
|
+
|
|
14
|
+
io.each_line do |line|
|
|
15
|
+
parser.puts(line)
|
|
17
16
|
end
|
|
17
|
+
|
|
18
18
|
parser
|
|
19
19
|
end
|
|
20
|
+
|
|
21
|
+
def from_file(path)
|
|
22
|
+
File.open(path, 'r') do |file|
|
|
23
|
+
from_io(file)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def from_journalctl(unit:, since: nil)
|
|
28
|
+
cmd = ["journalctl", "-u", unit, "-o", "cat"]
|
|
29
|
+
|
|
30
|
+
cmd += ["--since", since] if since
|
|
31
|
+
|
|
32
|
+
IO.popen(cmd, err: [:child, :out]) do |io|
|
|
33
|
+
from_io(io)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
20
36
|
end
|
|
21
37
|
|
|
22
38
|
attr_reader :not_parseable_lines, :last_action
|
data/rails_log_parser.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_log_parser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Georg Limbach
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: enumerize
|