Using ENV VARS (environment variables) in Configuration File?

1,660 views
Skip to first unread message

Matthew Moore

unread,
Apr 9, 2013, 3:20:08 PM4/9/13
to flu...@googlegroups.com
Hey there,

We have a few different apps, environments (production, staging, etc), and would love to be able to pull stuff (credentials, names) from environment variables into the config files.  
This would especially be helpful in the case of using an S3 sink for us.

In searching the documentation and this mailing list, it doesn't seem like anybody has talked about that before.

Has there been and work, thoughts, or examples of using environment variables in the fluentd configuration file?

Matthew Moore

unread,
Apr 9, 2013, 9:01:00 PM4/9/13
to flu...@googlegroups.com
Well, for anybody googling out there, I was able to do something like this by using the -i command on fluentd 

My setup looks something like this:

fluentd -c ./config/fluent.conf -i "<match s3.*.*>\n  type s3\n\n  aws_key_id $AWS_ACCESS_KEY_ID\n  aws_sec_key $AWS_SECRET_ACCESS_KEY\n  s3_bucket my-bucket-$RAILS_ENV\n  path fluentd/\n  buffer_path log/fluent/s3\n\n  time_slice_format %Y%m%d%H%M\n  time_slice_wait 10m\n  utc\n\n  buffer_chunk_limit 256m\n</match>"

Where anything with a $ is an environment variable, and default settings are in config/fluent.conf
Reply all
Reply to author
Forward
0 new messages