ntail 1.2.0 → 1.3.0
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.
- data/VERSION +1 -1
- data/lib/ntail/formatting.rb +77 -5
- data/lib/ntail/formatting.treetop +17 -1
- data/lib/ntail/log_line.rb +2 -2
- data/ntail.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
data/lib/ntail/formatting.rb
CHANGED
@@ -120,20 +120,30 @@ module Formatting
|
|
120
120
|
if r6
|
121
121
|
r0 = r6
|
122
122
|
else
|
123
|
-
r7 =
|
123
|
+
r7 = _nt_upstream_response_time
|
124
124
|
if r7
|
125
125
|
r0 = r7
|
126
126
|
else
|
127
|
-
r8 =
|
127
|
+
r8 = _nt_request_time
|
128
128
|
if r8
|
129
129
|
r0 = r8
|
130
130
|
else
|
131
|
-
r9 =
|
131
|
+
r9 = _nt_http_referer
|
132
132
|
if r9
|
133
133
|
r0 = r9
|
134
134
|
else
|
135
|
-
|
136
|
-
|
135
|
+
r10 = _nt_http_user_agent
|
136
|
+
if r10
|
137
|
+
r0 = r10
|
138
|
+
else
|
139
|
+
r11 = _nt_proxy_addresses
|
140
|
+
if r11
|
141
|
+
r0 = r11
|
142
|
+
else
|
143
|
+
@index = i0
|
144
|
+
r0 = nil
|
145
|
+
end
|
146
|
+
end
|
137
147
|
end
|
138
148
|
end
|
139
149
|
end
|
@@ -340,6 +350,68 @@ module Formatting
|
|
340
350
|
r0
|
341
351
|
end
|
342
352
|
|
353
|
+
module UpstreamResponseTime0
|
354
|
+
def value(log_line, color)
|
355
|
+
foreground(log_line.upstream_response_time, color)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
def _nt_upstream_response_time
|
360
|
+
start_index = index
|
361
|
+
if node_cache[:upstream_response_time].has_key?(index)
|
362
|
+
cached = node_cache[:upstream_response_time][index]
|
363
|
+
if cached
|
364
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
365
|
+
@index = cached.interval.end
|
366
|
+
end
|
367
|
+
return cached
|
368
|
+
end
|
369
|
+
|
370
|
+
if has_terminal?('%<T', false, index)
|
371
|
+
r0 = instantiate_node(Node,input, index...(index + 3))
|
372
|
+
r0.extend(UpstreamResponseTime0)
|
373
|
+
@index += 3
|
374
|
+
else
|
375
|
+
terminal_parse_failure('%<T')
|
376
|
+
r0 = nil
|
377
|
+
end
|
378
|
+
|
379
|
+
node_cache[:upstream_response_time][start_index] = r0
|
380
|
+
|
381
|
+
r0
|
382
|
+
end
|
383
|
+
|
384
|
+
module RequestTime0
|
385
|
+
def value(log_line, color)
|
386
|
+
foreground(log_line.request_time, color)
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
def _nt_request_time
|
391
|
+
start_index = index
|
392
|
+
if node_cache[:request_time].has_key?(index)
|
393
|
+
cached = node_cache[:request_time][index]
|
394
|
+
if cached
|
395
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
396
|
+
@index = cached.interval.end
|
397
|
+
end
|
398
|
+
return cached
|
399
|
+
end
|
400
|
+
|
401
|
+
if has_terminal?('%T', false, index)
|
402
|
+
r0 = instantiate_node(Node,input, index...(index + 2))
|
403
|
+
r0.extend(RequestTime0)
|
404
|
+
@index += 2
|
405
|
+
else
|
406
|
+
terminal_parse_failure('%T')
|
407
|
+
r0 = nil
|
408
|
+
end
|
409
|
+
|
410
|
+
node_cache[:request_time][start_index] = r0
|
411
|
+
|
412
|
+
r0
|
413
|
+
end
|
414
|
+
|
343
415
|
module HttpReferer0
|
344
416
|
def value(log_line, color)
|
345
417
|
foreground(log_line.to_referer_s, color)
|
@@ -14,7 +14,7 @@ grammar Formatting
|
|
14
14
|
end
|
15
15
|
|
16
16
|
rule token
|
17
|
-
remote_addr / remote_user / time_local / request / status / body_bytes_sent / http_referer / http_user_agent / proxy_addresses
|
17
|
+
remote_addr / remote_user / time_local / request / status / body_bytes_sent / upstream_response_time / request_time / http_referer / http_user_agent / proxy_addresses
|
18
18
|
end
|
19
19
|
|
20
20
|
rule remote_addr
|
@@ -70,6 +70,22 @@ grammar Formatting
|
|
70
70
|
}
|
71
71
|
end
|
72
72
|
|
73
|
+
rule upstream_response_time
|
74
|
+
'%<T' <Node> {
|
75
|
+
def value(log_line, color)
|
76
|
+
foreground(log_line.upstream_response_time, color)
|
77
|
+
end
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
rule request_time
|
82
|
+
'%T' <Node> {
|
83
|
+
def value(log_line, color)
|
84
|
+
foreground(log_line.request_time, color)
|
85
|
+
end
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
73
89
|
rule http_referer
|
74
90
|
'%R' <Node> {
|
75
91
|
def value(log_line, color)
|
data/lib/ntail/log_line.rb
CHANGED
@@ -27,8 +27,8 @@ module NginxTail
|
|
27
27
|
|
28
28
|
# UPSTREAM = NGINX + ...
|
29
29
|
|
30
|
-
:upstream_response_time, #
|
31
|
-
:request_time, # %D
|
30
|
+
:upstream_response_time, # %<T (seconds, with millisecond resolution)
|
31
|
+
:request_time, # %T or %>T (seconds, with millisecond resolution) / but also see: %D (microseconds)
|
32
32
|
|
33
33
|
# APACHE
|
34
34
|
|
data/ntail.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ntail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -294,7 +294,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
294
294
|
version: '0'
|
295
295
|
segments:
|
296
296
|
- 0
|
297
|
-
hash:
|
297
|
+
hash: 648352988503521497
|
298
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
299
299
|
none: false
|
300
300
|
requirements:
|