Skip to content

Instantly share code, notes, and snippets.

@rjcrystal
Created September 22, 2019 17:12
Show Gist options
  • Save rjcrystal/305f81bed6361a9e3acc3788e34b6f04 to your computer and use it in GitHub Desktop.
Save rjcrystal/305f81bed6361a9e3acc3788e34b6f04 to your computer and use it in GitHub Desktop.
<match fluent.**>
@type null
</match>
<source>
@type tail
enable_stat_watcher false
label recipe_import_logs
path /var/log/containers/recipe-import*
pos_file /var/log/fluentd-containers.log.pos
tag kubernetes.*
read_from_head true
<parse>
@type none
</parse>
</source>
<label @recipe_import_logs>
<filter **>
@type kubernetes_metadata
@id filter_kube_metadata_cwagent
</filter>
<filter **>
@type record_transformer
@id filter_cwagent_stream_transformer
<record>
stream_name ${tag_parts[3]}
</record>
</filter>
<filter **>
@type concat
key log
multiline_start_regexp /^\d{1,2}[\/]\d{1,2}[\/]\d{4}\s\d{1,2}[\:]\d{1,2}[\:]\d{1,2}/
separator ""
flush_interval 10
timeout_label @NORMAL
</filter>
<match **>
@type cloudwatch_logs
log_group_name "#{ENV['LOG_GROUP_NAME']}"
auto_create_stream true
use_tag_as_stream true
</match>
</label>
<source>
@type tail
enable_stat_watcher false
format kubernetes
multiline_flush_interval 5s
path /var/log/cluster-autoscaler.log
pos_file /var/log/fluentd-cluster-autoscaler.log.pos
tag cluster-autoscaler
</source>
<filter kubernetes.**>
@type kubernetes_metadata
</filter>
<match **>
@type cloudwatch_logs
log_group_name "#{ENV['LOG_GROUP_NAME']}"
auto_create_stream true
use_tag_as_stream true
</match>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment