简体   繁体   English

Apache logstash output 不显示 output

[英]Apache logstash output do not show output

I am trying to use logstash with apache tomcat logs.我正在尝试将 logstash 与 apache tomcat 日志一起使用。 I have below in my conf file.我的conf文件中有以下内容。 When i run this conf file i get no error messages but also i do not get anything printed on the output file.当我运行此 conf 文件时,我没有收到任何错误消息,但我也没有在 output 文件上打印任何内容。

Would you be able to advise please?你能建议吗?

input {
  file {
    path => "/opt/knime/apache-tomcat-9.0.36/logs/catalina.2021-04-06.log"
  }
}


       grok{
      patterns_dir => "/etc/logstash/patterns"
      match => { "message" => "%{MY_DATE_PATTERN:timestamp}%{SPACE}%{GREEDYDATA:dvaction}%{SPACE}%{COMMONAPACHELOG}"
      }
    }
    date {
      match => [ "timestamp" , "dd-MMM-yyyy HH:mm:ss.SSS" ]
         }
    }

    


output {
    stdout {
          codec => "json"
    }
    file {
             path =>"/var/log/logstash/testoutput.log"}
 }

By default a file input will skip to the end of the file and only read new lines as they are appended to the file.默认情况下,文件输入将跳到文件末尾,并且只在新行附加到文件时读取它们。 You may want to use the start_position option, possibly with a sincedb_path to persist the in-memory sincedb across restarts.您可能希望使用start_position选项,可能与 sincedb_path 一起在重新启动时保留内存中的 sincedb。 Also, consider whether you want to use tail or read mode.另外,请考虑您是要使用尾部模式还是读取模式。

I was able to troubleshoot this.我能够解决这个问题。 The issue was that logstash was not able to read from the log files because log files were owned by another user.问题是logstash 无法从日志文件中读取,因为日志文件归另一个用户所有。 Adding logststash user to the log files owner group has fixed the issue.将 logststash 用户添加到日志文件所有者组已解决了该问题。

Thanks all again再次感谢大家

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM