Cost calculation on count

Hello,

I am new to kibana and need to calculate cost of an instance. I am able to get the total runtime of the instance but can't seem to find a way to multiply it with the cost of running that instance. Is there a way to do this in kibana?

Any help would be greatly appreciated.

Thanks.

Hi Simran,

Welcome to the Elastic community! :slight_smile:

Is the cost of running fixed for each user? Is this information present in the document?

There could be possibly two ways to solve it, and it depends on what you want to do with the data.

  1. Use Elasticsearch SQL
    How to multiply two columns and then sum the result in ElasticSQL?
    The PR for this is merged already.
    This is especially useful if you wish to use canvas and showcase your data.

  2. Scripted fields in Kibana
    A simpler way if the cost of each entity is fixed and not changing. But you could end up having to create multiple visualizations if the cost is different for each user.
    https://stackoverflow.com/questions/50403676/add-math-to-metrics-in-kibana

Thanks for your reply! I used a painless script to add a new calculation that adds a custom field called cost based on my calculation. This seems to work properly now (I think). How can I now take all of a specific users jobs in a specific partition and aggregate the cost to show 1 number based on some timeframe. For example:

partition 1 runs:
usera:
job1 - cost
job2 - cost
userb:
job1 - cost
job2 - cost
partition 2 runs:
usera:
job1 - cost
job2 - cost

I want a single graph/table to show total cost for UserA in partiton1, UserB in partition1 and UserA in partition2. what would be the best way to achieve this in kibana?

Thanks.

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