papertrail 0.9.14 → 0.9.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ec5dc941ee73d3ac3e4d09ceb251ce98f6636ff
4
- data.tar.gz: a2608baf753fd3c8a53cde255be5a85aace18de7
3
+ metadata.gz: 96a2c3cc43ed9c786f12b7ae3eed670023acc879
4
+ data.tar.gz: 06802ee6a3b010b9d6cf236c16491b6537c5b194
5
5
  SHA512:
6
- metadata.gz: 1f0ce6f6e3a6d38025129ba4204c88ecf5cc394fdae9d51360b4e28f5557d9c2690c4a72167058950db8712e93fee2f9954be167d59c0ab7609022781c9ad077
7
- data.tar.gz: 9582577a546c365bbc50eaf397d99db3bef26726022ef08f099da462f0f9d64050f0f8a3ab6a24843a8660ca1b7cf053a8adcd4be017bd86e013e25d171b84f9
6
+ metadata.gz: ef5944bcc5c41bc1a76dec37c6d308e3afe86027d23fe499b9a0d0b63ec58d79d4c38ae6c4edf2c2c731f57fae17bb365ac95db641d8f1fc37cdd326a8c3dd85
7
+ data.tar.gz: bb6ebf3bfb8b46ce596a45f16cce0f23700b41663b30e739fecafd4923cd6fc35801861d4c14bcb231eabd34a936a3810523fc7039fd9909e2c6ecd92672123d
data/README.md CHANGED
@@ -59,40 +59,42 @@ You may want to alias "pt" to "papertrail", like:
59
59
 
60
60
  echo "alias pt=papertrail" >> ~/.bashrc
61
61
 
62
-
63
62
  ## Usage & Examples
64
63
 
65
- $ papertrail -h
64
+ $ papertrail --help
66
65
  papertrail - command-line tail and search for Papertrail log management service
67
66
  -h, --help Show usage
68
- -f, --follow Continue running and print new events (off)
67
+ -f, --follow Continue running and printing new events (off)
68
+ --min-time MIN Earliest time to search from
69
+ --max-time MAX Latest time to search from
69
70
  -d, --delay SECONDS Delay between refresh (2)
70
71
  -c, --configfile PATH Path to config (~/.papertrail.yml)
71
- -s, --system SYSTEM System to search
72
72
  -g, --group GROUP Group to search
73
73
  -S, --search SEARCH Saved search to search
74
- -j, --json Output raw json data
75
- --min-time MIN Earliest time to search from.
76
- --max-time MAX Latest time to search from.
77
-
78
-
79
- Usage:
80
- papertrail [-f] [-s system] [-g group] [-d seconds] [-c papertrail.yml] [-j] [--min-time mintime] [--max-time maxtime] [query]
81
-
82
- Examples:
83
- papertrail -f
84
- papertrail something
85
- papertrail --min-time "20 minutes ago" 1.2.3 Failure
86
- papertrail -s ns1 "connection refused"
87
- papertrail -f "(www OR db) (nginx OR pgsql) -accepted"
88
- papertrail -f -g Production "(nginx OR pgsql) -accepted"
89
- papertrail -S "Critical errors"
90
- papertrail -g Production --min-time 'yesterday at noon' --max-time 'today at 4am'
91
-
92
- Includes 4 binaries to change Papertrail settings: papertrail-add-system, papertrail-remove-system,
93
- papertrail-add-group, papertrail-leave-group. Run with --help or see README.
94
-
95
- More: http://papertrailapp.com/
74
+ -s, --system SYSTEM System to search
75
+ -j, --json Output raw JSON data (off)
76
+ --color [program|system|all|off]
77
+ Attribute(s) to colorize based on (program)
78
+ --force-color Force use of ANSI color characters even on non-tty outputs (off)
79
+ -V, --version Display the version and exit
80
+
81
+ Usage:
82
+ papertrail [-f] [--min-time time] [--max-time time] [-g group] [-S search]
83
+ [-s system] [-d seconds] [-c papertrail.yml] [-j] [--color attributes]
84
+ [--force-color] [--] [query]
85
+
86
+ Examples:
87
+ papertrail -f
88
+ papertrail something
89
+ papertrail 1.2.3 Failure
90
+ papertrail -s ns1 "connection refused"
91
+ papertrail -f "(www OR db) (nginx OR pgsql) -accepted"
92
+ papertrail -f -g Production --color all "(nginx OR pgsql) -accepted"
93
+ papertrail --min-time 'yesterday at noon' --max-time 'today at 4am' -g Production
94
+ papertrail -- -redis
95
+
96
+ More: https://github.com/papertrail/papertrail-cli
97
+ https://papertrailapp.com/
96
98
 
97
99
 
98
100
  ### Count, pivot, and summarize
@@ -125,34 +127,37 @@ For sum, mean, and statistics, see
125
127
  ANSI color codes are retained, so log messages which are already colorized
126
128
  will automatically render in color on ANSI-capable terminals.
127
129
 
128
- To colorize monochrome logs, pipe through [lnav]. Install `lnav` from your
130
+ By default, the CLI will colorize the non-body portion of each log message
131
+ based on the value of the program attribute. 5 colors are available, so colors
132
+ may not be unique. When the sending system name is more important than the
133
+ program, use `--color=system` to colorize based on its value. Use `--color=all`
134
+ to colorize based on both together.
135
+
136
+ For content-based colorization, pipe through [lnav]. Install `lnav` from your
129
137
  preferred package repository, such as `brew install lnav` or
130
138
  `apt-get install lnav`, then:
131
139
 
132
140
  $ papertrail -f | lnav
133
141
  $ papertrail --min-time "1 hour ago" error | lnav
134
142
 
135
- ### Shorthand
143
+ ### Redirecting output
136
144
 
137
- If you're using bash, create a function that accepts arguments, then
138
- invoke `pt` with optional search operators:
145
+ Since output is line-buffered, pipes and output redirection will automatically
146
+ work:
139
147
 
140
- $ function pt() { papertrail -f -d 5 $* | lnav; }
141
- $ pt 1.2.3 Failure
142
-
143
- Add the function line to your `~/.bashrc`.
148
+ $ papertrail | less
149
+ $ papertrail --min-time '2016-01-15 10:00:00' > logs.txt
144
150
 
145
- ### Advanced
151
+ If you frequently pipe output to a certain command, create a function which
152
+ accepts optional arguments, invokes `papertrail` with any arguments, and pipes
153
+ output to that command. For example, this `pt` function will pipe to `lnav`:
146
154
 
147
- For complete control, pipe through anything capable of inserting ANSI
148
- control characters. Here's an example that colorizes 3 fields separately
149
- (the first 15 characters for the date, a word for the hostname, and a
150
- word for the program name):
155
+ $ function pt() { papertrail -f -d 5 $* | lnav; }
151
156
 
152
- $ papertrail | perl -pe 's/^(.{15})(.)([\S]+)(.)([\S]+)/\e[1;31;43m\1\e[0m\2\e[1;31;43m\3\e[0m\4\e[1;31;43m\5\e[0m/g'
157
+ Add the `function` line to your `~/.bashrc`. It can be invoked with search
158
+ parameters:
153
159
 
154
- the `1;31;43` are bold (1), foreground red (31), background yellow (43),
155
- and can be any ANSI [escape characters].
160
+ $ pt 1.2.3 Failure
156
161
 
157
162
  ### UTF-8 (non-English searches)
158
163
 
@@ -213,6 +218,20 @@ even though one is for 4 words (AND) while the other is for a phrase:
213
218
  papertrail -f Connection reset by peer
214
219
  papertrail -f '"Connection reset by peer"'
215
220
 
221
+ ### Multiple API tokens
222
+
223
+ To use multiple API tokens (such as for separate home and work Papertrail
224
+ accounts), create a `.papertrail.yml` configuration file in each project's
225
+ working directory and invoke the CLI in that directory. The CLI checks for
226
+ `.papertrail.yml` in the current working directory prior to using
227
+ `~/.papertrail.yml`.
228
+
229
+ Alternatively, use shell aliases with different `-c` paths. For example:
230
+
231
+ echo "alias pt1='papertrail -c /path/to/papertrail-home.yml'" >> ~/.bashrc
232
+ echo "alias pt2='papertrail -c /path/to/papertrail-work.yml'" >> ~/.bashrc
233
+
234
+
216
235
  ## Add/Remove Systems, Create Group, Join Group
217
236
 
218
237
  In addition to tail and search with the `papertrail` binary, the gem includes
@@ -1,5 +1,5 @@
1
1
  module Papertrail
2
- VERSION = "0.9.14"
2
+ VERSION = "0.9.15"
3
3
  end
4
4
 
5
5
  require 'papertrail/connection'
@@ -3,6 +3,7 @@ require 'yaml'
3
3
  require 'chronic'
4
4
  require 'ansi/core'
5
5
 
6
+ require 'papertrail'
6
7
  require 'papertrail/connection'
7
8
  require 'papertrail/cli_helpers'
8
9
  require 'papertrail/okjson'
@@ -34,7 +35,8 @@ module Papertrail
34
35
  end
35
36
 
36
37
  OptionParser.new do |opts|
37
- opts.banner = "papertrail - command-line tail and search for Papertrail log management service"
38
+ opts.banner = "papertrail - command-line tail and search for Papertrail log management service"
39
+ opts.version = Papertrail::VERSION
38
40
 
39
41
  opts.on("-h", "--help", "Show usage") do |v|
40
42
  puts opts
@@ -67,14 +69,18 @@ module Papertrail
67
69
  opts.on("-j", "--json", "Output raw JSON data (off)") do |v|
68
70
  options[:json] = true
69
71
  end
70
- opts.on("--color [program|system|all|off] (program)",
72
+ opts.on("--color [program|system|all|off]",
71
73
  [:program, :system, :all, :off],
72
- "Attribute(s) to colorize based on") do |v|
74
+ "Attribute(s) to colorize based on (program)") do |v|
73
75
  options[:color] = v
74
76
  end
75
77
  opts.on("--force-color", "Force use of ANSI color characters even on non-tty outputs (off)") do |v|
76
78
  options[:force_color] = true
77
79
  end
80
+ opts.on("-V", "--version", "Display the version and exit") do |v|
81
+ puts "papertrail version #{Papertrail::VERSION}"
82
+ exit
83
+ end
78
84
 
79
85
  opts.separator usage
80
86
  end.parse!
@@ -194,7 +200,7 @@ module Papertrail
194
200
  Usage:
195
201
  papertrail [-f] [--min-time time] [--max-time time] [-g group] [-S search]
196
202
  [-s system] [-d seconds] [-c papertrail.yml] [-j] [--color attributes]
197
- [--force-color] [query]
203
+ [--force-color] [--version] [--] [query]
198
204
 
199
205
  Examples:
200
206
  papertrail -f
@@ -204,6 +210,7 @@ module Papertrail
204
210
  papertrail -f "(www OR db) (nginx OR pgsql) -accepted"
205
211
  papertrail -f -g Production --color all "(nginx OR pgsql) -accepted"
206
212
  papertrail --min-time 'yesterday at noon' --max-time 'today at 4am' -g Production
213
+ papertrail -- -redis
207
214
 
208
215
  More: https://github.com/papertrail/papertrail-cli
209
216
  https://papertrailapp.com/
@@ -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.14'
17
- s.date = '2015-12-14'
16
+ s.version = '0.9.15'
17
+ s.date = '2016-01-26'
18
18
  s.rubyforge_project = 'papertrail'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papertrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Papertrail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2016-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic
@@ -118,3 +118,4 @@ signing_key:
118
118
  specification_version: 2
119
119
  summary: Command-line client for Papertrail hosted log management service.
120
120
  test_files: []
121
+ has_rdoc: