Skip to content

Instantly share code, notes, and snippets.

Avatar
🌀
Software developer @ Elastic working on Kibana. Previously @ NodeSource, IBM.

Patrick Mueller pmuellr

🌀
Software developer @ Elastic working on Kibana. Previously @ NodeSource, IBM.
View GitHub Profile
@pmuellr
pmuellr / launch-addition.json
Last active Jul 14, 2022
kibana jest launch config for vs code to launch the current file as a jest test
View launch-addition.json
{
"type": "node",
"name": "jest current file",
"program": "scripts/jest.js",
"args": [
"--runInBand",
"--colors",
"--testTimeout=60000", // 60s
// "--useStderr",
"${relativeFile}"
View proxy-connect.md
sequenceDiagram
    participant Client
    participant Proxy
    participant Target
    Client->>Proxy: HTTP CONNECT target.example.com:80 
    Proxy->>Target: open socket to target.example.com:80
    Proxy->>Client: empty 200 OK status response ...
    Proxy->>Client: ..but leave socket open from client
 Note over Proxy: Proxy now just passes bytes btween client and target
@pmuellr
pmuellr / forward_proxy_ng.js
Last active May 9, 2022
http/https proxy running on http/https w/http-proxy package
View forward_proxy_ng.js
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
// starts http and https proxies to use to test actions within Kibana
const fs = require('fs');
@pmuellr
pmuellr / task-manager-tasks-heatmap.json
Created Mar 25, 2022
task manager tasks heatmap in vega-lite (baby steps)
View task-manager-tasks-heatmap.json
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "task manager tasks",
"data": {"values": [
{"worker": 0, "begin": 0, "duration": 1, "type": "i" },
{"worker": 0, "begin": 3, "duration": 1, "type": "i" },
{"worker": 0, "begin": 6, "duration": 1, "type": "i" },
{"worker": 0, "begin": 9, "duration": 1, "type": "i" },
{"worker": 1, "begin": 0, "duration": 4, "type": "o" },
{"worker": 1, "begin": 6, "duration": 2, "type": "s" }
@pmuellr
pmuellr / mermaid-sample.md
Created Mar 5, 2022
launchpad-driver flow (early)
View mermaid-sample.md
sequenceDiagram
    participant I as IPad / html
    participant S as Server / deno
    participant D as DesktopBrowser / html
    participant L as Launchpad / native device
    
    D ->>	L: Find Launchpad
    activate L
    L ->>	D: Found Launchpad
@pmuellr
pmuellr / export-to-server-log.js
Last active Sep 29, 2021
A cli filter which reads a Kibana export file from stdin, and writes a Kibana export file to stdout. The export is changed to remove all alerting connectors, add a new server log connector, and change all referenced actions in alerting rules to the server log. This renders an export of Kibana alerting rules to the same rules which do not perform…
View export-to-server-log.js
#!/usr/bin/env node
'use strict'
/*
Filter for Elastic Kibana .ndjson files with alerting rule exports,
that converts all the rule's actions to a new server log connector.
node export-to-server-log.js < original-export.ndjson > modified-export.ndjson
*/
@pmuellr
pmuellr / kibana-dev-tools-console-event-log.txt
Last active Jul 26, 2022
Kibana Dev Tools Console queries for the event log
View kibana-dev-tools-console-event-log.txt
#-------------------------------------------------------
# get 1000 rule SO's
GET .kibana/_search
{
"size": 1000,
"query": {
"bool": {
"filter": [
{"term": {"type": "alert"}}
]
@pmuellr
pmuellr / kibana-7.14.0-alerting-o11y.ndjson
Last active Feb 16, 2022
Kibana 7.14.0 saved objects for alerting o11y
View kibana-7.14.0-alerting-o11y.ndjson
{"attributes":{"fieldAttrs":"{\"event.outcome\":{\"count\":3},\"kibana.alerting.status\":{\"count\":5},\"message\":{\"count\":7},\"event.action\":{\"count\":4},\"kibana.alerting.action_group_id\":{\"count\":2},\"kibana.alerting.instance_id\":{\"count\":2},\"event.duration\":{\"count\":7},\"error.message\":{\"count\":4},\"event.end\":{\"count\":1},\"event.reason\":{\"count\":2},\"event.start\":{\"count\":1},\"rule.id\":{\"count\":1},\"kibana.spaceId\":{\"count\":1}}","fieldFormatMap":"{\"event.duration\":{\"id\":\"duration\",\"params\":{\"inputFormat\":\"nanoseconds\",\"outputFormat\":\"asSeconds\",\"showSuffix\":true,\"useShortSuffix\":true}},\"event.duration.ms\":{\"id\":\"duration\",\"params\":{\"inputFormat\":\"milliseconds\",\"outputFormat\":\"asMilliseconds\",\"showSuffix\":true,\"useShortSuffix\":true}}}","fields":"[]","runtimeFieldMap":"{\"event.duration.ms\":{\"type\":\"long\",\"script\":{\"source\":\"def duration = doc['event.duration'];\\nif (duration == null) return;\\nif (duration.size() == 0) ret
@pmuellr
pmuellr / kibana-7.13.2-alerting-o11y.ndjson
Last active Jul 15, 2021
Kibana 7.13.2 saved objects for alerting o11y
View kibana-7.13.2-alerting-o11y.ndjson
{"attributes":{"fieldAttrs":"{\"soid\":{\"count\":4},\"_id\":{\"count\":1},\"event.action\":{\"count\":1},\"event.duration\":{\"count\":1},\"event.provider\":{\"count\":1},\"kibana.alerting.status\":{\"count\":1}}","fieldFormatMap":"{\"event.duration\":{\"id\":\"duration\",\"params\":{\"inputFormat\":\"nanoseconds\",\"outputFormat\":\"asMilliseconds\",\"outputPrecision\":0,\"showSuffix\":false}}}","fields":"[]","runtimeFieldMap":"{\"soid\":{\"type\":\"keyword\",\"script\":{\"source\":\"def savedObjects = params._source[\\\"kibana\\\"][\\\"saved_objects\\\"];\\n\\nif (savedObjects != null) {\\n for (def savedObject : savedObjects) {\\n emit(savedObject[\\\"type\\\"] + \\\":\\\" + savedObject[\\\"id\\\"])\\n } \\n}\"}}}","timeFieldName":"@timestamp","title":".kibana-event-log-*"},"coreMigrationVersion":"7.13.2","id":"119d36c0-ce30-11eb-9885-59d424b49d0b","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-06-16T03:14:42.635Z","version":"WzYzNTQ1LDFd"}
{"
@pmuellr
pmuellr / dashboard.ndjson
Last active Jun 4, 2021
Kibana dashboard for the alerting event log
View dashboard.ndjson
{"attributes":{"fieldAttrs":"{}","fieldFormatMap":"{\"event.duration\":{\"id\":\"duration\",\"params\":{\"inputFormat\":\"nanoseconds\",\"outputFormat\":\"asMilliseconds\",\"showSuffix\":true,\"useShortSuffix\":true,\"includeSpaceWithSuffix\":true}}}","fields":"[]","runtimeFieldMap":"{\"soid\":{\"type\":\"keyword\",\"script\":{\"source\":\"def savedObjects = params._source[\\\"kibana\\\"][\\\"saved_objects\\\"];\\n\\nif (savedObjects != null) {\\n for (def savedObject : savedObjects) {\\n emit(savedObject[\\\"type\\\"] + \\\":\\\" + savedObject[\\\"id\\\"])\\n } \\n}\\n\"}}}","timeFieldName":"@timestamp","title":".kibana-event-log-*","typeMeta":"{}"},"coreMigrationVersion":"8.0.0","id":"cd94ad50-c4c0-11eb-a329-07149b9b0aad","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-06-03T23:25:41.302Z","version":"WzY4Nzg3LDFd"}
{"attributes":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"language\":\"kuery\",\"query\":\"