log2json 0.1.5

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.
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: log2json
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 5
9
+ version: 0.1.5
10
+ platform: ruby
11
+ authors:
12
+ - Jack Kuan
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-09-13 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: jls-grok
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 10
30
+ - 10
31
+ version: 0.10.10
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: redis
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 3
43
+ - 0
44
+ - 2
45
+ version: 3.0.2
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: persistent_http
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 0
58
+ - 5
59
+ version: 1.0.5
60
+ type: :runtime
61
+ version_requirements: *id003
62
+ description: |+
63
+ Log2json lets you read, filter and send logs as JSON objects via Unix pipes.
64
+ It is inspired by Logstash, and is meant to be compatible with it at the JSON
65
+ event/record level so that it can easily work with Kibana.
66
+
67
+ Reading logs is done via a shell script(eg, `tail`) running in its own process.
68
+ You then configure(see the `syslog2json` or the `nginxlog2json` script for
69
+ examples) and run your filters in Ruby using the `Log2Json` module and its
70
+ contained helper classes.
71
+
72
+ `Log2Json` reads from stdin the logs(one log record per line), parses the log
73
+ lines into JSON records, and then serializes and writes the records to stdout,
74
+ which then can be piped to another process for processing or sending it to
75
+ somewhere else.
76
+
77
+ Currently, Log2json ships with a `tail-log` script that can be run as the input
78
+ process. It's the same as using the Linux `tail` utility with the `-v -F`
79
+ options except that it also tracks the positions(as the numbers of lines read
80
+ from the beginning of the files) in a few files in the file system so that if the
81
+ input process is interrupted, it can continue reading from where it left off
82
+ next time if the files had been followed. This feature is similar to the sincedb
83
+ feature in Logstash's file input.
84
+
85
+ Note: If you don't need the tracking feature(ie, you are fine with always
86
+ tailling from the end of file with `-v -F -n0`), then you can just use the `tail`
87
+ utility that comes with your Linux distribution.(Or more specifically, the
88
+ `tail` from the GNU coreutils). Other versions of the `tail` utility may also
89
+ work, but are not tested. The input protocol expected by Log2json is very
90
+ simple and documented in the source code.
91
+
92
+ ** The `tail-log` script uses a patched version of `tail` from the GNU coreutils
93
+ package. A binary of the `tail` utility compiled for Ubuntu 12.04 LTS is
94
+ included with the Log2json gem. If the binary doesn't work for your
95
+ distribution, then you'll need to get GNU coreutils-8.13, apply the patch(it
96
+ can be found in the src/ directory of the installed gem), and then replace
97
+ the bin/tail binary in the directory of the installed gem with your version
98
+ of the binary. **
99
+
100
+ P.S. If you know of a way to configure and compile ONLY the tail program in
101
+ coreutils, please let me know! The reason I'm not building tail post gem
102
+ installation is that it takes too long to configure && make because that
103
+ actually builds every utilties in coreutils.
104
+
105
+
106
+ For shipping logs to Redis, there's the `lines2redis` script that can be used as
107
+ the output process in the pipe. For shipping logs from Redis to ElasticSearch,
108
+ Log2json provides a `redis2es` script.
109
+
110
+ Finally here's an example of Log2json in action:
111
+
112
+ From a client machine:
113
+
114
+ tail-log /var/log/{sys,mail}log /var/log/{kern,auth}.log | syslog2json |
115
+ queue=jsonlogs \
116
+ flush_size=20 \
117
+ flush_interval=30 \
118
+ lines2redis host.to.redis.server 6379 0 # use redis DB 0
119
+
120
+
121
+ On the Redis server:
122
+
123
+ redis_queue=jsonlogs redis2es host.to.es.server
124
+
125
+
126
+
127
+
128
+
129
+ email: jack.kuan@thescore.com
130
+ executables:
131
+ - tail-log
132
+ - track-tails
133
+ - syslog2json
134
+ - nginxlog2json
135
+ - lines2redis
136
+ - redis2es
137
+ extensions: []
138
+
139
+ extra_rdoc_files: []
140
+
141
+ files:
142
+ - Gemfile
143
+ - Gemfile.lock
144
+ - README
145
+ - bin/lines2redis
146
+ - bin/nginxlog2json
147
+ - bin/redis2es
148
+ - bin/syslog2json
149
+ - bin/tail
150
+ - bin/tail-log
151
+ - bin/tail-log.sh
152
+ - bin/track-tails
153
+ - lib/log2json.rb
154
+ - lib/log2json/filters/base.patterns
155
+ - lib/log2json/filters/nginx_access.rb
156
+ - lib/log2json/filters/syslog.rb
157
+ - lib/log2json/railslogger.rb
158
+ - log2json.gemspec
159
+ - src/coreutils-8.13_tail.patch
160
+ - src/tail.c
161
+ has_rdoc: true
162
+ homepage:
163
+ licenses: []
164
+
165
+ post_install_message:
166
+ rdoc_options: []
167
+
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ segments:
175
+ - 0
176
+ version: "0"
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ segments:
182
+ - 0
183
+ version: "0"
184
+ requirements: []
185
+
186
+ rubyforge_project:
187
+ rubygems_version: 1.3.6
188
+ signing_key:
189
+ specification_version: 3
190
+ summary: Read, filter and ship logs. ie, poor man's roll-your-own, light-weight logstash replacement.
191
+ test_files: []
192
+