How to calculate random no


#1

hello..

Anybody know how to generate random numbers between 0 to .5 using logstash.
I use the following code but not working..

ruby {
code => 'event.set("randomNumber", rand(100).to_i())'
}

Thanks


#2

I solved my problem...

Here is solution so anybody can use this...

filter{
ruby {
code => 'event.set("randomNumber", ((rand() *0.9).to_f))'

}

}


(system) #3

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