papertrail 0.9.12 → 0.9.13
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 +7 -0
- data/Gemfile +1 -0
- data/README.md +47 -24
- data/bin/papertrail-leave-group +8 -0
- data/lib/papertrail.rb +1 -1
- data/lib/papertrail/cli.rb +59 -20
- data/lib/papertrail/cli_leave_group.rb +78 -0
- data/lib/papertrail/connection.rb +8 -0
- data/lib/papertrail/http_client.rb +33 -4
- data/papertrail.gemspec +9 -5
- metadata +66 -65
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5327015cf4d283298b30e7b29ff67a3adfffe55b
|
|
4
|
+
data.tar.gz: 03f354db49d33b5b0aca4b6e32dc0ae1b31259fe
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 155917c02088843bb3c9cc86f84f8496393260cefd1330f857a4ab585577b39c0a973ea63c49c42f85c6e8ea47fbe10e05b748e0769a6e543e99365a04dd6c0e
|
|
7
|
+
data.tar.gz: 83c6bdb35966d3600964911c7591b8a9fb9f278c41f4a96adcf81b20127aa5747b78185bea4a01cd1348ba04197e345e2608036252dd0af7350d4e87d0b532e5
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -9,15 +9,15 @@ Supports optional Boolean search queries and polling for new events
|
|
|
9
9
|
$ papertrail -f "(www OR db) (nginx OR pgsql) -accepted"
|
|
10
10
|
|
|
11
11
|
Output is line-buffered so it can be fed into a pipe, like for grep.
|
|
12
|
-
ANSI color codes are rendered in color on suitable terminals; see below for
|
|
12
|
+
ANSI color codes are rendered in color on suitable terminals; see below for
|
|
13
13
|
additional colorization options.
|
|
14
14
|
|
|
15
15
|
The [Connection] class can be used by other apps to perform one-off
|
|
16
16
|
API searches or follow (tail) events matching a given query. Interface
|
|
17
17
|
may change.
|
|
18
18
|
|
|
19
|
-
Also includes `papertrail-add-system`, `papertrail-remove-system`,
|
|
20
|
-
`papertrail-add-group`, and `papertrail-join-group` binaries, which
|
|
19
|
+
Also includes `papertrail-add-system`, `papertrail-remove-system`,
|
|
20
|
+
`papertrail-add-group`, and `papertrail-join-group` binaries, which
|
|
21
21
|
invoke the corresponding Papertrail [HTTP API] call.
|
|
22
22
|
|
|
23
23
|
|
|
@@ -70,12 +70,13 @@ You may want to alias "pt" to "papertrail", like:
|
|
|
70
70
|
-c, --configfile PATH Path to config (~/.papertrail.yml)
|
|
71
71
|
-s, --system SYSTEM System to search
|
|
72
72
|
-g, --group GROUP Group to search
|
|
73
|
+
-S, --search SEARCH Saved search to search
|
|
73
74
|
-j, --json Output raw json data
|
|
74
75
|
--min-time MIN Earliest time to search from.
|
|
75
76
|
--max-time MAX Latest time to search from.
|
|
76
77
|
|
|
77
78
|
|
|
78
|
-
Usage:
|
|
79
|
+
Usage:
|
|
79
80
|
papertrail [-f] [-s system] [-g group] [-d seconds] [-c papertrail.yml] [-j] [--min-time mintime] [--max-time maxtime] [query]
|
|
80
81
|
|
|
81
82
|
Examples:
|
|
@@ -85,34 +86,58 @@ You may want to alias "pt" to "papertrail", like:
|
|
|
85
86
|
papertrail -s ns1 "connection refused"
|
|
86
87
|
papertrail -f "(www OR db) (nginx OR pgsql) -accepted"
|
|
87
88
|
papertrail -f -g Production "(nginx OR pgsql) -accepted"
|
|
89
|
+
papertrail -S "Critical errors"
|
|
88
90
|
papertrail -g Production --min-time 'yesterday at noon' --max-time 'today at 4am'
|
|
89
91
|
|
|
90
92
|
Includes 4 binaries to change Papertrail settings: papertrail-add-system, papertrail-remove-system,
|
|
91
93
|
papertrail-add-group, papertrail-leave-group. Run with --help or see README.
|
|
92
94
|
|
|
93
95
|
More: http://papertrailapp.com/
|
|
94
|
-
|
|
95
96
|
|
|
96
|
-
### Colors
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
### Count, pivot, and summarize
|
|
99
|
+
|
|
100
|
+
To count the number of matches, pipe to `wc -l`. For example, count how
|
|
101
|
+
many logs contained `Failure` in the last minute:
|
|
102
|
+
|
|
103
|
+
$ papertrail --min-time '1 minute ago' Failure | wc -l
|
|
104
|
+
42
|
|
105
|
+
|
|
106
|
+
Output only the program/file name (which is output as field 5):
|
|
107
|
+
|
|
108
|
+
$ papertrail --min-time '1 minute ago' | cut -f 5 -d ' '
|
|
109
|
+
passenger.log:
|
|
110
|
+
sshd:
|
|
111
|
+
app/web.2:
|
|
100
112
|
|
|
101
|
-
|
|
102
|
-
[MultiTail]. We recommend `colortail``:
|
|
113
|
+
Count by source/system name (field 4):
|
|
103
114
|
|
|
104
|
-
$
|
|
115
|
+
$ papertrail --min-time '1 minute ago' | cut -f 4 -d ' ' | sort | uniq -c
|
|
116
|
+
98 www42
|
|
117
|
+
39 acmedb-core01
|
|
118
|
+
2 fastly
|
|
119
|
+
|
|
120
|
+
For sum, mean, and statistics, see
|
|
121
|
+
[datamash](http://www.gnu.org/software/datamash/).
|
|
122
|
+
|
|
123
|
+
### Colors
|
|
124
|
+
|
|
125
|
+
ANSI color codes are retained, so log messages which are already colorized
|
|
126
|
+
will automatically render in color on ANSI-capable terminals.
|
|
105
127
|
|
|
106
|
-
|
|
128
|
+
To colorize monochrome logs, pipe through [lnav]. Install `lnav` from your
|
|
129
|
+
preferred package repository, such as `brew install lnav` or
|
|
130
|
+
`apt-get install lnav`, then:
|
|
107
131
|
|
|
108
|
-
$ papertrail -f
|
|
132
|
+
$ papertrail -f | lnav
|
|
133
|
+
$ papertrail --min-time "1 hour ago" error | lnav
|
|
109
134
|
|
|
110
135
|
### Shorthand
|
|
111
136
|
|
|
112
137
|
If you're using bash, create a function that accepts arguments, then
|
|
113
138
|
invoke `pt` with optional search operators:
|
|
114
139
|
|
|
115
|
-
$ function pt() { papertrail -f -d 5 $* |
|
|
140
|
+
$ function pt() { papertrail -f -d 5 $* | lnav; }
|
|
116
141
|
$ pt 1.2.3 Failure
|
|
117
142
|
|
|
118
143
|
Add the function line to your `~/.bashrc`.
|
|
@@ -131,22 +156,22 @@ and can be any ANSI [escape characters].
|
|
|
131
156
|
|
|
132
157
|
### UTF-8 (non-English searches)
|
|
133
158
|
|
|
134
|
-
When searching in a language other than English, if you get no matches, you
|
|
135
|
-
may need to explicitly tell Ruby to use UTF-8. Ruby 1.9 honors the `LANG`
|
|
159
|
+
When searching in a language other than English, if you get no matches, you
|
|
160
|
+
may need to explicitly tell Ruby to use UTF-8. Ruby 1.9 honors the `LANG`
|
|
136
161
|
shell environment variable, and your shell may not set it to `UTF-8`.
|
|
137
162
|
|
|
138
163
|
To test, try:
|
|
139
164
|
|
|
140
165
|
ruby -E:UTF-8 -S papertrail your_search
|
|
141
166
|
|
|
142
|
-
If that works, add `-E:UTF-8` to the `RUBYOPT` variable to set the encoding
|
|
167
|
+
If that works, add `-E:UTF-8` to the `RUBYOPT` variable to set the encoding
|
|
143
168
|
at invocation. For example, to persist that in a `.bashrc`:
|
|
144
169
|
|
|
145
170
|
export RUBYOPT="-E:UTF-8"
|
|
146
171
|
|
|
147
172
|
### Negation-only queries
|
|
148
173
|
|
|
149
|
-
Unix shells handle arguments beginning with hyphens (`-`) differently
|
|
174
|
+
Unix shells handle arguments beginning with hyphens (`-`) differently
|
|
150
175
|
([why](http://unix.stackexchange.com/questions/11376/what-does-double-dash-mean)).
|
|
151
176
|
Usually this is moot because most searches start with a positive match.
|
|
152
177
|
To search only for log messages without a given string, use `--`. For
|
|
@@ -190,13 +215,13 @@ even though one is for 4 words (AND) while the other is for a phrase:
|
|
|
190
215
|
|
|
191
216
|
## Add/Remove Systems, Create Group, Join Group
|
|
192
217
|
|
|
193
|
-
In addition to tail and search with the `papertrail` binary, the gem includes
|
|
194
|
-
4 other binaries which wrap other parts of Papertrail's [HTTP API] to explicitly
|
|
218
|
+
In addition to tail and search with the `papertrail` binary, the gem includes
|
|
219
|
+
4 other binaries which wrap other parts of Papertrail's [HTTP API] to explicitly
|
|
195
220
|
add or remove a system, to create a new group, and to join a system to a group.
|
|
196
221
|
|
|
197
222
|
In most cases, configuration is automatic and these are not not necessary.
|
|
198
223
|
|
|
199
|
-
To see usage, run any of these commands with `--help`: `papertrail-add-system`,
|
|
224
|
+
To see usage, run any of these commands with `--help`: `papertrail-add-system`,
|
|
200
225
|
`papertrail-remove-system`, `papertrail-add-group`, `papertrail-join-group`.
|
|
201
226
|
|
|
202
227
|
|
|
@@ -223,7 +248,5 @@ to your enhancement.
|
|
|
223
248
|
[HTTP API]: http://help.papertrailapp.com/kb/how-it-works/http-api
|
|
224
249
|
[User Profile]: https://papertrailapp.com/user/edit
|
|
225
250
|
[RubyGems]: https://rubygems.org/gems/papertrail-cli
|
|
226
|
-
[
|
|
227
|
-
[colortailrc]: https://github.com/papertrail/papertrail-cli/wiki/colortailrc
|
|
228
|
-
[MultiTail]: http://www.vanheusden.com/multitail/index.html
|
|
251
|
+
[lnav]: http://lnav.org/
|
|
229
252
|
[escape characters]: http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
data/lib/papertrail.rb
CHANGED
data/lib/papertrail/cli.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'optparse'
|
|
2
2
|
require 'yaml'
|
|
3
3
|
require 'chronic'
|
|
4
|
+
require 'ansi/core'
|
|
4
5
|
|
|
5
6
|
require 'papertrail/connection'
|
|
6
7
|
require 'papertrail/cli_helpers'
|
|
@@ -17,7 +18,9 @@ module Papertrail
|
|
|
17
18
|
:configfile => nil,
|
|
18
19
|
:delay => 2,
|
|
19
20
|
:follow => false,
|
|
20
|
-
:token => ENV['PAPERTRAIL_API_TOKEN']
|
|
21
|
+
:token => ENV['PAPERTRAIL_API_TOKEN'],
|
|
22
|
+
:color => :program,
|
|
23
|
+
:force_color => false,
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
@query_options = {}
|
|
@@ -37,32 +40,40 @@ module Papertrail
|
|
|
37
40
|
puts opts
|
|
38
41
|
exit
|
|
39
42
|
end
|
|
40
|
-
opts.on("-f", "--follow", "Continue running and
|
|
43
|
+
opts.on("-f", "--follow", "Continue running and printing new events (off)") do |v|
|
|
41
44
|
options[:follow] = true
|
|
42
45
|
end
|
|
46
|
+
opts.on("--min-time MIN", "Earliest time to search from") do |v|
|
|
47
|
+
options[:min_time] = v
|
|
48
|
+
end
|
|
49
|
+
opts.on("--max-time MAX", "Latest time to search from") do |v|
|
|
50
|
+
options[:max_time] = v
|
|
51
|
+
end
|
|
43
52
|
opts.on("-d", "--delay SECONDS", "Delay between refresh (2)") do |v|
|
|
44
53
|
options[:delay] = v.to_i
|
|
45
54
|
end
|
|
46
55
|
opts.on("-c", "--configfile PATH", "Path to config (~/.papertrail.yml)") do |v|
|
|
47
56
|
options[:configfile] = File.expand_path(v)
|
|
48
57
|
end
|
|
49
|
-
opts.on("-s", "--system SYSTEM", "System to search") do |v|
|
|
50
|
-
options[:system] = v
|
|
51
|
-
end
|
|
52
58
|
opts.on("-g", "--group GROUP", "Group to search") do |v|
|
|
53
59
|
options[:group] = v
|
|
54
60
|
end
|
|
55
61
|
opts.on("-S", "--search SEARCH", "Saved search to search") do |v|
|
|
56
62
|
options[:search] = v
|
|
57
63
|
end
|
|
58
|
-
opts.on("-
|
|
64
|
+
opts.on("-s", "--system SYSTEM", "System to search") do |v|
|
|
65
|
+
options[:system] = v
|
|
66
|
+
end
|
|
67
|
+
opts.on("-j", "--json", "Output raw JSON data (off)") do |v|
|
|
59
68
|
options[:json] = true
|
|
60
69
|
end
|
|
61
|
-
opts.on("--
|
|
62
|
-
|
|
70
|
+
opts.on("--color [program|sender|all|off] (program)",
|
|
71
|
+
[:program, :sender, :all, :off],
|
|
72
|
+
"Attribute(s) to colorize based on") do |v|
|
|
73
|
+
options[:color] = v
|
|
63
74
|
end
|
|
64
|
-
opts.on("--
|
|
65
|
-
options[:
|
|
75
|
+
opts.on("--force-color", "Force use of ANSI color characters even on non-tty outputs (off)") do |v|
|
|
76
|
+
options[:force_color] = true
|
|
66
77
|
end
|
|
67
78
|
|
|
68
79
|
opts.separator usage
|
|
@@ -72,7 +83,7 @@ module Papertrail
|
|
|
72
83
|
configfile_options = load_configfile(options[:configfile])
|
|
73
84
|
options.merge!(configfile_options)
|
|
74
85
|
end
|
|
75
|
-
|
|
86
|
+
|
|
76
87
|
unless options[:token]
|
|
77
88
|
abort 'Authentication token not found. Set config file "token" attribute or PAPERTRAIL_API_TOKEN.'
|
|
78
89
|
end
|
|
@@ -132,30 +143,58 @@ module Papertrail
|
|
|
132
143
|
if options[:json]
|
|
133
144
|
$stdout.puts Papertrail::OkJson.encode(event.data)
|
|
134
145
|
else
|
|
135
|
-
|
|
146
|
+
display_result(event)
|
|
136
147
|
end
|
|
137
148
|
end
|
|
138
149
|
end
|
|
139
150
|
|
|
151
|
+
COLORS = [:cyan, :yellow, :green, :magenta, :red]
|
|
152
|
+
|
|
153
|
+
def colorize(event)
|
|
154
|
+
attribs = ""
|
|
155
|
+
if options[:color] == :sender || options[:color] == :all
|
|
156
|
+
attribs += event.data["hostname"]
|
|
157
|
+
end
|
|
158
|
+
if options[:color] == :program || options[:color] == :all
|
|
159
|
+
attribs += event.data["program"]
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
idx = attribs.hash % 5
|
|
163
|
+
color = COLORS[idx]
|
|
164
|
+
pre = "#{event.received_at.strftime('%b %e %X')} #{event.data['hostname']} #{event.data['program']}:"
|
|
165
|
+
post = " #{event.data['message']}"
|
|
166
|
+
pre.ansi(color) + post
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def display_colors?
|
|
170
|
+
options[:color] != :off &&
|
|
171
|
+
(options[:force_color] || (STDOUT.isatty && ENV.has_key?("TERM")))
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def display_result(event)
|
|
175
|
+
event_str = display_colors? ? colorize(event) : event.to_s
|
|
176
|
+
$stdout.puts event_str
|
|
177
|
+
end
|
|
178
|
+
|
|
140
179
|
def display_results(results)
|
|
141
180
|
if options[:json]
|
|
142
181
|
$stdout.puts Papertrail::OkJson.encode(results.data)
|
|
143
182
|
else
|
|
144
183
|
results.events.each do |event|
|
|
145
|
-
|
|
184
|
+
display_result(event)
|
|
146
185
|
end
|
|
147
186
|
end
|
|
148
187
|
|
|
149
188
|
$stdout.flush
|
|
150
189
|
end
|
|
151
190
|
|
|
152
|
-
|
|
153
191
|
def usage
|
|
154
192
|
<<-EOF
|
|
155
193
|
|
|
156
194
|
Usage:
|
|
157
|
-
papertrail [-f] [-
|
|
158
|
-
[-
|
|
195
|
+
papertrail [-f] [--min-time time] [--max-time time] [-g group] [-S search]
|
|
196
|
+
[-s system] [-d seconds] [-c papertrail.yml] [-j] [--color attributes]
|
|
197
|
+
[--force-color] [query]
|
|
159
198
|
|
|
160
199
|
Examples:
|
|
161
200
|
papertrail -f
|
|
@@ -163,11 +202,11 @@ module Papertrail
|
|
|
163
202
|
papertrail 1.2.3 Failure
|
|
164
203
|
papertrail -s ns1 "connection refused"
|
|
165
204
|
papertrail -f "(www OR db) (nginx OR pgsql) -accepted"
|
|
166
|
-
papertrail -f -g Production "(nginx OR pgsql) -accepted"
|
|
167
|
-
papertrail
|
|
168
|
-
|
|
169
|
-
More: https://papertrailapp.com/
|
|
205
|
+
papertrail -f -g Production --color all "(nginx OR pgsql) -accepted"
|
|
206
|
+
papertrail --min-time 'yesterday at noon' --max-time 'today at 4am' -g Production
|
|
170
207
|
|
|
208
|
+
More: https://github.com/papertrail/papertrail-cli
|
|
209
|
+
https://papertrailapp.com/
|
|
171
210
|
EOF
|
|
172
211
|
end
|
|
173
212
|
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require 'optparse'
|
|
2
|
+
require 'yaml'
|
|
3
|
+
|
|
4
|
+
require 'papertrail/cli_helpers'
|
|
5
|
+
require 'papertrail/connection'
|
|
6
|
+
|
|
7
|
+
module Papertrail
|
|
8
|
+
class CliLeaveGroup
|
|
9
|
+
include Papertrail::CliHelpers
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
options = {
|
|
13
|
+
:configfile => nil,
|
|
14
|
+
:token => ENV['PAPERTRAIL_API_TOKEN'],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if configfile = find_configfile
|
|
18
|
+
configfile_options = load_configfile(configfile)
|
|
19
|
+
options.merge!(configfile_options)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
OptionParser.new do |opts|
|
|
23
|
+
opts.banner = "papertrail-leave-group"
|
|
24
|
+
|
|
25
|
+
opts.on("-h", "--help", "Show usage") do |v|
|
|
26
|
+
puts opts
|
|
27
|
+
exit
|
|
28
|
+
end
|
|
29
|
+
opts.on("-c", "--configfile PATH", "Path to config (~/.papertrail.yml)") do |v|
|
|
30
|
+
options[:configfile] = File.expand_path(v)
|
|
31
|
+
end
|
|
32
|
+
opts.on("-s", "--system SYSTEM", "Name of system to add to group") do |v|
|
|
33
|
+
options[:system] = v
|
|
34
|
+
end
|
|
35
|
+
opts.on("-g", "--group GROUP", "Name of group to leave") do |v|
|
|
36
|
+
options[:group] = v
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
opts.separator usage
|
|
40
|
+
end.parse!
|
|
41
|
+
|
|
42
|
+
if options[:configfile]
|
|
43
|
+
configfile_options = load_configfile(options[:configfile])
|
|
44
|
+
options.merge!(configfile_options)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
raise OptionParser::MissingArgument, 'system' if options[:system].nil?
|
|
48
|
+
raise OptionParser::MissingArgument, 'group' if options[:group].nil?
|
|
49
|
+
|
|
50
|
+
connection = Papertrail::Connection.new(options)
|
|
51
|
+
|
|
52
|
+
if connection.leave_group(options[:system], options[:group])
|
|
53
|
+
exit 0
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
exit 1
|
|
57
|
+
rescue OptionParser::ParseError => e
|
|
58
|
+
puts "Error: #{e}"
|
|
59
|
+
puts usage
|
|
60
|
+
exit 1
|
|
61
|
+
rescue Net::HTTPServerException => e
|
|
62
|
+
output_http_error(e)
|
|
63
|
+
exit 1
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def usage
|
|
67
|
+
<<-EOF
|
|
68
|
+
|
|
69
|
+
Usage:
|
|
70
|
+
papertrail-leave-group [-s system] [-g group] [-c papertrail.yml]
|
|
71
|
+
|
|
72
|
+
Example:
|
|
73
|
+
papertrail-leave-group -s mymachine -g mygroup
|
|
74
|
+
|
|
75
|
+
EOF
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -119,6 +119,14 @@ module Papertrail
|
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
+
def leave_group(source_name, group_name)
|
|
123
|
+
source_id = find_id_for_source(source_name)
|
|
124
|
+
group_id = find_id_for_group(group_name)
|
|
125
|
+
if source_id && group_id
|
|
126
|
+
@connection.post("systems/#{source_id}/leave.json", :group_id => group_id)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
122
130
|
def register_source(name, *args)
|
|
123
131
|
options = args.last.is_a?(Hash) ? args.pop.dup : {}
|
|
124
132
|
|
|
@@ -42,19 +42,48 @@ module Papertrail
|
|
|
42
42
|
if params.size > 0
|
|
43
43
|
path = "#{path}?#{build_nested_query(params)}"
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
attempts = 0
|
|
46
|
+
begin
|
|
47
|
+
on_complete(https.get(request_uri(path), @headers))
|
|
48
|
+
rescue SystemCallError, Net::HTTPFatalError => e
|
|
49
|
+
sleep 5.0
|
|
50
|
+
attempts += 1
|
|
51
|
+
retry if (attempts < 3)
|
|
52
|
+
raise e
|
|
53
|
+
end
|
|
46
54
|
end
|
|
47
55
|
|
|
48
56
|
def put(path, params)
|
|
49
|
-
|
|
57
|
+
attempts = 0
|
|
58
|
+
begin
|
|
59
|
+
on_complete(https.put(request_uri(path), build_nested_query(params), @headers))
|
|
60
|
+
rescue SystemCallError, Net::HTTPFatalError => e
|
|
61
|
+
attempts += 1
|
|
62
|
+
retry if (attempts < 3)
|
|
63
|
+
raise e
|
|
64
|
+
end
|
|
50
65
|
end
|
|
51
66
|
|
|
52
67
|
def post(path, params)
|
|
53
|
-
|
|
68
|
+
attempts = 0
|
|
69
|
+
begin
|
|
70
|
+
on_complete(https.post(request_uri(path), build_nested_query(params), @headers))
|
|
71
|
+
rescue SystemCallError, Net::HTTPFatalError => e
|
|
72
|
+
attempts += 1
|
|
73
|
+
retry if (attempts < 3)
|
|
74
|
+
raise e
|
|
75
|
+
end
|
|
54
76
|
end
|
|
55
77
|
|
|
56
78
|
def delete(path)
|
|
57
|
-
|
|
79
|
+
attempts = 0
|
|
80
|
+
begin
|
|
81
|
+
on_complete(https.delete(request_uri(path), @headers))
|
|
82
|
+
rescue SystemCallError, Net::HTTPFatalError => e
|
|
83
|
+
attempts += 1
|
|
84
|
+
retry if (attempts < 3)
|
|
85
|
+
raise e
|
|
86
|
+
end
|
|
58
87
|
end
|
|
59
88
|
|
|
60
89
|
private
|
data/papertrail.gemspec
CHANGED
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
|
14
14
|
## the sub! line in the Rakefile
|
|
15
15
|
s.name = 'papertrail'
|
|
16
|
-
s.version = '0.9.
|
|
17
|
-
s.date = '2015-
|
|
16
|
+
s.version = '0.9.13'
|
|
17
|
+
s.date = '2015-12-09'
|
|
18
18
|
s.rubyforge_project = 'papertrail'
|
|
19
19
|
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
|
28
28
|
s.authors = ['Papertrail']
|
|
29
29
|
s.email = 'troy@sevenscale.com'
|
|
30
30
|
s.homepage = 'http://github.com/papertrail/papertrail-cli'
|
|
31
|
+
s.license = 'MIT'
|
|
31
32
|
|
|
32
33
|
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
|
33
34
|
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
|
@@ -38,7 +39,7 @@ Gem::Specification.new do |s|
|
|
|
38
39
|
# s.extensions = %w[ext/extconf.rb]
|
|
39
40
|
|
|
40
41
|
## If your gem includes any executables, list them here.
|
|
41
|
-
s.executables = ["papertrail", "papertrail-add-system", "papertrail-remove-system", "papertrail-add-group", "papertrail-join-group"]
|
|
42
|
+
s.executables = ["papertrail", "papertrail-add-system", "papertrail-remove-system", "papertrail-add-group", "papertrail-join-group", "papertrail-leave-group"]
|
|
42
43
|
s.default_executable = 'papertrail'
|
|
43
44
|
|
|
44
45
|
## Specify any RDoc options here. You'll want to add your README and
|
|
@@ -49,11 +50,12 @@ Gem::Specification.new do |s|
|
|
|
49
50
|
|
|
50
51
|
## List your runtime dependencies here. Runtime dependencies are those
|
|
51
52
|
## that are needed for an end user to actually USE your code.
|
|
52
|
-
s.add_dependency('chronic')
|
|
53
|
+
s.add_dependency('chronic', '~> 0.10')
|
|
54
|
+
s.add_dependency('ansi', '~> 1.5')
|
|
53
55
|
|
|
54
56
|
## List your development dependencies here. Development dependencies are
|
|
55
57
|
## those that are only needed during development
|
|
56
|
-
s.add_development_dependency('rake')
|
|
58
|
+
s.add_development_dependency('rake', '~> 10.4')
|
|
57
59
|
|
|
58
60
|
## Leave this section as-is. It will be automatically generated from the
|
|
59
61
|
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
|
@@ -68,6 +70,7 @@ Gem::Specification.new do |s|
|
|
|
68
70
|
bin/papertrail-add-group
|
|
69
71
|
bin/papertrail-add-system
|
|
70
72
|
bin/papertrail-join-group
|
|
73
|
+
bin/papertrail-leave-group
|
|
71
74
|
bin/papertrail-remove-system
|
|
72
75
|
examples/papertrail.yml.example
|
|
73
76
|
lib/papertrail.rb
|
|
@@ -76,6 +79,7 @@ Gem::Specification.new do |s|
|
|
|
76
79
|
lib/papertrail/cli_add_system.rb
|
|
77
80
|
lib/papertrail/cli_helpers.rb
|
|
78
81
|
lib/papertrail/cli_join_group.rb
|
|
82
|
+
lib/papertrail/cli_leave_group.rb
|
|
79
83
|
lib/papertrail/cli_remove_system.rb
|
|
80
84
|
lib/papertrail/connection.rb
|
|
81
85
|
lib/papertrail/event.rb
|
metadata
CHANGED
|
@@ -1,63 +1,71 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: papertrail
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
prerelease:
|
|
6
|
-
segments:
|
|
7
|
-
- 0
|
|
8
|
-
- 9
|
|
9
|
-
- 12
|
|
10
|
-
version: 0.9.12
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.9.13
|
|
11
5
|
platform: ruby
|
|
12
|
-
authors:
|
|
6
|
+
authors:
|
|
13
7
|
- Papertrail
|
|
14
8
|
autorequire:
|
|
15
9
|
bindir: bin
|
|
16
10
|
cert_chain: []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- !ruby/object:Gem::Dependency
|
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
21
14
|
name: chronic
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.10'
|
|
20
|
+
type: :runtime
|
|
22
21
|
prerelease: false
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: ansi
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '1.5'
|
|
32
34
|
type: :runtime
|
|
33
|
-
version_requirements: *id001
|
|
34
|
-
- !ruby/object:Gem::Dependency
|
|
35
|
-
name: rake
|
|
36
35
|
prerelease: false
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.5'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '10.4'
|
|
46
48
|
type: :development
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '10.4'
|
|
55
|
+
description: Command-line client for Papertrail hosted log management service. Tails
|
|
56
|
+
and searches app server logs and system syslog. Supports Boolean search and works
|
|
57
|
+
with grep and pipe output (Unix).
|
|
49
58
|
email: troy@sevenscale.com
|
|
50
|
-
executables:
|
|
59
|
+
executables:
|
|
51
60
|
- papertrail
|
|
52
61
|
- papertrail-add-system
|
|
53
62
|
- papertrail-remove-system
|
|
54
63
|
- papertrail-add-group
|
|
55
64
|
- papertrail-join-group
|
|
65
|
+
- papertrail-leave-group
|
|
56
66
|
extensions: []
|
|
57
|
-
|
|
58
67
|
extra_rdoc_files: []
|
|
59
|
-
|
|
60
|
-
files:
|
|
68
|
+
files:
|
|
61
69
|
- Gemfile
|
|
62
70
|
- LICENSE
|
|
63
71
|
- README.md
|
|
@@ -66,6 +74,7 @@ files:
|
|
|
66
74
|
- bin/papertrail-add-group
|
|
67
75
|
- bin/papertrail-add-system
|
|
68
76
|
- bin/papertrail-join-group
|
|
77
|
+
- bin/papertrail-leave-group
|
|
69
78
|
- bin/papertrail-remove-system
|
|
70
79
|
- examples/papertrail.yml.example
|
|
71
80
|
- lib/papertrail.rb
|
|
@@ -74,6 +83,7 @@ files:
|
|
|
74
83
|
- lib/papertrail/cli_add_system.rb
|
|
75
84
|
- lib/papertrail/cli_helpers.rb
|
|
76
85
|
- lib/papertrail/cli_join_group.rb
|
|
86
|
+
- lib/papertrail/cli_leave_group.rb
|
|
77
87
|
- lib/papertrail/cli_remove_system.rb
|
|
78
88
|
- lib/papertrail/connection.rb
|
|
79
89
|
- lib/papertrail/event.rb
|
|
@@ -83,37 +93,28 @@ files:
|
|
|
83
93
|
- lib/papertrail/search_result.rb
|
|
84
94
|
- papertrail.gemspec
|
|
85
95
|
homepage: http://github.com/papertrail/papertrail-cli
|
|
86
|
-
licenses:
|
|
87
|
-
|
|
96
|
+
licenses:
|
|
97
|
+
- MIT
|
|
98
|
+
metadata: {}
|
|
88
99
|
post_install_message:
|
|
89
|
-
rdoc_options:
|
|
90
|
-
- --charset=UTF-8
|
|
91
|
-
require_paths:
|
|
100
|
+
rdoc_options:
|
|
101
|
+
- "--charset=UTF-8"
|
|
102
|
+
require_paths:
|
|
92
103
|
- lib
|
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
|
-
|
|
95
|
-
requirements:
|
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
|
+
requirements:
|
|
96
106
|
- - ">="
|
|
97
|
-
- !ruby/object:Gem::Version
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
version: "0"
|
|
102
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
|
-
none: false
|
|
104
|
-
requirements:
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: '0'
|
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
|
+
requirements:
|
|
105
111
|
- - ">="
|
|
106
|
-
- !ruby/object:Gem::Version
|
|
107
|
-
|
|
108
|
-
segments:
|
|
109
|
-
- 0
|
|
110
|
-
version: "0"
|
|
112
|
+
- !ruby/object:Gem::Version
|
|
113
|
+
version: '0'
|
|
111
114
|
requirements: []
|
|
112
|
-
|
|
113
115
|
rubyforge_project: papertrail
|
|
114
|
-
rubygems_version:
|
|
116
|
+
rubygems_version: 2.4.5.1
|
|
115
117
|
signing_key:
|
|
116
118
|
specification_version: 2
|
|
117
119
|
summary: Command-line client for Papertrail hosted log management service.
|
|
118
120
|
test_files: []
|
|
119
|
-
|