Ruby exception occurred: undefined method `/'

filter {  
     ruby {
      code => "event.set('test', (event.get('vstorage.space.allocatable') / event.get('vstorage.license.capacity')) * 100)" 
     }
    } 

The error is

[ERROR][logstash.filters.ruby ] Ruby exception occurred: undefined method `/' for nil:NilClass
[ERROR][logstash.filters.ruby ] Ruby exception occurred: nil can't be coerced into Float

I don't know where is not correct.

That is telling you thtat the vstorage.space.allocatable field does not exist. You could wrap your filter in

if [vstorage.space.allocatable] and [vstorage.license.capacity] { ... }

I assume your field names really do contains periods and they are not nested fields which you would reference as [vstorage][space][allocatable]

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