Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@clickandmortar/kibana-url-builder
Advanced tools
This library allows building Kibana URLs, for instance when sending notifications.
:warning: Generated Kibana URLs have currently been tested on Kibana 6.x only.
# Using npm
npm install @clickandmortar/kibana-url-builder
# Using Yarn
yarn add @clickandmortar/kibana-url-builder
const kub = require('@clickandmortar/kibana-url-builder')
const url = kub.buildDiscoverUrl({
host: 'http://kibana:5601',
columns: ['_source'],
filters: [],
query: 'my query'
})
// url = http://kibana:5601/app/kibana#/discover?_g=(time:(from:now-15m,mode:quick,to:now))&_a=(columns:!(_source),filters:!(),interval:auto,query:(language:lucene,query:'my query'),sort:!('@timestamp',desc))
buildDiscoverUrl ({ host, refreshInterval, period, columns, filters, index, interval, query, sort }: KibanaDiscoverUrlBuildParameters): string
This method returns a stateless Kibana "Discover" URL, which can be shared and used by anyone having access to the Kibana instance.
Parameter | Type | Default | Required | Example |
---|---|---|---|---|
host | string | ✅ | http://kibana:5601 | |
columns | string[] | ['_source'] | ['_source', 'log'] | |
filters | KibanaQueryFilter[] | [] | See below | |
query | string | foo AND bar (Lucene syntax) | ||
period | KibanaQueryPeriod | { "from": "now-15m", "mode": "quick", "to": "now" } | See below | |
index | string | When using filters | my-index-pattern | |
interval | string | auto | 15m | |
refreshInterval | KibanaQueryRefreshInterval | { "pause": true, "value": 300000 } | ||
sort | KibanaQuerySort | { "field": "@timestamp", "direction": "desc" } |
When using filters, you must provide the index pattern name using index
property.
Supported filter types:
exists
)query
)phrases
)range
)"Not" filters can be used setting the negate
property of the filter to true
.
All filters are of type KibanaQueryFilter
and share the following properties:
Property | Type | Default | Required | Description |
---|---|---|---|---|
type | string | - | ✅ | See below examples |
field | string | - | ✅ | Name of the ES field |
value | string|boolean|number|string[] | - | ✅ | See below examples |
negate | boolean | false | - | Negate the filter |
alias | string | none | Alias for the filter | |
disabled | boolean | false | Mark filter as disabled |
{
type: 'exists',
field: 'statusCode'
}
{
type: 'query',
field: 'namespace',
value: 'kube-system'
}
{
type: 'phrases',
field: 'namespace',
value: ['kube-system', 'default']
}
{
type: 'range',
field: 'statusCode',
value: [400, 499]
}
Three period presets are available:
quick
and relative
: dates using Elasticsearch Date Math, ie. now
, now-7d
, etc.absolute
: absolute dates{
from: 'now-7d',
to: 'now',
mode: 'quick'
}
{
from: '2021-03-31T22:00:00.000Z',
to: '2021-04-02T21:59:59.999Z',
mode: 'absolute'
}
npm run test
FAQs
Kibana URL builder
The npm package @clickandmortar/kibana-url-builder receives a total of 1,102 weekly downloads. As such, @clickandmortar/kibana-url-builder popularity was classified as popular.
We found that @clickandmortar/kibana-url-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.