How to use Ruby specific modules in Logstash conf file

Here is the sample conf file. I need to capture each event and do pre-process for that I need to use date and digest/md5 module of ruby.

filter
{
ruby {
init => "
require 'digest/md5'
require 'date'
"
code => "

 numbers=Digest::MD5.hexdigest('Peter Completed')

 print (numbers + "\n")
 k=DateTime.now.strftime('%Q')
 print (k)

Aaaand this isn't working? What's the error message?

You can't use double quotes in the code block is you're using double quotes to delimit the code block itself.

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