Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 109 lines (70 sloc) 3.448 kB
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
1 # papertrail Command-line tail & search client for Papertrail log management service
2
c14506d @troy improve readme, including linking to source files
troy authored
3 Small standalone [binary] to retrieve, search, and tail recent app
4 server log and system syslog messages from [Papertrail].
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
5
c14506d @troy improve readme, including linking to source files
troy authored
6 Supports optional Boolean search queries and polling for new events
7 (like "tail -f"). Example:
8
9 papertrail -f "(www OR db) (nginx OR pgsql) -accepted"
10
11 Output is line-buffered so it can be fed into a pipe, like for grep.
12
13 The [SearchClient] class can be used by other apps to perform one-off
14 API searches or follow (tail) events matching a given query. Interface
15 may change.
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
16
17
691f30a @troy extra space
troy authored
18 ## Quick Start
9845bea @troy quickstart in readme
troy authored
19
8eed41d @eric Update dependencies to ensure we are parsing everything correctly.
eric authored
20 $ [sudo] gem install papertrail-cli
21 $ echo "username: your@account.com\npassword: yourpass" > ~/.papertrail.yml
22 $ papertrail
9845bea @troy quickstart in readme
troy authored
23
24
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
25 ## Installation
26
691f30a @troy extra space
troy authored
27 Install the gem (details on [RubyGems]), which includes a binary called
28 "papertrail":
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
29
691f30a @troy extra space
troy authored
30 $ [sudo] gem install papertrail-cli
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
31
32
33 ## Configuration
34
c14506d @troy improve readme, including linking to source files
troy authored
35 Create ~/.papertrail.yml containing your credentials, or specify the
36 path to that file with -c. Example (from
37 examples/papertrail.yml.example):
0cbafac @troy README formatting
troy authored
38
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
39 username: your@account.com
40 password: yourpassword
41
32a630b @troy rename to papertrail-cli
troy authored
42 You may want to alias "trail" to "papertrail", like:
0cbafac @troy README formatting
troy authored
43
32a630b @troy rename to papertrail-cli
troy authored
44 echo "alias trail=papertrail" >> ~/.bashrc
45
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
46
47 ## Usage & Examples
48
32a630b @troy rename to papertrail-cli
troy authored
49 $ papertrail -h
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
50 papertrail - command-line tail and search for Papertrail log management service
51 -h, --help Show usage
52 -f, --follow Continue running and print new events (off)
53 -d, --delay SECONDS Delay between refresh (30)
54 -c, --configfile PATH Path to config (~/.papertrail.yml)
55
56 Usage: papertrail [-f] [-d seconds] [-c /path/to/papertrail.yml] [query]
57
58 Examples:
59 papertrail -f
60 papertrail something
61 papertrail 1.2.3 Failure
62 papertrail -f "(www OR db) (nginx OR pgsql) -accepted"
63 papertrail -f -d 10 "ns1 OR 'connection refused'"
64
65 More: http://papertrailapp.com/
66
67
5a0f4b4 @troy add colorization examples to readme
troy authored
68 ## Colorize
69
bda2d14 @troy link to colortail
troy authored
70 Pipe through [MultiTail] or [colortail]. For example:
0cbafac @troy README formatting
troy authored
71
8eed41d @eric Update dependencies to ensure we are parsing everything correctly.
eric authored
72 $ papertrail | multitail -c -j
5a0f4b4 @troy add colorization examples to readme
troy authored
73
74 For complete control, pipe through anything capable of inserting ANSI
5e19ec7 @troy clarify colorization example
troy authored
75 control characters. Here's an example that colorizes 3 fields separately
76 - the first 15 characters for the date, a word for the hostname, and a
77 word for the program name:
5a0f4b4 @troy add colorization examples to readme
troy authored
78
8eed41d @eric Update dependencies to ensure we are parsing everything correctly.
eric authored
79 $ 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'
5a0f4b4 @troy add colorization examples to readme
troy authored
80
81 the "1;31;43" are bold (1), foreground red (31), background yellow (43),
82 and can be any ANSI [escape characters].
83
84
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
85 ## Contribute
86
87 Bug report:
88
89 1. See whether the issue has already been reported:
1068401 @troy prep for distribution as gem
troy authored
90 http://github.com/papertrail/papertrail-cli/issues/
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
91 2. If you don't find one, create an issue with a repro case.
92
93 Enhancement or fix:
94
95 1. Fork the project:
1068401 @troy prep for distribution as gem
troy authored
96 http://github.com/papertrail/papertrail-cli
255da8b @troy first commit, working CLI client and tiny Faraday wrapper for search …
troy authored
97 2. Make your changes with tests.
98 3. Commit the changes without changing the Rakefile or other files unrelated
99 to your enhancement.
100 4. Send a pull request.
101
c14506d @troy improve readme, including linking to source files
troy authored
102 [binary]: https://github.com/papertrail/papertrail-cli/blob/master/bin/papertrail
32a630b @troy rename to papertrail-cli
troy authored
103 [Papertrail]: http://papertrailapp.com/
c14506d @troy improve readme, including linking to source files
troy authored
104 [SearchClient]: https://github.com/papertrail/papertrail-cli/blob/master/lib/papertrail/search_client.rb
105 [RubyGems]: https://rubygems.org/gems/papertrail-cli
5a0f4b4 @troy add colorization examples to readme
troy authored
106 [MultiTail]: http://www.vanheusden.com/multitail/index.html
bda2d14 @troy link to colortail
troy authored
107 [colortail]: http://www.codaset.com/elubow/colortail
5a0f4b4 @troy add colorization examples to readme
troy authored
108 [escape characters]: http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
Something went wrong with that request. Please try again.