Kibana
This article is the fourth module of the Self-managed ELK Stack article behind Introduction, Filebeat and Logstash. Hence, it is recommended to go through the aforementioned articles before proceeding with Kibana.
Creating visualizations from filtered data
- Open Kibana -> Discover
- Select appropriate index (
sample_index*
) and necessary columns - Click on Save to save your discover search so you can use it in visualizations and dashboards
- If this is your first time using Kibana visualizations, you must reload your field list before proceeding. To reload, Stack Management -> Index Patterns -> hft_file* -> Refresh file list icon (on top right)
- Click on Visualize and create a new visualization
- Click on Dashboard and create a new dashboard and add the visualization
Aggregation query
POST /sample_index/_search
{
"aggs":
{
"eq_entries":
{
"aggs": {
"min_ts": { "min": { "field": "@timestamp" } }
},
"terms": {
"field": "agent.keyword",
"size": 10
}
}
}
}
Visualization tools
Most of visualization tools like bar and line charts are pretty straightforward and intuitive to work with. I have mentioned a couple of more advanced tools that are not completely GUI based.
Timelion
Can be used to plot time series sequential data and allows mathematical operations. For instance, it can be used to perform point wise subtraction of two timestamp sequences to obtain latency.
Sample syntax
- Offset a sequence of data by 1 hour and plot the count of logs with label
last_hour
.
.es(offset=-1h,index=sample-filebeat,timefield='@timestamp',metric=count).label('last_hour')
- Plot a bar graph of the frequency of logs containing the field
condition_type
such thatcondition_type == exit
.es(index=sample-filebeat,timefield='@timestamp', metric=count,q='_exists_ : condition_type AND condition_type : exit').label('exit').bars(width=10,stack=yes),
.es(index=sample-filebeat,timefield='@timestamp', metric=count,q='_exists_ : condition_type AND condition_type : entry').label('entry').bars(width=10,stack=yes)
- Plot the sum of field
quantity
of logs containing the fieldcondition_type
such thatcondition_type == entry
and assign the labelentry_sum
.es(index=sample-filebeat,timefield='@timestamp', metric='sum:quantity.value',q='_exists_ : condition_type AND condition_type : entry').sum().label('entry_sum')
Additional Links
- Visualization
- Conditional Logic
- Mathematical funtions
- Aggregations(Highly useful)
- Sparse time series
Vega
Similar to Timelion but provides support for more complex queries such as groupby aggregations.