Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit 9caba5d

Browse files
author
Jonathan Chauncey
authored
Merge pull request #88 from felipejfc/master
Add the option to disable sending deis logs and metrics to nsq. Closes #36 and #37
2 parents b79709e + 0325f2d commit 9caba5d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ To turn off log collection of fluentd's own logs to avoid infinite loops set the
3434
To turn off the deis output plugin set the following environment variable to a non-empty string value
3535
* DISABLE_DEIS_OUTPUT
3636

37+
### Disable sending log or metrics data to nsq
38+
To turn off sending log or metrics data to nsq set the following environment variable to "false"
39+
* SEND_LOGS_TO_NSQ
40+
* SEND_METRICS_TO_NSQ
41+
3742
This means we will not capture data from the log stream and send it to NSQ for processing. This means you will disable application logs (`deis logs`) and metrics generated from deis router.
3843

3944
## Plugins

rootfs/opt/fluentd/deis-output/lib/fluent/plugin/out_deis.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def initialize
2626
@influx_nsq = nil
2727
@log_topic = ENV['NSQ_LOG_TOPIC'] || "logs"
2828
@metric_topic = ENV['NSQ_METRIC_TOPIC'] || "metrics"
29+
@send_logs_to_nsq = ENV['SEND_LOGS_TO_NSQ'].to_s.downcase == 'false' ? false : true
30+
@send_metrics_to_nsq = ENV['SEND_METRICS_TO_NSQ'].to_s.downcase == 'false' ? false : true
2931
end
3032

3133
def start
@@ -43,7 +45,7 @@ def emit(tag, es, chain)
4345
if from_controller?(record) || deis_deployed_app?(record)
4446
@logger_nsq ||= get_nsq_producer(@log_topic)
4547
record["time"] = Time.now().strftime("%FT%T.%6N%:z")
46-
push(@logger_nsq, record) if @logger_nsq
48+
push(@logger_nsq, record) if @send_logs_to_nsq && @logger_nsq
4749
end
4850

4951
if from_router?(record)
@@ -54,7 +56,7 @@ def emit(tag, es, chain)
5456
line = data.map do |point|
5557
InfluxDB::PointValue.new(point).dump
5658
end.join("\n".freeze)
57-
push(@influx_nsq, line) if @influx_nsq
59+
push(@influx_nsq, line) if @send_metrics_to_nsq && @influx_nsq
5860
end
5961
rescue Exception => e
6062
puts "Error:#{e.backtrace}"

0 commit comments

Comments
 (0)