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.
Block or report user

Report or block pmuellr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pmuellr
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
pmuellr / kbn-fizz-buzz-alerts.sh
Last active Aug 27, 2019
creates alerts with the "built-in" .fizz-buzz Kibana alert type
View kbn-fizz-buzz-alerts.sh
#!/usr/bin/env bash
source ~/.kbn-fizz-buzz-secrets.sh
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
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
pmuellr / whole-lotta-alerts.sh
Last active Sep 12, 2019
create lots of alerts in Kibana
View whole-lotta-alerts.sh
#!/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.
@pmuellr
pmuellr / generic-kibana-rfc.md
Created Jul 2, 2019
generic template for Kibana RFCs
View generic-kibana-rfc.md
  • Start Date: 20yy-mm-dd
  • RFC PR: (leave this empty)
  • Kibana Issue: TBD

Summary

@pmuellr
pmuellr / index.ts
Created Jun 26, 2019
Kibana plugin for functional test server to run raw action type executors
View index.ts
// path: x-pack/test/api_integration/fixtures/plugins/action_runner/index.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.
*/
import Joi from 'joi';
@pmuellr
pmuellr / async-early-return.js
Last active Jul 3, 2018
see what async functions return when returning early, and after an await
View async-early-return.js
'use strict'
async function delay (ms) {
return new Promise((resolve, reject) => setTimeout(resolve, ms))
}
async function foo (returnEarly) {
if (returnEarly) return new Date()
await delay(1000)
@pmuellr
pmuellr / throwing-catching-logging.js
Created May 10, 2018
see what stack traces look like for nested async await calls
View throwing-catching-logging.js
'use strict'
const states = 'abcde'.split('') // [ 'a', 'b', ... ]
async function main () {
for (let state of states) {
try {
await a(state)
} catch (err) {
console.log(`state: ${state}`, err)
@pmuellr
pmuellr / nscm-network-debugging.md
Last active Apr 12, 2018
nscm network debugging
View nscm-network-debugging.md

nscm network debugging

HTTP(S)_PROXY env vars

$ set | grep -i HTTP

print nscm config

@pmuellr
pmuellr / weather-data-info.txt
Created Jan 2, 2018
weather data from api.weather.gov
View weather-data-info.txt
weather forecast from api.weather.gov:
given geolocation:
GET https://api.weather.gov/points/35.6912,-78.8012
extract:
properties.forecastGridData: eg, https://api.weather.gov/gridpoints/RAH/67,53
properties.relativeLocation.properties.city, eg, "Holly Springs"
You can’t perform that action at this time.