Skip to content

Instantly share code, notes, and snippets.

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 / zod+js+jsdoc.js
Created Oct 31, 2020
trying to use zod in js with jsdoc type comments for vs code - almost works!
View zod+js+jsdoc.js
'use strict'
// examples from
// trying to use zod in JS w/ jsdoc type comments in vsCode
const z = require('zod')
const dogSchema = z.object({
name: z.string(),
pmuellr / alerting-taskmanager-dashboard.ndjson
Last active Oct 15, 2020
alerting dashboard showing alerts/action function execution counts and task manager docs breakdowns
View alerting-taskmanager-dashboard.ndjson
pmuellr / es-log.txt
Created Feb 27, 2020
2020-02-27 es walkback from event-log
View es-log.txt
info [o.e.x.i.a.TransportPutLifecycleAction] [] adding index lifecycle policy [.kibana-event-log-policy]
info [o.e.c.m.MetaDataIndexTemplateService] [] adding template [.kibana-event-log-8.0.0-template] for index patterns [.kibana-event-log-8.0.0-*]
info [o.e.c.m.MetaDataCreateIndexService] [] [.kibana-event-log-8.0.0-000001] creating index, cause [api], templates [.kibana-event-log-8.0.0-template], shards [1]/[1], mappings [_doc]
info [o.e.x.i.IndexLifecycleTransition] [] moving index [.kibana-event-log-8.0.0-000001] from [null] to [{"phase":"new","action":"complete","name":"complete"}] in policy [.kibana-event-log-policy]
info [o.e.x.i.IndexLifecycleTransition] [] moving index [.kibana-event-log-8.0.0-000001] from [{"phase":"new","action":"complete","name":"complete"}] to [{"phase":"hot","action":"unfollow","name":"wait-for-indexing-complete"}] in policy [.kibana-event-log-policy]
info [o.e.x.i
pmuellr / canvas-es-hb-sim
Last active Jan 16, 2020
Kibana canvas chart for es-hb-sim
View canvas-es-hb-sim
| essql
query="SELECT \"@timestamp\" as time, \"summary.up\" as up FROM \"es-hb-sim\" WHERE time > NOW() - INTERVAL 60 SECONDS"
| pointseries x="time" y="up"
| plot defaultStyle={seriesStyle lines="1" fill=1 bars="0"}
| render
pmuellr /
Last active Jan 14, 2020
whole-lotta-alerts stress tester for Kibana alerting using heartbeat data
#!/usr/bin/env bash
# creates a number of alerts with a server-log action
# Note that default alerttype - example.heartbeat is from
# requires the following:
# jq:
# kbn-action:
pmuellr / graphic-3.html
Created Jan 4, 2020
ObservableHQ runtime example
View graphic-3.html
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="./node_modules/@observablehq/inspector/dist/inspector.css">
<script type="module">
import { Runtime, Inspector } from "./node_modules/@observablehq/runtime/dist/runtime.js";
const runtime = new Runtime()
const inspector = Inspector.into(document.body)
const mod = runtime.module(define, inspector)
pmuellr / es-ilm-rollover-setup.text
Created Sep 16, 2019
commands for Kibana console to play with ilm/rollover/aliases
View es-ilm-rollover-setup.text
DELETE _ilm/policy/event_log_policy
DELETE _template/event_log_template
DELETE event-log-000001
DELETE event-log-000002
PUT _ilm/policy/event_log_policy
"policy": {
"phases": {
"hot": {
pmuellr /
Last active Aug 27, 2019
creates alerts with the "built-in" .fizz-buzz Kibana alert type
#!/usr/bin/env bash
source ~/
ACTION_ID_SELOG=`kbn-action create .server-log "fizz-buzz server-log" "{}" "{}" | jq -r ".id"`
ACTION_ID_SLACK=`kbn-action create .slack "fizz-buzz slack" "{}" "{webhookUrl: '$SLACK_WEBHOOKURL'}" | jq -r ".id"`
ACTION_ID_EMAIL=`kbn-action create .email "fizz-buzz email" "{service: '$EMAIL_SERVICE', from: '$EMAIL_FROM'}" "{user: '$EMAIL_USER' password: '$EMAIL_PASSWORD'}" | jq -r ".id"`
ACTION_ID_INDEX=`kbn-action create .index "fizz-buzz index" "{index: 'fizz-buzz'}" "{}" | jq -r ".id"`
ACTION_ID_PDUTY=`kbn-action create .pagerduty "fizz-buzz pagerduty" "{}" "{routingKey: '$PAGERDUTY_ROUTING_KEY'}" | jq -r ".id"`
pmuellr / audit_log.ts
Created Aug 5, 2019
initial pass on an AuditLog interface
View audit_log.ts
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
type IAuditRecord = Record<string, any>;
interface IAuditLog {
initialize(): Promise<void>;
pmuellr /
Last active Jul 14, 2020
create lots of alerts in Kibana
#!/usr/bin/env bash
# creates a number of alerts with a server-log action
# Note that default alerttype - test.always-firing is part of the
# alerting function tests, and writes documents to the index $GARBAGE_INDEX_NAME
# specified below (it's uses it productively in tests, but not useful here).
# So, if you use this default alerttype, you should be pointing your $KBN_URLBASE to
# a Function Test Server.