简体   繁体   中英

Print logstash event in ruby filter

Hello I'm exporting logs from RabbitMQ. In order to debug, I would like to print the content of the message before applying some regex and base64 decode. I'm trying to do something like this:

input {
  rabbitmq {
        host => "***host***"
        vhost => "/"
        exchange => "Exchange"
        key => "#"
  }
}

filter {
  ruby {
        code => "print event['message']"
  }
}

output {
  elasticsearch {
        host => "localhost"
  }
}

But I only have nil values for my messages.

Use this to print the message.

input {
    stdin{}
}

filter {
    ruby {
            code => "
                    puts event['message']
            "
    }
}

output {
    stdout {
            codec => "rubydebug"
    }
}

FYI.

filter {

ruby { code =>'hash=Hash[event] puts hash ' } }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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