fbaligand / kibana-enhanced-table

Kibana visualization like a Data Table, but with enhanced features like computed columns, filter bar, and “Split Cols” bucket
Apache License 2.0
305 stars 65 forks source link
kibana kibana-plugin kibana-visualization

Kibana Enhanced Table

This project is a Kibana plugin that provides two visualizations:

Features

Demo

Demo

Getting Started

Install

Every release package includes a Plugin version (X.Y.Z) and a Kibana version (A.B.C).

First Use

Troubleshooting

If you don't see 'Enhanced Table' (when you go to "Create visualization" screen) or if you see any error, try these actions:

Computed Settings documentation

This is the common documentation for all computed settings:

Available features

Available variables

Available functions

Function Description
cell(rowRef, colRef, defaultValue) Returns table cell value referenced by rowRef and colRef (if it exists), or else defaultValue. rowRef is either 'first' (for first row), 'last' (for last row) or a number that is the relative target row position compared to current row (ex: -1 means the previous row). colRef is either the column label (ex: 'Count') or the column index (ex: 1).
col(colRef, defaultValue) Returns column value referenced by colRef (if it exists), or else defaultValue. colRef is either the column label (ex: 'Count') or the column index (ex: 1).
countSplitCols() Returns the count of all split columns (only if 'Split cols' bucket is used).
dateObject(params) Given standard Date constructor params (milliseconds since Epoch, ...), builds and returns a date object, same structure than timeRange from/to object. The result can be used in template (ex: {{ rawValue.fullYear }}).
durationObject(durationInMillis) Given a duration in milliseconds, builds and returns a duration object, that breaks down the duration in years, months, weeks, days, hours, minutes, seconds and milliseconds. The result can be used in template (ex: {{ rawValue.hours }}).
encodeURIComponent(str) Encodes the provided string as a Uniform Resource Identifier (URI) component.
formattedCell(rowRef, colRef, defaultValue) Returns formatted table cell value referenced by rowRef and colRef (if it exists), or else defaultValue. rowRef is either 'first' (for first row), 'last' (for last row) or a number that is the relative target row position compared to current row (ex: -1 means the previous row). colRef is either the column label (ex: 'Count') or the column index (ex: 1).
formattedCol(colRef, defaultValue) Returns formatted column value referenced by colRef (if it exists), or else defaultValue. colRef is either the column label (ex: 'Count') or the column index (ex: 1).
indexOf(strOrArray, searchValue[, fromIndex]) Returns the index within the calling String or Array object of the first occurrence of the specified value, starting the search at fromIndex. Returns -1 if the value is not found.
isArray(value) Determines whether the passed value is an Array.
lastIndexOf(strOrArray, searchValue[, fromIndex]) Returns the index within the calling String or Array object of the last occurrence of the specified value, searching backwards from fromIndex. Returns -1 if the value is not found.
now() Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC
parseDate(dateString) Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC and the date obtained by parsing the given string representation of a date. If the argument doesn't represent a valid date, NaN is returned. Useful to parse date columns in 'Document Table' visualization.
replace(str, substr, replacement) Returns a new string with first match of substr replaced by a replacement. Only the first occurrence will be replaced.
replaceRegexp(str, regexp, replacement) Returns a new string with all matches of a regexp replaced by a replacement. All the occurrences will be replaced.
search(str, regexp) Executes a search for a match between a regular expression on 'str' String. Returns the index of the first match or -1 if not found.
sort(array[, compareFunction]) Sorts the elements of an array in place and returns the sorted array. A compare function can be provided to customize the sort order. Example for an array of numbers: comparator(a, b) = a - b; sort(col0, comparator)
substring(str, indexStart[, indexEnd]) Returns the part of the string between the start and end indexes, or to the end of the string (if no index end is provided).
sumSplitCols() Returns the sum of all split column values (only if 'Split cols' bucket is used).
toLowerCase(str) Returns the calling string value converted to lowercase.
toUpperCase(str) Returns the calling string value converted to uppercase.
total(colRef, defaultValue) Returns column total referenced by colRef (if it exists), or else defaultValue. colRef is either the column label (ex: 'Count') or the column index (ex: 1).
trim(str) Removes whitespace from both ends of a string.
uniq(array) Removes duplicates from provided array so that array contains only unique values.

Computed Column Template documentation

This is the documentation for "Template" setting in computed columns.
A template is a Handlebars expression.
Examples:

Available variables

Available helpers

Helper Description
encodeURIComponent(str) Encodes the provided string as a Uniform Resource Identifier (URI) component. Example: <a href="https://github.com/fbaligand/kibana-enhanced-table/blob/master/my-dashboard?param={{{encodeURIComponent rawValue}}}">{{value}}</a>

Change Log

Versions and Release Notes are listed in Releases page

Credits

This Kibana plugin is inspired from computed-columns and kbn_searchtables plugins.
Thanks for their great work !

Development

To run enhanced-table plugin in development mode (that enables hot code reload), follow these instructions:

To build a distributable archive, execute this command :

yarn compile-and-build --kibana-version X.Y.Z # replace 'X.Y.Z' by target Kibana version

The zip archive is generated into build directory.

Donation

If this plugin helps you and you want to support it, you can give me a cup of coffee :)

paypal