diff --git a/fluentd/fluent.conf b/fluentd/fluent.conf index 9f5880e..b4a0c7f 100644 --- a/fluentd/fluent.conf +++ b/fluentd/fluent.conf @@ -11,8 +11,8 @@ @type record_transformer enable_ruby - loglevel ${case record["log"] when /.*\[info\].*/i then "INFO" when /info /i then "INFO" when /.*\[warning\].*/i then "WARN" when /warn /i then "WARN" when /.*\[error\].*/i then "ERROR" when /error /i then "ERROR" else "DEBUG" end} - text ${"【这是收集的容器日志】"+record["log"].gsub("DEBUG ", "").gsub("INFO ", "").gsub("WARN ", "").gsub("ERROR ", "").gsub(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} /, "").gsub(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} /, "")} + loglevel ${case record["log"] when / info /i then "INFO" when / warn /i then "WARN" when / error /i then "ERROR" else "DEBUG" end} + text ${"【这是收集的容器日志】"+record["log"].gsub(/debug |info |warn |error /i, "").gsub(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} /, "")+"\n这是原日志:\n"+record["log"]} servername ${record["container_name"].gsub("/", "")} serverip ${"127.0.0.1"} date ${case record["log"] when /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} / then record["log"].match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} /)[0] else time.strftime('%Y-%m-%d %H:%M:%S.%3N') end}