Grafana connection with elasticsearch - elasticsearch

I have successfully create a connection between Grafana and Elasticsearch. I have already indexed data into Elasticsearch , but Grafana doesn't want to show it as a "Singlestat".
Elasticsearch Data Picture
Grafana Settings Picture
So the value is "104". But why Grafana does not show this?

If you would like to show the current value in SigleStat panel you should do it in the following way:
In Elastic end - Save it as int, as in SigleStat panel you can show only integers fields.
In Grafana end - a. Add "ecommerce" index as data source (located in top left menu - data sources).
b. In SigleStat panel - "Metrics" tab - choose "ecommerce" data source.
c. In the query line: write the following "_type:supporttickets".
d. In Metric field - choose "Max" and "value" (if value is not int you will not see it in dropdown).
e. In SigleStat panel - "Options" tab - in "Stat" dropdown choose "current".
More options like colors by thresholds and stuff - http://docs.grafana.org/features/panels/singlestat/

Metric -> sum -> is looking for Numeric value but it is getting a string("104").
Insert the values of "#value" column as Integer in Elasticsearch

Related

Kibana textbox instead of dropdown

To create a new Kibana visualization I select "Controls" from the "New Visualization" section:
Viewing the "Controls" section:
An option does not appear to exist to add a "text field" , all field types are dropdowns. How to add a searchable text field type to a visualization ?
The reason I'm attempting to add a text field instead of a dropdown field is that the number of records returned by the field in question exceeds 1'000'000 and therefore I do not want to populate all data for performance reasons.
Up to this point I use kibana.autocompleteTerminateAfter and set the value to the number of data points stored in elastic for the field. I'm concerned that as more records are added to elastic the performance of loading the Kibana search page will decrease as kibana.autocompleteTerminateAfter will require updating as new records are added and could at some point be set to kibana.autocompleteTerminateAfter : 10000000
From https://www.elastic.co/guide/en/kibana/current/settings.html :

How can I create a list of values for a field in Kibana?

I am using Kibana to view data from Elasticsearch index. There is a field only has a few values. When I do search the field, how can I make the search bar as a select rather than a free text input? I know that there is a filter list like below image:
but it doesn't work for the case that top 5 values in 500 records have one value. How can I show all values in the history as a list for a field?
I think your are looking for "controls" visualization.
Go to visualization > controls
Then choose option list, your index and your field.
The result will be a dropdown with values like if you did a select distinct on your field within the whole kibana range.
Add it to a dashboard to have a filtering interface human usable dashboard.
Update:
Maybe a simple filter on the discover page can answer to your question.

Kibana return results where a specific field is unique

So have been used to using GrayLog to build queries like this and struggling to get my head around Kibana so I need a few pointers to get me going.
I have an index that I want to search for various terms in a particular field. For example I want to search the index for the term "MFA" and this term will be in the adaptorid field. This returns some results so far so good but I would like to filter this a little more.
One field in particular that is of interest is trackingid, in fact it is actually the only field that I care about. The results that are returned can return multiple duplicate trackingids for each matched adaptorid.
What I would like to do is dedupe the trackingid so that I can get a count of the unique trackingid. The adaptorid field really doesn't matter in the final results and is just used to identify a particular sub set of trackingid fields from the index.
Assuming you are using Kibana 6.5+
Go to kibana -> Visualize -> Click on + icon -> Select Data Table -> Select your index -> Under Metrics select Unique Count Aggregation and your field trackingid-> Click on Play Icon |>
This will give you count of unique tracking Id's in you index. Now you can use kibana Add a Filter from top to filter MFA in adaptorid

how kibana can create a dashboard which sum the column of some log record

I have a request which sum the core and memory of specify jobs, the origin data about core and memory have been put in the elk logs. Like as below picture.
First red column is core data, the second column is memory data, third red column is job name. Now I want to sum the "core" or "memory" by filtering specify jobs and create a dashboard in kibana. As the dashboard, x-axis is 'time', y-axis is sum of 'core' or 'memory'.
I don't know how to sum the column in elk and create dashboard, someone who can help me, thank you so much.
You need to add a scripted field which will add a field at runtime in every document by operations on your current field.
After creating an index pattern , go to that index pattern in settings tab in got to scripted fields tab and a new scripted field.
Name the field which will appear while making the visualisation and add the script as follows.
Here is how to make a script
https://www.elastic.co/guide/en/elasticsearch/reference/6.x/search-request-script-fields.html
And here is a link of how you can do that in kibana
https://www.elastic.co/guide/en/kibana/current/scripted-fields.html

Grafana - Show metric by field value

I'm currently trying to create a graph on Grafana to monitor the status of my servers, however, I can't seem to find a way to use the value of a field as the value to be displayed on the graph. (Datasource is ElasticSearch)
The following "document" is going to be sent to GrayLog (which saves to Elastic) every 1 minute for an array of regions.
{
"region_key": "some_key",
"region_name": "Some Name",
"region_count": 1610
}
By using the following settings, I can get Grafana to display the count of messages it received for each region, however, I want to display the number on the region_count field instead.
Result:
How can I accomplish this? is this even possible using Elastic as the datasource?
1) Make sure that your document includes a timestamp in ElasticSearch.
2) In the Query box, provide the Lucene query which narrows down the documents to only those related to this metric
3) In the Metric line, press "Count" and change that to one which takes a specific field: for example, "Average"
4) Next to the "Average" box will appear "select field", which is a dropdown of the available fields. If you see unexpected fieldnames here, it's probably because your Lucene query isn't specific enough. (Kibana can be useful for getting this query right)

Resources