Logstash failed to differentiate log filtering based on data source IP address

Send logs from multiple systems through syslog to logstash, which can receive logs normally. In order to distinguish logs sent from different systems, it is necessary to distinguish them based on the IP address of the data source. As long as if [host]="" is added, the condition does not hold, and debug logs cannot continue to be output. If this check statement is not added, debug logs can be output normally. In version 6.4 of logstash, using the same configuration, debug logs can be output normally, The current version of logstash is 8.12.0, and the following is the configuration of logstack.conf

   port => 514
output {
   if [host] == "" {
     stdout {
         codec => rubydebug

The following is the original log output:

Welcome to the community.

Please use the nested fields. In your case should be:
if [host][ip] == "" {

Thank you very much for your answer. Based on the method you provided, we have perfectly solved this problem :smiley:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.