代码拉取完成,页面将自动刷新
package generator
var MatchTemplate = `
{{define "match"}}
<match {{ .ContainerLogSourceTag}}.** {{ .CustomLogSourceTag}}.** {{ if .IncludeRke }}{{ .RkeLogTag }}.**{{end}}>
@type copy
{{- template "store-target" . -}}
{{- template "store-prometheus" . -}}
</match>
{{end}}
{{define "store-target"}}
<store>
{{- template "elasticsearch" . -}}
{{- template "splunk" . -}}
{{- template "kafka" . -}}
{{- template "syslog" . -}}
{{- template "fluentforwarder" . -}}
{{- template "custom" . -}}
{{- template "buffer" . -}}
</store>
{{end}}
{{define "store-prometheus"}}
<store>
@type prometheus
<metric>
name fluentd_output_status_num_records_total
type counter
desc The total number of outgoing records
<labels>
tag ${tag}
hostname ${hostname}
</labels>
</metric>
</store>
{{end}}
{{define "elasticsearch"}}
{{ if eq .CurrentTarget "elasticsearch" }}
@type elasticsearch
include_tag_key true
{{- if and .ElasticsearchConfig.AuthUserName .ElasticsearchConfig.AuthPassword}}
user {{.ElasticsearchConfig.AuthUserName}}
password {{.ElasticsearchConfig.AuthPassword}}
{{- end }}
hosts {{.ElasticsearchConfig.Endpoint}}
logstash_prefix "{{.ElasticsearchConfig.IndexPrefix}}"
logstash_format true
logstash_dateformat {{.ElasticsearchTemplateWrap.DateFormat}}
type_name "container_log"
{{- if eq .ElasticsearchTemplateWrap.Scheme "https"}}
ssl_verify {{.ElasticsearchConfig.SSLVerify}}
ssl_version {{ .ElasticsearchConfig.SSLVersion }}
{{- if .ElasticsearchConfig.Certificate }}
ca_file {{.CertFilePrefix}}_ca.pem
{{end}}
{{- if and .ElasticsearchConfig.ClientCert .ElasticsearchConfig.ClientKey}}
client_cert {{.CertFilePrefix}}_client-cert.pem
client_key {{.CertFilePrefix}}_client-key.pem
{{end}}
{{- if .ElasticsearchConfig.ClientKeyPass}}
client_key_pass {{.ElasticsearchConfig.ClientKeyPass}}
{{end}}
{{end}}
{{end}}
{{end}}
{{define "splunk"}}
{{- if eq .CurrentTarget "splunk"}}
@type splunk_hec
host {{.SplunkTemplateWrap.Host}}
port {{.SplunkTemplateWrap.Port}}
token {{.SplunkConfig.Token}}
{{- if .SplunkConfig.Source}}
sourcetype {{.SplunkConfig.Source}}
{{end}}
{{- if .SplunkConfig.Index}}
default_index {{ .SplunkConfig.Index }}
{{end}}
{{- if eq .SplunkTemplateWrap.Scheme "https"}}
use_ssl true
ssl_verify {{.SplunkConfig.SSLVerify}}
{{- if .SplunkConfig.Certificate }}
ca_file {{.CertFilePrefix}}_ca.pem
{{end}}
{{- if and .SplunkConfig.ClientCert .SplunkConfig.ClientKey}}
client_cert {{.CertFilePrefix}}_client-cert.pem
client_key {{.CertFilePrefix}}_client-key.pem
{{end}}
{{- if .SplunkConfig.ClientKeyPass}}
client_key_pass {{ .SplunkConfig.ClientKeyPass }}
{{end}}
{{end}}
{{end}}
{{end}}
{{define "kafka"}}
{{- if eq .CurrentTarget "kafka"}}
@type kafka_buffered
{{- if .KafkaConfig.ZookeeperEndpoint }}
zookeeper {{.KafkaTemplateWrap.Zookeeper}}
{{else}}
brokers {{.KafkaTemplateWrap.Brokers}}
{{end}}
default_topic {{.KafkaConfig.Topic}}
output_data_type "json"
output_include_tag true
output_include_time true
max_send_retries 3
{{- if .KafkaConfig.Certificate }}
ssl_ca_cert {{.CertFilePrefix}}_ca.pem
{{end}}
{{- if and .KafkaConfig.ClientCert .KafkaConfig.ClientKey}}
ssl_client_cert {{.CertFilePrefix}}_client-cert.pem
ssl_client_cert_key {{.CertFilePrefix}}_client-key.pem
{{end}}
{{- if and .KafkaConfig.SaslUsername .KafkaConfig.SaslPassword}}
username {{.KafkaConfig.SaslUsername}}
password {{.KafkaConfig.SaslPassword}}
{{end}}
{{- if and (eq .KafkaConfig.SaslType "scram") .KafkaConfig.SaslScramMechanism}}
scram_mechanism {{.KafkaConfig.SaslScramMechanism}}
{{- if eq .KafkaTemplateWrap.IsSSL false}}
sasl_over_ssl false
{{end}}
{{end}}
{{end}}
{{end}}
{{define "syslog"}}
{{- if eq .CurrentTarget "syslog"}}
@type remote_syslog
host {{.SyslogTemplateWrap.Host}}
port {{.SyslogTemplateWrap.Port}}
severity {{.SyslogTemplateWrap.WrapSeverity}}
protocol {{.SyslogConfig.Protocol}}
packet_size 65535
{{- if .SyslogConfig.Program }}
program {{.SyslogConfig.Program}}
{{end}}
{{- if eq .SyslogConfig.SSLVerify true}}
verify_mode 1
{{else }}
verify_mode 0
{{end}}
{{- if .SyslogConfig.EnableTLS }}
tls true
{{- if .SyslogConfig.Certificate }}
ca_file {{.CertFilePrefix}}_ca.pem
{{end}}
{{end}}
{{- if and .SyslogConfig.ClientCert .SyslogConfig.ClientKey}}
client_cert {{.CertFilePrefix}}_client-cert.pem
client_cert_key {{.CertFilePrefix}}_client-key.pem
{{end}}
{{end}}
{{end}}
{{define "fluentforwarder"}}
{{- if eq .CurrentTarget "fluentforwarder"}}
@type forward
{{- if .FluentForwarderConfig.EnableTLS }}
transport tls
tls_allow_self_signed_cert true
tls_verify_hostname true
{{end}}
{{- if .FluentForwarderConfig.Certificate }}
tls_cert_path {{.CertFilePrefix}}_ca.pem
{{end}}
{{- if .FluentForwarderConfig.Compress }}
compress gzip
{{end}}
{{- if .FluentForwarderTemplateWrap.EnableShareKey }}
<security>
self_hostname "#{Socket.gethostname}"
shared_key true
</security>
{{end}}
{{- range $k, $val := .FluentForwarderTemplateWrap.FluentServers }}
<server>
{{if $val.Hostname}}
name {{$val.Hostname}}
{{end}}
host {{$val.Host}}
port {{$val.Port}}
{{ if $val.SharedKey}}
shared_key {{$val.SharedKey}}
{{end}}
{{ if $val.Username}}
username {{$val.Username}}
{{end}}
{{ if $val.Password}}
password {{$val.Password}}
{{end}}
weight {{$val.Weight}}
{{if $val.Standby}}
standby
{{end}}
</server>
{{end}}
{{end}}
{{end}}
{{define "custom"}}
{{- if eq .CurrentTarget "customtarget"}}
{{.CustomTargetWrap.Content}}
{{end}}
{{end}}
{{define "buffer"}}
<buffer>
@type file
path /fluentd/log/buffer/{{.BufferFile}}
flush_mode interval
flush_interval {{.OutputFlushInterval}}s
flush_thread_count 8
{{- if eq .CurrentTarget "splunk"}}
chunk_limit_size 8m
{{end}}
queued_chunks_limit_size 200
</buffer>
slow_flush_log_threshold 40.0
{{end}}
`
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。