How to iterate and convert numbers to million/billion in Kibana watcher?

alerting

(Mr Getfit1234) #1

hi, I am writing a Kibana watcher which sends a daily email aggregating number of log events collected on a 24 hour period. In the body of the email it should give a summary of how many unique ip's contributed and how many million of logs in total for the day.

I know that I can use a transform script to count number of log events per day iteratively. How do I format it to millions and billions?


(Justin Walz) #2

In the transform script you can do math like any normal variable modification. For instance, I have something like this:

totalRam: _source.system.memory.total / 1024 / 1024 / 1024

(Mr Getfit1234) #3

Thank you. I ended up using something along similar lines for my code in transform:

String.format('%,d', new def {number})