【问题标题】:Logstash pipeline adding extra timestamp%{host} in beginning of rsyslog messageLogstash 管道在 rsyslog 消息的开头添加了额外的时间戳%{host}
【发布时间】:2022-09-23 01:24:52
【问题描述】:

我正在使用 logstash 管道将数据摄取到 rsyslog 服务器中。

但是管道在开头添加了额外的日期戳和 %{host}

例子:

**Sep 22 04:47:20 %{host}  2022-09-22T04:47:20.876Z %{host}** 22-09-2022 05:47:20.875 a7bd0ebd9101-SLOT0   `TEST-AWS-ACTIVITY`#011970507     P        201059147698 `[FCH-TEST] [35.49.122.49] [TEST-251047********-******] [c713fcf9-6e73-4627-ace9-170e6c72fac5] OUT;P;201059147698;;;;/bcl/test/survey/checkSurveyEligibility.json;ErrorMsg=none;;{\"body\":{\"eligible\":false,\"surveys\":[]},\"header\":null}`**

谁能告诉这个额外的部分来自哪里以及如何抑制它。

数据来自安装在 ECS 容器上的 AWS cloudwatch。

管道配置为:

input  { pipeline { address => test_syslog } }

filter {

if [owner] == \"1638134254521\"  { 
   mutate { add_field  =>  { \"[ec_part]\" => \"AWS_TEST\"} }
  
  } 
}

output {
#TEST ACTIVITY Logs being sent via TCP to Logreceiver
  if [ec_part] == \"AWS_TEST\" {
  syslog {
    appname => \"\"
    host => \"10.119.140.206\"
    port => \"10514\"
    protocol => \"ssl-tcp\"
    ssl_cacert => \"/etc/logstash/ca.crt\"
    ssl_cert => \"/etc/logstash/server.crt\"
    ssl_key => \"/etc/logstash/server.key\"
    priority => \"info\"
    rfc => \"rfc5424\"
  }
  }
}
  • 你能展示你正在运行的管道配置吗?
  • 您正在使用什么输出以及您在上面配置了什么编解码器?
  • 我已经更新了原始问题中的管道配置。我没有使用任何特定的编解码器插件
  • 你也可以添加test_syslog管道配置的配置吗?

标签: elasticsearch logstash pipeline logstash-configuration rsyslog


【解决方案1】:

输出的default codec 是普通的,如果未指定格式选项,那么将在事件中使用call the .to_s method。 .to_s 方法adds 时间戳和%{host}。您可以通过添加来防止这种情况

codec => plain { format => "%{message}" }

到您的系统日志输出。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多