papertrail / remote_syslog2

To install, see "Releases" tab. Self-contained daemon for reading local files and emitting remote syslog (without using local syslogd).
http://help.papertrailapp.com/
MIT License
637 stars 157 forks source link

Parse Environment Variables located inside log_files.yml #172

Open johlym opened 8 years ago

johlym commented 8 years ago

Submitting this on behalf of a user. When deploying remote_syslog2 in an automated fashion, it helps to be able to use environment variables to automatically point remote_syslog2 in the right direction toward the log files of the application.

Example


files: 
- <%= ENV['MY_VAR'] %>/path/to/logfile.log 
- <%= ENV['MY_VAR'] %>/path/to/second.log 

destination: 
  host: logs.papertrailapp.com 
  port: 12345 
  protocol: tls

Note: the tags are ERB but we could possibly come up with a standard implementation of this.

snorecone commented 8 years ago

I think this would typically be handled by config management, like chef, puppet, etc., and would be outside the responsibility of remote_syslog2.

That being said, it's possible to pass in a list of log files on the command line as additional arguments, so that env vars would be expanded, like:

remote_syslog -D -d a.example.com -f local0 "${MYVAR}/path/to/logfile.log" "${MYVAR}/path/to/second.log"
johlym commented 8 years ago

That makes sense, though would get a bit unwieldy beyond a handful of log files. 

Johnathan

On Mon, Sep 26, 2016 at 12:46 PM Mark Martin

< mailto:Mark Martin notifications@github.com

wrote:

a, pre, code, a:link, body { word-wrap: break-word !important; }

I think this would typically be handled by config management, like chef, puppet, etc., and would be outside the responsibility of remote_syslog2.

That being said, it's possible to pass in a list of log files on the command line as additional arguments, so that env vars would be expanded, like:

remote_syslog -D -d a.example.com -f local0 "${MYVAR}/path/to/logfile.log" "${MYVAR}/path/to/second.log"

You are receiving this because you authored the thread.

Reply to this email directly, https://github.com/papertrail/remote_syslog2/issues/172#issuecomment-249676746 , or https://github.com/notifications/unsubscribe-auth/AFbD05_A3DzrouSKrSiiARdEvPC47FsFks5quCEwgaJpZM4KG5Sx .

sethherr commented 8 years ago

I took the log_files.yml from this template, which is referenced by Papertrail's Cloud 66 instruction.

While parsing of ENV variables in log_files.yml would be cool, there's an easier solution - if that instruction page explained that you need to replace the variables manually I wouldn't have had a problem.