Kibana 5.5 visualization data aggregation percentage - elasticsearch

I'm using Kibana 5.5 and would like to create a visualization that shows percentage of successful transactions made to my server.
In order to do that I have a field in the document named "httpCode" and I would like to get the percentage of "httpCode: 200" out of the total transactions made.
I managed to put this in visulalization that does separate lines, but I would like to get percentage over time and not count.
Thanks,
Moshe

Create a new bar or area chart and choose count as aggregation, set your field for Date Histogram. Next in buckets tab add Split Series and choose Filters as Sub Aggregation. Your first filter should look like that:
Filter 1
httpCode:200
Use http.keyword instead if is available.
Filter 2
NOT httpCode:200
Go to Metrics & Axes tab, expand LeftAxis-1 and change mode to percentage:
On my exmaple it should look like that:

Related

How can I sort the date in the X axis properly on a Bar Chart in Kibana?

I'm trying to order the date ascendantly in the X axis of the chart. And I've set it up that way here:
However, this happens:
Is there a way to work around this? 25 January should be the last bar. I've tried changing data formats to see if it would order properly but with no success.
You haven't specified how you are generating this graph, but it looks like you've done a Terms aggregation on the date field. The order by you are showing is then for the terms count. If you look right above that, it probably says order by: Metric count. What you want it to say is Order by: term.
In any event, in general, you don't want to aggregate by date like that. Instead choose a Date Histogram aggregation. That will allow the time filter/aggregation bucket size to be changed.

How to aggregate data between two filters in Kibana?

I have two filters transfer* and transfer_failures. Each filter is the output of a database query using ES DB queries. I need to visualize a graph that aggregate monthly the number of transfer_failures/total transfers in the month.
Both have timestamp created field with the same format, but I wanna know how to plot table that uses two filters!
So suppose I have 40 total transfers on May 'should be calculated using the transfer* filter' and 10 transfer_failures 'should be calculated by the transfer_failure* filter' so the graph should blot 10/40=.25 on May supposing building a Vertical Bar.
I've some screenshots to show, but I am not allowed to post these here.
You can use the filter ratio aggregation on Visualize -> TSVB/Time Series Visual Builder if you want to calculate percentages using two filters.

How to display the last value in Grafana Gauge

I'm new to using Grafana and I'm trying to display the last value of a table that's organized by dates in a Gauge visualization.
All the options I'm seeing to displaying the data are grouping methods like max, average, sum and so on.
Is there a way to get only the latest most updated value from that table? And to always display it?
I'm using Grafana v7.1.3 and ES.
Choose "Last" or "Last (not null)" from the "Display" option:

Vega-Lite / Kibana : How can I make a table that shows calculations between aggregations?

I want to do a data table in kibana like the following:
see image
That means, the 2 first columns are the sum of price and quantity and the 3rd column divides both sums to get a ratio.
Also I want this to be dynamic to changes in time range.
As far as I've seen getting the ratio is not possible in kibana, but I've noticed that there is a plugin were you can create Vega-Lite graphs in kibana.
I am new both in Vega-Lite and in kibana, so is there an example of code that creates a data table?
The Vega-Lite site did not help me a lot...
Thank you!
I believe you could add a scripted field to calculate this ratio and then u can have the column you want :D
https://www.elastic.co/guide/en/kibana/current/scripted-fields.html

Daily unique count, weekly unique count in the same Timelion chart

I want to visualize the unique count for a field aggregated daily and weekly per day in the same sheet. But timelion aggregation affects the entire sheet instead of just a single chart.
The expression I am using to get the daily unique count is
.es(metric='cardinality:userId').bars().title('Unique users over time')
If I change the bucket range on the right to 1d, I get the correct chart. How do I create the weekly aggregation?
There is a possibility to specify the interval used for timelion expressions by specifying interval as 1d or respectively 1w in the es() function. For details, please see the docs here.
In your case this should work with the following expression:
.es(metric='cardinality:userId',interval=1w).bars().title('Unique users per week')
Be aware of the comment inside the docs, stating that this should not be used in favor of working with the interval picker. But probably this is a use case where it is okay to do it like this...

Resources