How to use Ruby specific modules in Logstash conf file


(Santublr) #1

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)

(Magnus B├Ąck) #2

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.


(system) #3

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