Skip to content

Instantly share code, notes, and snippets.

View pmuellr's full-sized 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 / spec.json
Created November 24, 2022 16:58
Vega-Lite spec es-dvdd experiments with saved objects
{
"title": "saved object size",
"data": {
"values": [
{
"id": "ingest-download-sources:fleet-default-download-source",
"coreMigrationVersion": "8.7.0",
"type": "ingest-download-sources",
"updatedAt": "2022-11-24T15:50:49.390Z",
"size": 441
@pmuellr
pmuellr / vscode-launch-kibana-jest.json
Last active November 1, 2022 18:32
kibana jest launch config for vs code to launch the current file as a jest test; add this object to the `configurations` property of your `.vscode/launch.json` file
{
"type": "node",
"name": "jest current file",
"program": "scripts/jest.js",
"args": [
"--runInBand",
"--colors",
"--testTimeout=60000",
"${relativeFile}"
],
@pmuellr
pmuellr / Task-Manager-tasks.ndjson
Created October 6, 2022 12:35
Kibana 8.4.1 saved objects for Task Manager tasks viz
{"attributes":{"fieldAttrs":"{}","fields":"[]","name":"Task Manager","runtimeFieldMap":"{}","sourceFilters":"[]","timeFieldName":"task.runAt","title":".kibana_task_manager","typeMeta":"{}"},"coreMigrationVersion":"8.4.1","id":"c0766836-7fb8-4710-a7a5-f67c70145405","migrationVersion":{"index-pattern":"8.0.0"},"references":[],"type":"index-pattern","updated_at":"2022-10-05T22:27:48.679Z","version":"WzM3OTgwLDFd"}
{"attributes":{"description":"","state":{"datasourceStates":{"indexpattern":{"layers":{"fad2ab1a-f33d-47c8-bece-16d3b2ce0452":{"columnOrder":["aa331f51-914a-4329-a429-7cc0e771b6ab","aec91a26-7c5e-469a-ac39-544214281856","a35f50da-207e-4219-bcae-14f927450ec4"],"columns":{"a35f50da-207e-4219-bcae-14f927450ec4":{"dataType":"number","isBucketed":false,"label":"Count of records","operationType":"count","params":{"emptyAsNull":true},"scale":"ratio","sourceField":"___records___"},"aa331f51-914a-4329-a429-7cc0e771b6ab":{"dataType":"string","isBucketed":true,"label":"Top 3 values of task.taskType","operationTyp
@pmuellr
pmuellr / kibana-7.14.0-alerting-o11y.ndjson
Last active September 1, 2022 18:22
Kibana 7.14.0 saved objects for alerting o11y
{"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 / dev-console-el-flapping-aggs.txt
Created August 18, 2022 04:53
query the event log for signs of flapping
POST .kibana-event-log-8.5.0/_search
{
"size": 0,
"query": {
"bool" : {
"must" : {
"range": { "@timestamp": { "gte": "now-18s" }}
},
"filter": {
"terms" : { "event.action" : ["new-instance", "active-instance", "recovered-instance"] }
@pmuellr
pmuellr / req-mapping.json
Created March 9, 2016 05:23
aws api gateway integration request mapping template for aws lambda
{
"method": "$context.httpMethod",
"resourcePath": "$context.resourcePath",
"querystring": {
#foreach($key in $input.params().querystring.keySet())
"$key": "$input.params().querystring.get($key)"#if($foreach.hasNext),#end
#end
},
"path": {
#foreach($key in $input.params().path.keySet())
@pmuellr
pmuellr / kibana-dev-tools-console-event-log.txt
Last active July 26, 2022 17:40
Kibana Dev Tools Console queries for the event log
#-------------------------------------------------------
# get 1000 rule SO's
GET .kibana/_search
{
"size": 1000,
"query": {
"bool": {
"filter": [
{"term": {"type": "alert"}}
]
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 17:22
http/https proxy running on http/https w/http-proxy package
/*
* 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 March 25, 2022 11:53
task manager tasks heatmap in vega-lite (baby steps)
{
"$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" }