remote_syslog 1.4.1 → 1.4.2

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/README.md CHANGED
@@ -27,8 +27,8 @@ Install the gem, which includes a binary called "remote_syslog":
27
27
  $ [sudo] gem install remote_syslog
28
28
 
29
29
  Optionally, create a log_files.yml with the log file paths to read and the
30
- host/port to log to (see examples/log_files.yml.example). These can also be
31
- specified as arguments to the remote_syslog daemon. More below.
30
+ host/port to log to (see examples/[log_files.yml.example][sample config]). These can also be
31
+ specified as command-line arguments (below).
32
32
 
33
33
 
34
34
  ## Usage
@@ -38,7 +38,7 @@ specified as arguments to the remote_syslog daemon. More below.
38
38
 
39
39
  Example: remote_syslog -c configs/logs.yml -p 12345 /var/log/mysqld.log
40
40
 
41
- Options:
41
+ Options (default):
42
42
  -c, --configfile PATH Path to config (/etc/log_files.yml)
43
43
  -d, --dest-host HOSTNAME Destination syslog hostname or IP (logs.papertrailapp.com)
44
44
  -p, --dest-port PORT Destination syslog port (514)
@@ -56,18 +56,23 @@ specified as arguments to the remote_syslog daemon. More below.
56
56
 
57
57
  ## Example
58
58
 
59
- Daemonize, collecting from files mentioned in `./config/logs.yml` as well as
60
- `/var/log/mysqld.log`:
59
+ Typical:
60
+
61
+ $ remote_syslog
62
+
63
+ Daemonize and collect messages from files listed in `./config/logs.yml` as
64
+ well as the file `/var/log/mysqld.log`. Send to port `logs.papertrailapp.com:12345`:
61
65
 
62
66
  $ remote_syslog -c configs/logs.yml -p 12345 /var/log/mysqld.log
63
67
 
64
68
  Stay attached to the terminal, look for and use `/etc/log_files.yml` if it
65
- exists, write PID to `/tmp/remote_syslog.pid`, and send with facility local0:
69
+ exists, write PID to `/tmp/remote_syslog.pid`, and send with facility local0
70
+ to `a.server.com:514`:
66
71
 
67
- $ remote_syslog -d a.server.com -f local0 -P /tmp /var/log/mysqld.log
72
+ $ remote_syslog -D -d a.server.com -f local0 -P /tmp /var/log/mysqld.log
68
73
 
69
74
  remote_syslog will daemonize by default. A sample init file is in the gem as
70
- remote_syslog.init.d. You may be able to:
75
+ [remote_syslog.init.d]. You may be able to:
71
76
 
72
77
  $ cp examples/remote_syslog.init.d /etc/init.d/remote_syslog
73
78
 
@@ -78,12 +83,11 @@ pass the `--tls` option when running `remote_syslog`:
78
83
 
79
84
  $ remote_syslog --tls -p 1234 /var/log/mysqld.log
80
85
 
81
-
82
86
  ## Configuration
83
87
 
84
88
  By default, the gem looks for a configuration in /etc/log_files.yml.
85
89
 
86
- The gem comes with a sample config. Optionally:
90
+ The gem comes with a [sample config]. Optionally:
87
91
 
88
92
  $ cp examples/log_files.yml.example /etc/log_files.yml
89
93
 
@@ -99,55 +103,75 @@ Only 1 destination server is supported; the command-line argument wins.
99
103
  host: logs.papertrailapp.com
100
104
  port: 12345
101
105
 
106
+ remote_syslog sends the name of the file without a path ("mysqld.log") as
107
+ the syslog tag (program name). RFCs 3164 and 5424 limit the tag to 32
108
+ characters. Longer filenames are truncated to 32 characters.
109
+
110
+ ## Advanced Configuration (Optional)
111
+
112
+ Here's an [advanced config] which uses all options.
113
+
114
+ ### Override hostname
115
+
116
+ Provide `--hostname somehostname` or use the `hostname` configuration option:
117
+
118
+ hostname: somehostname
119
+
120
+ ### Multiple instances
121
+
122
+ Run multiple instances to support more than one message-specific file format
123
+ or to specify unique syslog hostnames.
124
+
125
+ To do that, provide an alternate PID filename as a command-line option
126
+ to the additional instance(s). For example:
102
127
 
103
- ### Optional: Parse fields from messages written by syslogd
128
+ --pid-file remote_syslog_2.pid
129
+
130
+ ### Parse fields from log messages
104
131
 
105
- This is not needed for most configurations.
132
+ Rarely needed. Usually only used when remote_syslog is watching files
133
+ generated by syslogd (rather than by apps), like ``/var/log/messages``.
106
134
 
107
- In cases where logs from multiple programs are in the same file (for example,
108
- ``/var/log/messages``), the log line may include text that is not part of the
109
- log message, like a timestamp, hostname, or program name. remote_syslog can
110
- parse the program, hostname, and/or message text so that the message has
111
- accurate metadata.
135
+ remote_syslog can parse the program and hostname from the log line. When one
136
+ file contains logs from multiple programs (like with syslog), the log line
137
+ may include text that is not part of the log message, like a timestamp,
138
+ hostname, or program name. remote_syslog will extract those and use them in
139
+ the corresponding syslog packet fields.
112
140
 
113
- To do that, add an optional top-level configuration option `parse_fields`
114
- with the name of a predefined regex (by remote_syslog) or a regex string. To
115
- use the predefined regex for standard syslog messages, provide:
141
+ To do that, use the config file option `parse_fields` with the name of a
142
+ format supported by remote_syslog, or your own regex. Included format names
143
+ are `syslog` and `rfc3339`. For example:
116
144
 
117
145
  parse_fields: syslog
118
146
 
119
- The `syslog` regex is `(\w+ \d+ \S+) (\S+) ([^:]+): (.*)`. It parses this:
147
+ The included `syslog` format uses the regex `(\w+ \d+ \S+) (\S+) ([^:]+): (.*)`
148
+ to parse standard syslog lines like this:
120
149
 
121
150
  Jul 18 08:25:08 hostname programname[1234]: The log message
122
151
 
123
- Or provide `parse_fields: rfc3339` to parse high-precision RFC 3339
124
- timestamps like:
125
- 2011-07-16T08:25:08.651413-07:00 hostname programname[1234]: The log message
126
-
127
- Or provide your own regex that includes these 4 backreferences, in order:
128
- timestamp, system name, program name, message. Match and return empty
129
- strings for any empty positions where the log value should be ignored.
130
- For example, in the log:
152
+ The included `rfc3339` format uses the regex `(\S+) (\S+) ([^: ]+):? (.*)` to
153
+ parse syslog lines with high-precision RFC 3339 timestamps, like this:
131
154
 
132
- something-meaningless The log message
155
+ 2011-07-16T08:25:08.651413-07:00 hostname programname[1234]: The log message
133
156
 
134
- You could ignore the first word, returning 3 empty values then the log
135
- message with:
157
+ To parse a format other than those, provide your own regex. It should include
158
+ 4 backreferences to parse, in order: timestamp, system name, program name,
159
+ message.
136
160
 
137
- parse_fields: "something-meaningless ()()()(.*)"
161
+ Match and return empty strings for any empty positions where the log line
162
+ doesn't provide a value. For example, given the log message:
138
163
 
139
- Per-file parsing is not supported. Run multiple instances.
164
+ something-meaningless The log message
140
165
 
166
+ One could use a regex to ignore "something-meaningless" (and not to extract
167
+ a program or hostname). To ignore that prefix and return 3 empty values
168
+ then the log message, use parse_fields with this regex:
141
169
 
142
- ### Optional: Run multiple instances
170
+ parse_fields: "something-meaningless ()()()(.*)"
143
171
 
144
- Run multiple instances to support more than one message-specific file format
145
- (concurrently) or to specify distinct syslog hostnames. To do so, provide
146
- an alternative PID filename as a command-line option to additional
147
- instance(s), such as:
172
+ Per-file regexes are not supported. Run multiple instances with different
173
+ config files.
148
174
 
149
- --pid-file remote_syslog_2.pid
150
-
151
175
 
152
176
  ## Reporting bugs
153
177
 
@@ -166,6 +190,9 @@ Once you've made your great commits:
166
190
  5. Create a Pull Request or an [Issue][is] with a link to your branch
167
191
  6. That's it!
168
192
 
193
+ [sample config]: https://github.com/papertrail/remote_syslog/blob/master/examples/log_files.yml.example
194
+ [remote_syslog.init.d]: https://github.com/papertrail/remote_syslog/blob/master/examples/remote_syslog.init.d
195
+ [advanced config]: https://github.com/papertrail/remote_syslog/blob/master/examples/log_files.yml.example.advanced
169
196
  [fk]: http://help.github.com/forking/
170
197
  [is]: https://github.com/papertrail/remote_syslog/issues/
171
198
  [Papertrail]: http://papertrailapp.com/
@@ -0,0 +1,7 @@
1
+ # see README - demonstrates all optional arguments
2
+ files: [/var/log/httpd/access_log, /opt/misc/*]
3
+ hostname: www42 # override OS hostname
4
+ parse_fields: syslog # predefined regex name or double-quoted regex
5
+ destination:
6
+ host: logs.papertrailapp.com
7
+ port: 12345 # optional, defaults to 514
data/lib/remote_syslog.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module RemoteSyslog
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  end
4
4
 
5
5
  require 'remote_syslog/reader'
@@ -49,7 +49,7 @@ module RemoteSyslog
49
49
  opts.separator ''
50
50
  opts.separator "Example: remote_syslog -c configs/logs.yml -p 12345 /var/log/mysqld.log"
51
51
  opts.separator ''
52
- opts.separator "Options:"
52
+ opts.separator "Options (default):"
53
53
 
54
54
  opts.on("-c", "--configfile PATH", "Path to config (/etc/log_files.yml)") do |v|
55
55
  @configfile = File.expand_path(v)
@@ -152,6 +152,7 @@ module RemoteSyslog
152
152
  end
153
153
 
154
154
  def start
155
+ puts "Watching #{@files.length} files/paths. Sending to #{@dest_host}:#{@dest_port} (#{@tls ? 'TCP/TLS' : 'UDP'})."
155
156
  EventMachine.run do
156
157
  if @tls
157
158
  connection = TlsEndpoint.new(@dest_host, @dest_port)
@@ -53,7 +53,7 @@ module RemoteSyslog
53
53
  if @parse_fields
54
54
  if message =~ @parse_fields
55
55
  packet.hostname = $2 if $2 && $2 != ''
56
- packet.tag = $3 if $3 && $2 != ''
56
+ packet.tag = $3 if $3 && $3 != ''
57
57
  packet.content = $4 if $4 && $4 != ''
58
58
  end
59
59
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  ## If your rubyforge_project name is different, then edit it and comment out
9
9
  ## the sub! line in the Rakefile
10
10
  s.name = 'remote_syslog'
11
- s.version = '1.4.1'
12
- s.date = '2011-09-12'
11
+ s.version = '1.4.2'
12
+ s.date = '2011-12-07'
13
13
  s.rubyforge_project = 'remote_syslog'
14
14
 
15
15
  ## Make sure your summary is short. The description may be as long
@@ -61,7 +61,7 @@ Gem::Specification.new do |s|
61
61
  Rakefile
62
62
  bin/remote_syslog
63
63
  examples/log_files.yml.example
64
- examples/log_files.yml.example.syslog
64
+ examples/log_files.yml.example.advanced
65
65
  examples/remote_syslog.init.d
66
66
  examples/remote_syslog.supervisor.conf
67
67
  lib/remote_syslog.rb
metadata CHANGED
@@ -1,106 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: remote_syslog
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 4
8
- - 1
9
- version: 1.4.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Troy Davis
13
9
  - Eric Lindvall
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2011-09-12 00:00:00 -07:00
19
- default_executable: remote_syslog
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
13
+ date: 2011-12-07 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: daemons
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
17
+ requirement: &70345349040060 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
31
23
  type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: eventmachine
35
24
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- requirements:
25
+ version_requirements: *70345349040060
26
+ - !ruby/object:Gem::Dependency
27
+ name: eventmachine
28
+ requirement: &70345349039500 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
38
31
  - - ~>
39
- - !ruby/object:Gem::Version
40
- segments:
41
- - 0
42
- - 12
43
- - 10
32
+ - !ruby/object:Gem::Version
44
33
  version: 0.12.10
45
34
  type: :runtime
46
- version_requirements: *id002
47
- - !ruby/object:Gem::Dependency
48
- name: eventmachine-tail
49
35
  prerelease: false
50
- requirement: &id003 !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
- version: "0"
36
+ version_requirements: *70345349039500
37
+ - !ruby/object:Gem::Dependency
38
+ name: eventmachine-tail
39
+ requirement: &70345349055440 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
57
45
  type: :runtime
58
- version_requirements: *id003
59
- - !ruby/object:Gem::Dependency
60
- name: syslog_protocol
61
46
  prerelease: false
62
- requirement: &id004 !ruby/object:Gem::Requirement
63
- requirements:
47
+ version_requirements: *70345349055440
48
+ - !ruby/object:Gem::Dependency
49
+ name: syslog_protocol
50
+ requirement: &70345349054880 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
64
53
  - - ~>
65
- - !ruby/object:Gem::Version
66
- segments:
67
- - 0
68
- - 9
69
- - 1
54
+ - !ruby/object:Gem::Version
70
55
  version: 0.9.1
71
56
  type: :runtime
72
- version_requirements: *id004
73
- - !ruby/object:Gem::Dependency
74
- name: em-resolv-replace
75
57
  prerelease: false
76
- requirement: &id005 !ruby/object:Gem::Requirement
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
- version: "0"
58
+ version_requirements: *70345349054880
59
+ - !ruby/object:Gem::Dependency
60
+ name: em-resolv-replace
61
+ requirement: &70345349054460 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
83
67
  type: :runtime
84
- version_requirements: *id005
85
- description: Lightweight daemon to tail one or more log files and transmit UDP syslog messages to a remote syslog host (centralized log aggregation). Generates UDP packets itself instead of depending on a system syslog daemon, so it doesn't affect system-wide logging configuration.
86
- email:
68
+ prerelease: false
69
+ version_requirements: *70345349054460
70
+ description: Lightweight daemon to tail one or more log files and transmit UDP syslog
71
+ messages to a remote syslog host (centralized log aggregation). Generates UDP packets
72
+ itself instead of depending on a system syslog daemon, so it doesn't affect system-wide
73
+ logging configuration.
74
+ email:
87
75
  - troy@sevenscale.com
88
76
  - eric@sevenscale.com
89
- executables:
77
+ executables:
90
78
  - remote_syslog
91
79
  extensions: []
92
-
93
- extra_rdoc_files:
80
+ extra_rdoc_files:
94
81
  - README.md
95
82
  - LICENSE
96
- files:
83
+ files:
97
84
  - Gemfile
98
85
  - LICENSE
99
86
  - README.md
100
87
  - Rakefile
101
88
  - bin/remote_syslog
102
89
  - examples/log_files.yml.example
103
- - examples/log_files.yml.example.syslog
90
+ - examples/log_files.yml.example.advanced
104
91
  - examples/remote_syslog.init.d
105
92
  - examples/remote_syslog.supervisor.conf
106
93
  - lib/remote_syslog.rb
@@ -109,35 +96,30 @@ files:
109
96
  - lib/remote_syslog/tls_endpoint.rb
110
97
  - lib/remote_syslog/udp_endpoint.rb
111
98
  - remote_syslog.gemspec
112
- has_rdoc: true
113
99
  homepage: http://github.com/papertrail/remote_syslog
114
100
  licenses: []
115
-
116
101
  post_install_message:
117
- rdoc_options:
102
+ rdoc_options:
118
103
  - --charset=UTF-8
119
- require_paths:
104
+ require_paths:
120
105
  - lib
121
- required_ruby_version: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- segments:
126
- - 0
127
- version: "0"
128
- required_rubygems_version: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- segments:
133
- - 0
134
- version: "0"
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
135
118
  requirements: []
136
-
137
119
  rubyforge_project: remote_syslog
138
- rubygems_version: 1.3.6
120
+ rubygems_version: 1.8.7
139
121
  signing_key:
140
122
  specification_version: 2
141
- summary: Monitor plain text log file(s) for new entries and send to remote syslog collector
123
+ summary: Monitor plain text log file(s) for new entries and send to remote syslog
124
+ collector
142
125
  test_files: []
143
-
@@ -1,5 +0,0 @@
1
- files: [/var/log/messages]
2
- parse_fields: syslog # predefined regex name or double-quoted regex
3
- destination:
4
- host: logs.papertrailapp.com
5
- port: 12345 # optional, defaults to 514