Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

Commit

Permalink
make dry
Browse files Browse the repository at this point in the history
  • Loading branch information
samjsong committed Jul 16, 2019
1 parent 8dc6add commit e0c3892
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/fluent/plugin/filter_kubernetes_sumologic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,9 @@ def filter(tag, time, record)
log_fields["container"] = kubernetes["container_name"] unless kubernetes["container_name"].nil?
log_fields["namespace"] = kubernetes["namespace_name"] unless kubernetes["namespace_name"].nil?
log_fields["pod"] = kubernetes["pod_name"] unless kubernetes["pod_name"].nil?
log_fields["pod_id"] = kubernetes["pod_id"] unless kubernetes["pod_id"].nil?
log_fields["host"] = kubernetes["host"] unless kubernetes["host"].nil?
log_fields["master_url"] = kubernetes["master_url"] unless kubernetes["master_url"].nil?
log_fields["namespace_id"] = kubernetes["namespace_id"] unless kubernetes["namespace_id"].nil?
log_fields["service"] = kubernetes["service"] unless kubernetes["service"].nil?
log_fields["deployment"] = kubernetes["deployment"] unless kubernetes["deployment"].nil?
log_fields["daemonset"] = kubernetes["daemonset"] unless kubernetes["daemonset"].nil?
log_fields["replicaset"] = kubernetes["replicaset"] unless kubernetes["replicaset"].nil?
log_fields["statefulset"] = kubernetes["statefulset"] unless kubernetes["statefulset"].nil?
["pod_id", "host", "master_url", "namespace_id", "service", "deployment", "daemonset", "replicaset", "statefulset"].each do |key|
log_fields[key] = kubernetes[key] unless kubernetes[key].nil?
end
end
end

Expand Down

0 comments on commit e0c3892

Please sign in to comment.