Giter Club home page Giter Club logo

remote_syslog's Introduction

Deprecated. Use remote_syslog2 instead of this repo

remote_syslog Ruby daemon & sender

remote_syslog has been rewritten in Go as remote_syslog2. As a standalone binary, remote_syslog2 has fewer dependencies. It also depends on less code between the daemon and the OS.

Use remote_syslog2 instead of this repo.

Introduction

Lightweight Ruby daemon to tail one or more log files and transmit UDP syslog messages to a remote syslog host (centralized log aggregation).

remote_syslog generates UDP packets itself instead of depending on a system syslog daemon, so its configuration doesn't affect system-wide logging - syslog is just the transport.

Uses:

  • collecting logs from servers & daemons which don't natively support syslog
  • when reconfiguring the system logger is less convenient than a purpose-built daemon (e.g., automated app deployments)
  • aggregating files not generated by daemons (e.g., package manager logs)

The library can also be used to generate one-off log messages from Ruby code.

Tested with the hosted log management service Papertrail and should work for transmitting to any syslog server.

Installation

Install the gem, which includes a binary called "remote_syslog":

$ [sudo] gem install remote_syslog

Optionally, create a log_files.yml with the log file paths to read and the host/port to log to (see examples/log_files.yml.example). These can also be specified as command-line arguments (below).

Usage

Usage: remote_syslog [OPTION]... <FILE>...

Options:
    -c, --configfile PATH            Path to config (/etc/log_files.yml)
    -d, --dest-host HOSTNAME         Destination syslog hostname or IP (logs.papertrailapp.com)
    -p, --dest-port PORT             Destination syslog port (514)
    -D, --no-detach                  Don't daemonize and detach from the terminal
    -f, --facility FACILITY          Facility (user)
        --hostname HOST              Local hostname to send from
    -P, --pid-dir DIRECTORY          DEPRECATED: Directory to write .pid file in
        --pid-file FILENAME          Location of the PID file (default /var/run/remote_syslog.pid)
        --parse-syslog               Parse file as syslog-formatted file
    -s, --severity SEVERITY          Severity (notice)
        --strip-color                Strip color codes
        --tls                        Connect via TCP with TLS
        --tcp                        Connect via TCP (no TLS)
        --new-file-check-interval INTERVAL
                                     Time between checks for new files

Advanced options:
        --[no-]eventmachine-tail     Enable or disable using eventmachine-tail
        --debug-log FILE             Log internal debug messages
        --debug-level LEVEL          Log internal debug messages at level

Common options:
    -h, --help                       Show this message
        --version                    Show version

Example:
    $ remote_syslog -c configs/logs.yml -p 12345 /var/log/mysqld.log

Example

Typical:

$ remote_syslog

Daemonize and collect messages from files listed in ./config/logs.yml as well as the file /var/log/mysqld.log. Send to port logs.papertrailapp.com:12345:

$ remote_syslog -c configs/logs.yml -p 12345 /var/log/mysqld.log

Stay attached to the terminal, look for and use /etc/log_files.yml if it exists, write PID to /tmp/remote_syslog.pid, and send with facility local0 to a.example.com:514:

$ remote_syslog -D -d a.example.com -f local0 --pid-file /tmp/remote_syslog.pid /var/log/mysqld.log

Windows

Windows is not currently supported, though in certain situations it may work.

Auto-starting at boot

The gem includes sample init files, also available here. You may be able to:

$ cp examples/remote_syslog.init.d /etc/init.d/remote_syslog
$ chmod 755 /etc/init.d/remote_syslog

And then ensure it's started at boot, either by using:

$ sudo update-rc.d remote_syslog defaults

or by creating a link manually:

$ sudo ln -s /etc/init.d/remote_syslog /etc/rc3.d/S30remote_syslog

remote_syslog will daemonize by default.

Init files: remote_syslog.init.d (init.d), OS X launchd, supervisor, Ubuntu upstart

Optional: rvm

Remember that when using a Ruby version manager such as rvm, your interactive shell and init files need the version manager environment loaded. The rvm init.d instructions show how to create a wrapper script for the init files to run. A typical example is:

rvm wrapper ruby-1.9.3-p392 bootup remote_syslog

.. where ruby-1.9.3-p392 is the desired Ruby from rvm list. rvm will output the path to the new wrapper script which it created. Edit the init file to run the new wrapper script instead of running remote_syslog directly.

Sending messages securely

If the receiving system supports sending syslog over TCP with TLS, you can pass the --tls option when running remote_syslog:

$ remote_syslog --tls -p 1234 /var/log/mysqld.log

Important: remote_syslog depends on I/O code provided by the Ruby VM, eventmachine library, and OS. There is at least one environment and failure case where remote_syslog will not reconnect when using the --tls option. Although we've never been able to reproduce this problem, enough Papertrail customers have run into it that we'd suggest looking at alternative solutions. One of those is forwarding data to rsyslog and then using its TLS capabilities to log to Papertrail. For more information on that and other alternatives, please contact [email protected]

Configuration

By default, the gem looks for a configuration in /etc/log_files.yml.

The gem comes with a sample config. Optionally:

$ cp examples/log_files.yml.example /etc/log_files.yml

log_files.yml has filenames to log from (as an array) and hostname and port to log to (as a hash). Wildcards are supported using * and standard shell globbing. Filenames given on the command line are additive to those in the config file.

Only 1 destination server is supported; the command-line argument wins.

files:
 - /var/log/httpd/access_log
 - /var/log/httpd/error_log
 - /var/log/mysqld.log
 - /var/run/mysqld/mysqld-slow.log
destination:
  host: logs.papertrailapp.com
  port: 12345

remote_syslog sends the name of the file without a path ("mysqld.log") as the syslog tag (program name). RFCs 3164 and 5424 limit the tag to 32 characters. Longer filenames are truncated to 32 characters.

After changing the configuration file, restart remote_syslog using the init script or by manually killing and restarting the process. For example:

/etc/init.d/remote_syslog restart

Advanced Configuration (Optional)

Here's an advanced config which uses all options.

Override hostname

Provide --hostname somehostname or use the hostname configuration option:

hostname: somehostname

Verify server certificate

Provide the public key for the remote host when using TLS:

ssl_server_cert: syslog.crt

Use a client certificate

Provide a client certificate when connecting via TLS:

ssl_client_cert_chain: syslog_client.crt
ssl_client_private_key: syslog_client.key

Detecting new files

remote_syslog automatically detects and activates new log files that match its file specifiers. For example, *.log may be provided as a file specifier, and remote_syslog will detect a some.log file created after it was started. Globs are re-checked every 10 seconds. Ruby's Dir.glob is used.

Note: messages may be written to files in the 0-10 seconds between when the file is created and when the periodic glob check detects it. This data is not currently acted on, though the default behavior may change in the future.

Also, explicitly-provided filenames need not exist when remote_syslog is started. remote_syslog can be pre-configured to monitor log files which are created later (or may never be created).

If globs are specified on the command-line, enclose each one in single-quotes ('*.log') so the shell passes the raw glob string to remote_syslog (rather than the current set of matches). This is not necessary for globs defined in the config file.

Log rotation

External log rotation scripts often move or remove an existing log file and replace it with a new one (at a new inode). The Linux standard script logrotate supports a copytruncate config option. With that option, logrotate will copy files, operate on the copies, and truncate the original so that the inode remains the same.

This comes closest to ensuring that programs watching these files (including remote_syslog) will not be affected by, or need to be notified of, the rotation. The only tradeoff of copytruncate is slightly higher disk usage during rotation, so we recommend this option whether or not you use remote_syslog.

Excluding files from being sent

Provide one or more regular expressions to prevent certain files from being matched.

exclude_files:
  - \.\d$
  - .bz2
  - .gz

Multiple instances

Run multiple instances to support more than one message-specific file format or to specify unique syslog hostnames.

To do that, provide an alternate PID path as a command-line option to the additional instance(s). For example:

--pid-file /var/run/remote_syslog_2.pid

Parse fields from log messages

Rarely needed. Usually only used when remote_syslog is watching files generated by syslogd (rather than by apps), like /var/log/messages.

remote_syslog can parse the program and hostname from the log line. When one file contains logs from multiple programs (like with syslog), the log line may include text that is not part of the log message, like a timestamp, hostname, or program name. remote_syslog will extract those and use them in the corresponding syslog packet fields.

To do that, use the config file option parse_fields with the name of a format supported by remote_syslog, or your own regex. Included format names are syslog and rfc3339. For example:

parse_fields: syslog

The included syslog format uses the regex (\w+ \d+ \S+) (\S+) ([^:]+): (.*) to parse standard syslog lines like this:

Jul 18 08:25:08 hostname programname[1234]: The log message

The included rfc3339 format uses the regex (\S+) (\S+) ([^: ]+):? (.*) to parse syslog lines with high-precision RFC 3339 timestamps, like this:

2011-07-16T08:25:08.651413-07:00 hostname programname[1234]: The log message

To parse a format other than those, provide your own regex. It should include 4 backreferences to parse, in order: timestamp, system name, program name, message.

Match and return empty strings for any empty positions where the log line doesn't provide a value. For example, given the log message:

something-meaningless The log message

One could use a regex to ignore "something-meaningless" (and not to extract a program or hostname). To ignore that prefix and return 3 empty values then the log message, use parse_fields with this regex:

parse_fields: "something-meaningless ()()()(.*)"

Per-file regexes are not supported. Run multiple instances with different config files.

Excluding lines matching a pattern

There may be certain log messages that you do not want to be sent. These may repetitive log lines that are "noise" that you might not be able to filter out easily from the respective application. To filter these lines, use the exclude_patterns with an array or regexes:

exclude_patterns:
 - exclude this
 - \d+ things

Prepending a string to log messages

Use prepend to prepend a string to every log message before transmitting. The string is prepended to the log message body, as if it occurred at the start of every log file line. Include a trailing space if desired.

Examples:

prepend: important: 

or:

prepend: cafebabe-1024-4096-badd-1234abcd1234 

Choosing app name

remote_syslog uses the log file name (like "access_log") as the syslog program name, or what the syslog RFCs call the "tag." This is ideal unless remote_syslog watches many files that have the same name.

In that case, tell remote_syslog to set another program name by creating symbolic link to the generically-named file:

cd /path/to/logs
ln -s generic_name.log unique_name.log

Point remote_syslog at unique_name.log. It will use that as the program name.

Troubleshooting

Installation

gem not found

Install a Ruby distribution, which typically takes a minute.

g++ not found

Install gcc and g++ so this system can compile C/C++ source. Installation is typically sudo yum install gcc-c++ (RPM-based distros) or sudo apt-get install build-essential (.deb-based distros).

Getting Encryption not available... or TLS is not supported...

The exact error might appear as:

Encryption not available on this event-machine

or

TLS is not supported by eventmachine installed on this system. The openssl-devel/openssl-dev package must be installed before installing eventmachine.

Install the OpenSSL C++ package for your distribution, then reinstall the eventmachine. For example:

  • .deb distros like Ubuntu: sudo apt-get install libssl-dev
  • RPM distros like Fedora sudo yum install openssl-devel

Then:

gem install eventmachine -f

Getting no such file to load -- mkmf (LoadError)?

Try these:

  • Ubuntu: determine which Ruby version is active with ruby -v.

For 1.8.7: sudo apt-get install build-essential ruby1.8 ruby1.8-dev rubygems. For 1.9.x, including 1.9.1 and 1.9.3: sudo apt-get install build-essential ruby1.9.1-dev. For 2.0: sudo apt-get install build-essential ruby2.0-dev

  • Fedora: sudo yum install ruby-devel.

  • Getting errors about missing header files, like ssl.cpp? Try:

    • CentOS: sudo yum install libstdc++-devel ruby-devel

Getting Package ruby1.8 is not available...

The exact error might appear as:

Package ruby1.8 is not available, but is referred to by another package.` and/or `Package rubygems is not available, but is referred to by another package.` on Ubuntu 14.04

Ubuntu 14.04 changed the name of the ruby 1.8.7 packages. Try this instead:

sudo apt-get install build-essential ruby-full ruby

Freezes at the compilation stage

This can happen when the system is low on memory. The installation process starts up the compiler, but it gets killed as soon it consumes too much memory. Tailing /var/log/syslog or /var/log/messages will confirm whether or not this is occurring.

The solution is to temporarily stop any memory intensive tasks, install remote_syslog, and then restart them.

Operations

Reconnect failures

remote_syslog depends on I/O code provided by the Ruby VM, eventmachine library, and OS. There is at least one environment and failure case where remote_syslog will not reconnect when using the --tls option. Although we've never been able to reproduce this problem (and known occurrences are correspondingly rare), the dependency and problem are worth noting.

remote_syslog not found?

It may not be in your path. Run find / -name remote_syslog to locate it, then run it with the full path (such as /var/lib/gems/1.8/bin/remote_syslog).

The system rebooted and remote_syslog didn't start

Install an init file.

Logs not appearing?

Two commands are particularly useful for observing remote_syslog behavior. First, its own debugging:

remote_syslog --debug-level DEBUG --debug-log remote_syslog.log

This will write internal operations to the file remote_syslog.log.

Second, strace or ktrace shows the interaction between remote_syslog and the OS. To run strace against an existing remote_syslog instance (process ID 12345):

 strace -fp 12345 -s 500

Feel free to ask questions or report bugs.

Reporting bugs

  1. See whether the issue has already been reported: https://github.com/papertrail/remote_syslog/issues/
  2. If you don't find one, create an issue with a repro case.

Contributing

Once you've made your great commits:

  1. Fork remote_syslog
  2. Create a topic branch - git checkout -b my_branch
  3. Commit the changes without changing the Rakefile or other files unrelated to your enhancement.
  4. Push to your branch - git push origin my_branch
  5. Create a Pull Request or an Issue with a link to your branch
  6. That's it!

remote_syslog's People

Contributors

adamn avatar beaugunderson avatar darragh avatar drewblas avatar drubin avatar eric avatar ixmatus avatar jlgeering avatar jwilder avatar richo avatar richsage avatar troy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

remote_syslog's Issues

Fail before daemonizing when TLS is enabled but Ruby OpenSSL is not installed

Right now TLS is only needed after daemonizing, which means that if libopenssl Ruby support is not installed, it will silently fail only when used with TLS. This fixes it in Ubuntu:

sudo apt-get install libssl-dev libopenssl-ruby

remote_syslog should try to detect and react to this before daemonizing if TLS is enabled, since at that point it's guaranteed to fail. Thanks to @torbjokv for helping find this.

Grand Unification Proposal

Howdy!

I found this project through someone posting on the logstash-users mailing list.

We should figure out some kind of grand unification for your project and my project (syslog-shipper). There's so much in common it's quite silly maintaining both separately, I'd say!

Thoughts?

Specific log entry causes remote_syslog 1.3.1 to crash

Hello,

It seems the following request causes remote_syslog 1.3.1 to crash hard every time:

Started GET "/transit?utf8=%E2%9C%93&decorator_id=4c25091aff30612085000036&supplier_id=16&deliver_by=2011-08-16&commit=Submit" for 0.0.0.0 at 2011-08-12 21:29:41 -0400 
  Processing by TransitController#index as HTML
  Parameters: {"utf8"=>"โœ“", "decorator_id"=>"4c25091aff30612085000036", "supplier_id"=>"16", "deliver_by"=>"2011-08-16", "commit"=>"Submit"}
Rendered transit/index.haml within layouts/application (1007.5ms)
Completed 200 OK in 1818ms (Views: 1011.4ms)

Things to note:

  • The only thing I sanitized above was the IP (0.0.0.0).
  • I'm using the --tls option.
  • Ruby 1.9.2-p180

Thanks,
Chris

Specify Different Facility Per Logfile

I have three log files listed in my yaml config file. I would like to be able to specify each to have it's own facility, e.g. local3, local4, local5.

Right now the only way I can think this would work would be running 3 separate remote_syslog processes, each with it's own set facility and log file.

Anyone keen to rewrite this in Golang?

Would be a much neater dependency graph to install it on a remote node.

Go just requires you to distribute a single binary executable.

Avoids ruby/python/whatever dependency hell.

cant start remote_syslog as root on ubuntu 11.10

Hi

I'm having an issue starting up remote_syslog on an ubuntu 11.10 server. I can start it successfully with any normal user from the command line, but when i try to do this with the root user, the remote_syslog process seems to start up but after checking it with ps -ef | grep remote_syslog the process doesnt show up. It dies after starting.
What i have noticed is that if i run it as root locally from a graphical console, it works fine.
The version of remote_syslog is 1.6.0

Thanks

tls option forces UDP

     if @tls
       connection = TlsEndpoint.new(@dest_host, @dest_port)
     else
       connection = UdpEndpoint.new(@dest_host, @dest_port)
     end

is there a technical reason for this?

segfault / unhandled eventmachine exception

# Logfile created on Thu Aug 23 16:04:04 -0400 2012 by logger.rb/1.2.6
E, [2012-08-24T07:44:39.691520 #16845] ERROR -- : Exception: Errno::ENOENT: No such file or directory - /mnt/apps/storm/logs/worker-6701.log
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:356:in `stat'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:356:in `read_file_metadata'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:332:in `handle_eof'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:302:in `schedule_eof'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `call'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `each'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
    /usr/lib64/ruby/gems/1.8/gems/remote_syslog-1.6.6.1/lib/remote_syslog/agent.rb:83:in `run'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:223:in `run'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:220:in `loop'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:220:in `run'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:210:in `start'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:210:in `initialize'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:210:in `new'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:210:in `start'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:59:in `start'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/server.rb:194:in `startup'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/daemon.rb:347:in `run_startup_command'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/daemon.rb:258:in `startup'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/piper.rb:207:in `call'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/piper.rb:207:in `child'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/daemon.rb:258:in `startup'
    /usr/lib64/ruby/gems/1.8/gems/remote_syslog-1.6.6.1/lib/remote_syslog/cli.rb:240:in `run'
    /usr/lib64/ruby/gems/1.8/gems/remote_syslog-1.6.6.1/lib/remote_syslog/cli.rb:29:in `process!'
    /usr/lib64/ruby/gems/1.8/gems/remote_syslog-1.6.6.1/bin/remote_syslog:6
    /usr/bin/remote_syslog:19:in `load'
    /usr/bin/remote_syslog:19
E, [2012-08-24T07:44:39.691746 #16845] ERROR -- : Unhandled EventMachine Exception: NoMethodError: undefined method `ino' for nil:NilClass:
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:395:in `handle_fstat'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:333:in `handle_eof'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:370:in `read_file_metadata'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:332:in `handle_eof'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:302:in `schedule_eof'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `call'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `each'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
    /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
    /usr/lib64/ruby/gems/1.8/gems/remote_syslog-1.6.6.1/lib/remote_syslog/agent.rb:83:in `run'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:223:in `run'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:220:in `loop'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:220:in `run'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:210:in `start'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:210:in `initialize'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:210:in `new'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:210:in `start'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/threaded.rb:59:in `start'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/server.rb:194:in `startup'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/daemon.rb:347:in `run_startup_command'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/daemon.rb:258:in `startup'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/piper.rb:207:in `call'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/piper.rb:207:in `child'
    /usr/lib64/ruby/gems/1.8/gems/servolux-0.10.0/lib/servolux/daemon.rb:258:in `startup'
    /usr/lib64/ruby/gems/1.8/gems/remote_syslog-1.6.6.1/lib/remote_syslog/cli.rb:240:in `run'
    /usr/lib64/ruby/gems/1.8/gems/remote_syslog-1.6.6.1/lib/remote_syslog/cli.rb:29:in `process!'
    /usr/lib64/ruby/gems/1.8/gems/remote_syslog-1.6.6.1/bin/remote_syslog:6
    /usr/bin/remote_syslog:19:in `load'
    /usr/bin/remote_syslog:19
/usr/lib64/ruby/gems/1.8/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:335: [BUG] Segmentation fault
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

/usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256: [BUG] Segmentation fault
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

Memory leak?

Running on several boxes, all have similar memory usage reported by top.

Is this expected?

Openssl segfaults

remote_syslog segfaults, openssl is installed with rvm and I am running ruby 1.9.2-p320
Openssl is installed and I have apps using SSL functionality.

I am running debian 6.0.5

any ideas?

/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/i686-linux/openssl.so: [BUG] Segmentation fault
ruby 1.9.2p320 (2012-04-20 revision 35421) [i686-linux]

-- control frame ----------
c:0036 p:-40232738 s:0130 b:0130 l:000129 d:000129 TOP
c:0035 p:---- s:0128 b:0128 l:000127 d:000127 CFUNC :require
c:0034 p:0036 s:0124 b:0124 l:000123 d:000123 METHOD /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36
c:0033 p:0011 s:0117 b:0117 l:000116 d:000116 TOP /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/openssl.rb:17
c:0032 p:---- s:0115 b:0115 l:000114 d:000114 FINISH
c:0031 p:---- s:0113 b:0113 l:000112 d:000112 CFUNC :require
c:0030 p:0036 s:0109 b:0109 l:000108 d:000108 METHOD /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36
c:0029 p:0013 s:0102 b:0102 l:000101 d:000101 TOP /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/securerandom.rb:37
c:0028 p:---- s:0100 b:0100 l:000099 d:000099 FINISH
c:0027 p:---- s:0098 b:0098 l:000097 d:000097 CFUNC :require
c:0026 p:0036 s:0094 b:0094 l:000093 d:000093 METHOD /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36
c:0025 p:0061 s:0087 b:0087 l:000086 d:000086 TOP /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/resolv.rb:7
c:0024 p:---- s:0085 b:0085 l:000084 d:000084 FINISH
c:0023 p:---- s:0083 b:0083 l:000082 d:000082 CFUNC :require
c:0022 p:0036 s:0079 b:0079 l:000078 d:000078 METHOD /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36
c:0021 p:0384 s:0072 b:0072 l:000071 d:000071 TOP /usr/local/rvm/gems/ruby-1.9.2-p320/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb:39
c:0020 p:---- s:0070 b:0070 l:000069 d:000069 FINISH
c:0019 p:---- s:0068 b:0068 l:000067 d:000067 CFUNC :require
c:0018 p:0157 s:0064 b:0064 l:000063 d:000063 METHOD /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55
c:0017 p:0023 s:0057 b:0057 l:000056 d:000056 TOP /usr/local/rvm/gems/ruby-1.9.2-p320/gems/remote_syslog-1.6.5/lib/remote_syslog/reader.rb:2
c:0016 p:---- s:0054 b:0054 l:000053 d:000053 FINISH
c:0015 p:---- s:0052 b:0052 l:000051 d:000051 CFUNC :require
c:0014 p:0157 s:0048 b:0048 l:000047 d:000047 METHOD /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55
c:0013 p:0021 s:0041 b:0041 l:000040 d:000040 TOP /usr/local/rvm/gems/ruby-1.9.2-p320/gems/remote_syslog-1.6.5/lib/remote_syslog.rb:5
c:0012 p:---- s:0039 b:0039 l:000038 d:000038 FINISH
c:0011 p:---- s:0037 b:0037 l:000036 d:000036 CFUNC :require
c:0010 p:0157 s:0033 b:0033 l:000032 d:000032 METHOD /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55
c:0009 p:0011 s:0026 b:0026 l:000025 d:000025 TOP /usr/local/rvm/gems/ruby-1.9.2-p320/gems/remote_syslog-1.6.5/bin/remote_syslog:3
c:0008 p:---- s:0024 b:0024 l:000023 d:000023 FINISH
c:0007 p:---- s:0022 b:0022 l:000021 d:000021 CFUNC :load
c:0006 p:0127 s:0018 b:0018 l:000e64 d:0010c8 EVAL /usr/local/rvm/gems/ruby-1.9.2-p320/bin/remote_syslog:19
c:0005 p:---- s:0015 b:0015 l:000014 d:000014 FINISH
c:0004 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC :eval
c:0003 p:0101 s:0007 b:0007 l:000e64 d:000788 EVAL /usr/local/rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH

c:0001 p:0000 s:0002 b:0002 l:000e64 d:000e64 TOP

-- Ruby level backtrace information ----------------------------------------
/usr/local/rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:in <main>' /usr/local/rvm/gems/ruby-1.9.2-p320/bin/ruby_noexec_wrapper:14:ineval'
/usr/local/rvm/gems/ruby-1.9.2-p320/bin/remote_syslog:19:in <main>' /usr/local/rvm/gems/ruby-1.9.2-p320/bin/remote_syslog:19:inload'
/usr/local/rvm/gems/ruby-1.9.2-p320/gems/remote_syslog-1.6.5/bin/remote_syslog:3:in <top (required)>' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:inrequire'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in require' /usr/local/rvm/gems/ruby-1.9.2-p320/gems/remote_syslog-1.6.5/lib/remote_syslog.rb:5:in<top (required)>'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in require' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:inrequire'
/usr/local/rvm/gems/ruby-1.9.2-p320/gems/remote_syslog-1.6.5/lib/remote_syslog/reader.rb:2:in <top (required)>' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:inrequire'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in require' /usr/local/rvm/gems/ruby-1.9.2-p320/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb:39:in<top (required)>'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/resolv.rb:7:in <top (required)>' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/securerandom.rb:37:in<top (required)>'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/openssl.rb:17:in <top (required)>' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

-- C level backtrace information -------------------------------------------
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(rb_vm_bugreport+0x76) [0xb76c47d6]
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x58861) [0xb758e861]
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(rb_bug+0x33) [0xb758f5c3]
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/libruby.so.1.9(+0x119013) [0xb764f013]
[0xb776c40c]
/lib/i386-linux-gnu/libc.so.6(strcmp+0x10) [0xb73ddf30]
/usr/local/rvm/usr/lib/libcrypto.so.0.9.8(+0x422d2) [0xb6ff12d2]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Aborted

max_message_size = 1024 for UDP - why?

Hi,

We use remote_syslog in UDP mode and see incomplete messages on the receiving end. The messages get chopped at 1024 characters.

Looking at:
https://github.com/papertrail/remote_syslog/blob/master/lib/remote_syslog/agent.rb#L112 I see a max_message_size at 1024 is enforced for UDP.

Why is this?

Our Apache accesslogging contains cookies and useragents, so we need to be able to transfer long lines. My guesstimation: ~ 8kb long.

I know about the TCP mode in remote_syslog, but I prefer the fire-and-forget feature of UDP.

Any help is much appreciated.

Regards,
Renzo

Support on windows

Is this a good place to ask questions? I apologize if not, but I couldn't find any other channel.

The README file states that there is support for Windows deployments, however after installing the gem and trying to run on Windows I get:

ERROR -- : Unhandled EventMachine Exception: EventMachine::Unsupported: no file watching support on this system

TIA

remote_syslog 1.6.14 keeps deleted logfiles open

We noticed that remote_syslog is keeping logfiles open that have been deleted.
An example lsof:
ruby 4894 root 10r REG 253,2 151396 65567 /path/to/catalina.out (deleted)
ruby 4894 root 11r DIR 0,10 0 649 inotify
ruby 4894 root 12r REG 253,2 151396 65567 /path/to/catalina.out (deleted)
ruby 4894 root 13r REG 253,2 13646 65556 /path/to/catalina.out (deleted)
ruby 4894 root 14r REG 253,7 29238 507906 /path/to/catalina.out

Is there a way, besides restarting the service, to prevent this or get rid of them?

Log all error events by default

This is particularly useful when remote_syslog is run as a daemon. You could do /etc/init.d/remote_syslog start, and then immediately check for errors using something like: tail /var/log/remote_syslog.log. These errors should also be transmitted to the remote syslog server.

It wouldn't catch everything, but it's better than nothing. One particular issue is where a glob has been used, and the user that remote_syslog runs as has no access to any of the files in that directory.

remote syslog isn't picking up log messages after a newline in them

My log file has errors that look like:

[ 7:35:58.807470188] [FATAL]
Moped::Errors::QueryFailure (The operation: #<Moped::Protocol::Query
  @length=106
  @request_id=145
...

but on Papertrail, only the [FATAL] comes through. The same happens for error messages with newlines, it seems to not send the content after the newline.

Provide a way to override program names per file

If you have multiple files in different directories with the same name, there is no way to differentiate between them right now.

There should be a way to specify what program name is used for each file.

Compression option

Hey there,

How feasible would it be to have a configurable compression feature for remote_syslog, in order to reduce the amount of bandwidth consumed, at the cost of slightly higher CPU usage?

I was reading that rsyslogd does support compressed messages, so wanted to see if this was something you had considered at all?

Thanks!

Can't start remote syslog

This looks like the same issue from #6. However I'm on 1.3.0 so I don't understand what the problem is.

our log file names are ie org.bookshare.service.task.AudioConverterTask08_03_2011.log

root@ip-10-114-58-13:~# /var/lib/gems/1.8/bin/remote_syslog -D -p 514 /var/log/scheduler/audio/*
/var/lib/gems/1.8/gems/syslog_protocol-0.9.0/lib/syslog_protocol/packet.rb:44:in tag=': Tag must not be longer than 32 characters (ArgumentError) from /var/lib/gems/1.8/gems/remote_syslog-1.3.0/lib/remote_syslog/reader.rb:31:ininitialize'
from /var/lib/gems/1.8/gems/eventmachine-tail-0.6.1/lib/em/filetail.rb:444:in new' from /var/lib/gems/1.8/gems/eventmachine-tail-0.6.1/lib/em/filetail.rb:444:infile_tail'
from /var/lib/gems/1.8/gems/remote_syslog-1.3.0/lib/remote_syslog/cli.rb:164:in start' from /var/lib/gems/1.8/gems/remote_syslog-1.3.0/lib/remote_syslog/cli.rb:162:ineach'
from /var/lib/gems/1.8/gems/remote_syslog-1.3.0/lib/remote_syslog/cli.rb:162:in start' from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:incall'
from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in run_machine' from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:inrun'
from /var/lib/gems/1.8/gems/remote_syslog-1.3.0/lib/remote_syslog/cli.rb:155:in start' from /var/lib/gems/1.8/gems/remote_syslog-1.3.0/lib/remote_syslog/cli.rb:146:inrun'
from /var/lib/gems/1.8/gems/remote_syslog-1.3.0/lib/remote_syslog/cli.rb:17:in process!' from /var/lib/gems/1.8/gems/remote_syslog-1.3.0/bin/remote_syslog:6 from /var/lib/gems/1.8/bin/remote_syslog:19:inload'
from /var/lib/gems/1.8/bin/remote_syslog:19

Replace eventmachine-tail dependency

We've ran into many issues where eventmachine-tail leaves file descriptors open when it shouldn't, doesn't sense when files are rotated, and issues with systems that don't have epoll or kqueue.

It would be nice to move to a simpler mechanism that more closely mapped to how /usr/bin/tail works.

Constant 3-5% CPU usage per process

Is this kind of CPU usage expected?

screen

I find it quite high.

I have several instances running, because I have several applications and I want their log separated by host in PaperTrail. The configuration is very basic.

For example, here is the command line of a process:

/usr/bin/ruby1.9.1 /usr/local/bin/remote_syslog -D --pid-file /var/run/remote_syslog_demo1.pid -c /etc/logs/demo1.yml

and here is the YML config file:

files: 
  - /home/web/demo1/data/logs/error.log
  - /home/web/demo1/data/logs/worker.log

hostname: prod.demo1

destination:
  host: logs.papertrailapp.com
  port: XXXX

As you can see, the logs here are empty (on other apps, logs are very small for now):

$ ll /home/web/demo1/data/logs/
-rwxrwxrwx 1 root root 0 Oct 24 17:37 error.log
-rwxrwxrwx 1 root root 0 Oct 24 17:37 worker.log

The server is Ubuntu 13.04, 4 cores (hosted at digital ocean).

remote_syslog 1.6.14 crashes on: attempted to remove invalid watch signature

(Looks like http://help.papertrailapp.com/discussions/problems/1750-remote_syslog-terminating - but nothing here on GH.)

Running remote_syslog with ruby 1.8.7 (2012-06-29 patchlevel 370) [x86_64-linux] on RHEL6.

Daemon crashes with this debug logging:

# Logfile created on Mon Aug 12 09:39:49 +0200 2013 by logger.rb/1.2.6
D, [2013-08-12T09:39:49.722363 #5760] DEBUG -- : About to fork ...
D, [2013-08-12T09:39:49.724257 #5762] DEBUG -- : Server "remote_syslog" creating pid file "/var/run/remote_syslog_apache_access.pid"
D, [2013-08-12T09:39:49.724465 #5762] DEBUG -- : Starting
D, [2013-08-12T09:39:49.724947 #5760] DEBUG -- : Waiting for "remote_syslog" to startup.
D, [2013-08-12T09:39:49.727405 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.727568 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.727715 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.727887 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.728071 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.728234 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.728396 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.728541 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.728685 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.728809 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.728935 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.729100 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.741770 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.741942 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.742103 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.742246 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.742400 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.742546 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.742678 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.742796 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.742913 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.743062 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.743181 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.743304 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.743471 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.743604 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.743739 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.743857 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.744012 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.744142 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.744261 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.744404 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.744563 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T09:39:49.744682 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
I, [2013-08-12T09:39:50.025176 #5760]  INFO -- : Server has daemonized.
D, [2013-08-12T10:48:22.754135 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T11:07:53.560893 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-12T13:55:30.222148 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:05.574444 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:05.574773 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:05.574959 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:05.575198 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:45.608892 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:55.618261 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:55.618513 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:55.618911 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:00:55.619114 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:01:05.626917 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:01:15.639680 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:01:15.640017 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:01:25.646126 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:01:25.646538 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:01:45.658514 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:02:25.678513 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:02:35.682057 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:02:45.685721 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:02:45.685953 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:04:25.734267 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:04:25.734709 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:11:06.055067 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
D, [2013-08-13T00:13:26.150143 #5762] DEBUG -- : Watching /var/log/httpd/SOME_VHOST/access.log with EventMachineReader
terminate called after throwing an instance of 'std::runtime_error'
  what():  attempted to remove invalid watch signature

Config file:

files:
  - /var/log/httpd/*/access.log
destination:
  host: LOGSTASH_HOST
  port: 5002

Gem list:

*** LOCAL GEMS ***
em-resolv-replace (1.1.3)
eventmachine (0.12.10)
eventmachine-tail (0.6.4)
file-tail (1.0.12)
json (1.5.5)
remote_syslog (1.6.14)
servolux (0.10.0)
stomp (1.2.2)
syslog_protocol (0.9.2)
tins (0.8.3)

If you need more info, please let me know.
We're running remote_syslog on 100+ machines and notice frequent crashes, which is causing us to loose data to logstash.

Rails Logfile, newlines are converted to <13>

HI,

First, great tool!

I got a little issue sending over a log file form a Rails App. The rails app has a normal \n character, but on the receiving end (netcat) i see <13> (as a string of 4 chars). Which make the log on the receiving end one long line.

example:

<13>Jan 16 14:52:31 RUBY-ON-RAILS development.log: <13>Jan 16 14:52:31 RUBY-ON-RAILS development.log: <13>

invalid date format in remote_syslog-1.6.2.gemspec

I just installed the 1.6.2 remote_syslog gem, and am getting this error when I try to run it:

Invalid gemspec in [/var/lib/gems/1.8/specifications/remote_syslog-1.6.2.gemspec]: invalid date format in specification: "2012-04-05 00:00:00.000000000Z"
/usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:926:in report_activate_error': Could not find RubyGem remote_syslog (>= 0) (Gem::LoadError) from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:244:inactivate_dep'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:236:in activate' from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1307:ingem'
from /usr/local/bin/remote_syslog:18

The line in the gemspec is:
s.date = %q{2012-04-05 00:00:00.000000000Z}

PID file is not created when passing "no detach" option (-D)

I wanted to check with you before working on a pull request to fix this, to make sure there's not something I'm missing here.

It seems the only way to make remote_syslog work with upstart is to pass the "no detach" option. I'm having problems with the init script and I can't reproduce them reliably so I'm switching to upstart. I would like to keep using monit to send alerts when remote_syslog goes down (it's been unreliable), so I need a PID file to be present.

When not running in normal mode Servolux::Server#startup creates the PID file as expected. However it's not created by RemoteSyslog::Agent#run in "no detach" mode. Is this by design?

Thanks in advance.

Allow extra options in /etc/init.d/remote_syslog

Remove the quotes around EXTRAOPTIONS so that multiple parameters aren't treated as one. Change:
$prog -c $config --pid-file $pid_file "$EXTRAOPTIONS"

To

$prog -c $config --pid-file $pid_file $EXTRAOPTIONS

Can't start remote_syslog

I receive this error on startup. I'm can't find where tag is being defined. remote_syslog was installed on Ubuntu 11.04 using gem install remote_syslog

Thanks.

Traceback below.

/usr/lib/ruby/gems/1.8/gems/syslog_protocol-0.9.0/lib/syslog_protocol/packet.rb:44:in `tag=': Tag must not be longer than 32 characters (ArgumentError)
    from /usr/lib/ruby/gems/1.8/gems/remote_syslog-1.1.0/lib/remote_syslog/reader.rb:32:in `initialize'
    from /usr/lib/ruby/gems/1.8/gems/eventmachine-tail-0.6.1/lib/em/filetail.rb:444:in `new'
    from /usr/lib/ruby/gems/1.8/gems/eventmachine-tail-0.6.1/lib/em/filetail.rb:444:in `file_tail'
    from /usr/lib/ruby/gems/1.8/gems/remote_syslog-1.1.0/bin/remote_syslog:103:in `remote_syslog_daemon'
    from /usr/lib/ruby/gems/1.8/gems/remote_syslog-1.1.0/bin/remote_syslog:101:in `each'
    from /usr/lib/ruby/gems/1.8/gems/remote_syslog-1.1.0/bin/remote_syslog:101:in `remote_syslog_daemon'
    from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
    from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
    from /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
    from /usr/lib/ruby/gems/1.8/gems/remote_syslog-1.1.0/bin/remote_syslog:98:in `remote_syslog_daemon'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons/application.rb:249:in `call'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons/application.rb:249:in `start_proc'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons/application.rb:260:in `call'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons/application.rb:260:in `start_proc'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons/application.rb:293:in `start'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons/controller.rb:73:in `run'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons.rb:195:in `run_proc'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons/cmdline.rb:109:in `call'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons/cmdline.rb:109:in `catch_exceptions'
    from /usr/lib/ruby/gems/1.8/gems/daemons-1.1.3/lib/daemons.rb:194:in `run_proc'
    from /usr/lib/ruby/gems/1.8/gems/remote_syslog-1.1.0/bin/remote_syslog:97:in `remote_syslog_daemon'
    from /usr/lib/ruby/gems/1.8/gems/remote_syslog-1.1.0/bin/remote_syslog:117
    from /usr/bin/remote_syslog:19:in `load'
    from /usr/bin/remote_syslog:19

init script gives error on start

trying to start remote_syslogs using the init script from the examples:
(https://github.com/papertrail/remote_syslog/blob/master/examples%2Fremote_syslog.init.d)

keep getting this error.

root@mycomp:~# service remote_syslog start
Starting remote_syslog: /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find servolux (>= 0) amongst [remote_syslog-1.6.14] (Gem::LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/specification.rb:777:in `block in activate_dependencies'
        from /usr/lib/ruby/1.9.1/rubygems/specification.rb:766:in `each'
        from /usr/lib/ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
        from /usr/lib/ruby/1.9.1/rubygems/specification.rb:750:in `activate'
        from /usr/lib/ruby/1.9.1/rubygems.rb:1232:in `gem'
        from /usr/local/bin/remote_syslog:22:in `<main>'

If i just run directly from the command line, it works fine:

root@mycomp:~# remote_syslog
Watching 1 files/globs. Sending to logs.papertrailapp.com:12345 (UDP).

Can't seem to use relative path to ssl_server_cert

remote_syslog: #<Errno::ENOENT: No such file or directory @ rb_sysopen - ssl/papertrail.crt

I have the papertrail certificate in my application's code and I'm attempting to access it by giving the relative path to the file. I can't give an absolute path, since my deploy directory depends on the environment, application, etc. Anyway, hardcoding paths sucks. I think it has something to do with this comment regarding Daemonize setting the path to /
https://github.com/papertrail/remote_syslog/blob/master/lib/remote_syslog/cli.rb#L171

wrapped log lines don't respect hostname setting

We're seeing an issue where long log lines (above 8k characters or so) get wrapped. Unfortunately, the wrapped portion of the line isn't sent to papertrail with the hostname setting. So, for a particular server with a hostname set in log_files.yml, the first 8k characters of the log line will be sent to the names system, while the remaining characters will be sent to a system names after the IP of the server (or whatever the default hostname is).

remote_syslog 1.6.14 keeps old logfiles open

Consider the following directory stucture:
/path/to/logs/myapp
/path/to/logs/myapp-2013-09-10
/path/to/logs/myapp-2013-09-09

If we watch /path/to/logs/myapp/*.log and the directory is moved to /path/to/logs/myapp-2013-09-11 and a new directory is created called /path/to/logs/myapp remote_syslog will keep the files in /path/to/logs/myapp-2013-09-11 open and start watching the logs in the newly created /path/to/logs/myapp

Eventually the process will run out of available files and stop working.

How can we get around this problem, besides restarting the service daily?

Recent commits to servolux break this gem

I know it's deprecated, however a recent change to the gem's dependency has broken this gem like so:

lib/ruby/gems/1.9.1/gems/remote_syslog-1.6.14/lib/remote_syslog/cli.rb:185:in `basename': can't convert Servolux::PidFile into String (TypeError)

A solution we found was to install servolux version 0.10.0 before installing remote_syslog gem, as there's no pinning of dependency at all in this gem.

Ability to exclude files

I planned to work on this feature and issue a pull request if you guys were interested.

My plan was to add a command line option as well as configuration file support to take a list of blobs, similar to the includes. The files that match the exclude blobs would be removed from the include list (thus being processed after the includes)

How does this sound? Any thoughts before I get started?

is there a way to filter out some strings?

for example if my log says: http://url/path?a=1&api_key=somethinghere&b=1 replace it with http://url/path?a=1&api_key=so*************&b=1 before sending it to the remote log server.

RemoteSyslogLogger

SO basically I am getting the following error but ONLY on my ActionCable server, not on my actual rails web server, Im not quite sure whats going on but it seems somewhat similar to Issue #6 ??
ArgumentError: Tag may not contain spaces
tag= at /usr/local/bundle/gems/syslog_protocol-0.9.2/lib/syslog_protocol/packet.rb:52
initialize at /usr/local/bundle/gems/remote_syslog_logger-1.0.3/lib/remote_syslog_logger/udp_sender.rb:20
new at /usr/local/bundle/gems/remote_syslog_logger-1.0.3/lib/remote_syslog_logger.rb:9

The 'exclude_patterns' in config sample is implicit and lack of instruction

The usage of exclude_patterns in the config yaml is confusing. A clear example or instruction should be provided to users.

Quote from master/examples/log_files.yml.example.advanced

exclude_patterns:
  - exclude this
  - \d+ things

This sample/instruction is kidding on the format.

It seems the exclude_patterns does not support either the plain path or the Regex pattern, as I tested.
The following config failed to exclude the log from the file at /LOG/FOLDER/tmp-stderr.log.

files:
  - /LOG/FOLDER/*.log
destination:
  host: #########
  port: #########
  protocol: tls
exclude_patterns:
  - .*tmp.+\.log$
  - /LOG/FOLDER/tmp-stderr.log

Please let me know the mistake I might have made in the test.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.