Skip to content

Instantly share code, notes, and snippets.

View d-smith's full-sized avatar

Doug Smith d-smith

View GitHub Profile
@d-smith
d-smith / stuff.txt
Last active February 19, 2016 00:05
docker compose and mariadb stuff
docker run --name some-mariadb -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb:latest
docker run -it --link some-mariadb:mysql --rm mariadb sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
sudo tar cvf ~vagrant/app-dev-volume-data.tar ./dvol
docker run -it --link vagrant_mariadb_1:mysql --rm mariadb sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
@d-smith
d-smith / collector-install-notes.txt
Created February 4, 2016 23:05
Sumo Collector Installation
sudo su root
Then:
1 export http_proxy=http://http.proxy.fmr.com:8000
2 export https_proxy=$http_proxy
3 wget "https://collectors.us2.sumologic.com/rest/download/linux/64" -O SumoCollector.sh && chmod +x SumoCollector.sh && ./SumoCollector.sh -q -Vsumo.token_and_url=xxx= -Vproxy.host=http.proxy.fmr.com -Vproxy.port=8000
^D
@d-smith
d-smith / fluent-sumo.md
Last active July 16, 2017 04:00
SumoLogic Integration via Fluentd

Sumo - Fluentd Integration

There are a couple ways to integrate SumoLogic with fluentd.

In both cases, in SumoLogic configure an HTTP collector to send the log data to. For the log messages to be grouped properly, make sure to not enable multiline processing or enable one message per request. This configuration will allow the fluentd plugin and the lamdba function mentioned below to send multiple JSON messages at a time (bulk update), with SumoLogic separating each JSON message into distinct SumoLogic messages for proper aggregation, etc.

One thing to note is I am assuming all the log messages are structured as JSON objects - haven't tested this out with unstructred text messages.

@d-smith
d-smith / avg_time_by_service.txt
Last active December 28, 2025 04:32
Sumo Logic avg service time by service
_sourceCategory="xavisample_logs" AND _sourceName="/Users/a045103/goxavi/src/github.com/xtracdev/xavisample/xs.log" | parse "\"Duration\":*," as service_time_ns | parse "\"Name\":\"*\"," as service_name|timeslice 1m|avg(service_time_ns) by service_name,_timeslice
(_sourceCategory="xavisample_logs" AND _sourceName="/Users/a045103/goxavi/src/github.com/xtracdev/xavisample/xs.log") AND "\"Name\":\"echo-quote\"" | parse "\"Duration\":*," as service_time_ns |timeslice by 1m|service_time_ns/tolong(1000000) as ms|avg(ms) by _timeslice
_collector=vagrant-ubuntu-trusty-64 AND _source = "logs"|json auto | where name = "hotel-quote"|timeslice by 1m|duration/tolong(1000000) as ms|avg(ms) by _timeslice
@d-smith
d-smith / notes.txt
Created December 18, 2015 15:20
Dumping config via expvar
"config dump": "\"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"&{Name:demo-listener RouteNames:[demo-route-1 demo-route-2]}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"&{Name:hello1 Address:localhost Port:3000 PingURI:/hello HealthCheck: HealthCheckInterval:0 HealthCheckTimeout:0}\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"{Name:demo-backend-1 LoadBalancer:0x1880ca70}\\\\\\\\\\\\\\\"&{Name:demo-route-1 URIRoot:/hello Backends:[demo-backend-1] Plugins:[] MultiBackendAdapter: MsgProps:SOAPAction=foo}\\\\\\\"&{Name:hello2 Address:localhost Port:3100 PingURI:/hello HealthCheck: HealthCheckInterval:0 HealthCheckTimeout:0}\\\"{Name:demo-backend-2 LoadBalancer:0x1880cdc0}\"&{Name:
@d-smith
d-smith / guideline-notes.txt
Last active June 17, 2016 20:27
API design guidelines
Principles:
The API's job is to make the developer as successful as possible [1]
Making an easy to consume API is more important that adhering to REST, might want to call it
a Web API or an HTTP API instead of a REST API.
Fundamental Decision:
Are we building a hypermedia API? I think not... are we all on board with that?
Refs:
@d-smith
d-smith / install.txt
Created November 30, 2015 15:19
Node install - docker
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g mountebank
@d-smith
d-smith / api-stuff.txt
Created November 25, 2015 18:05
api stuff
HAL - http://stateless.co/hal_specification.html
JSON-LD - http://json-ld.org/
Collection+JSON - http://amundsen.com/media-types/collection/
SIREN - https://github.com/kevinswiber/siren
JSON API - http://jsonapi.org/
@d-smith
d-smith / multiroute.go
Created November 23, 2015 17:44
multiroute code - prototype
//Package multiroute defines an interface needed for plugins that support routes with multiple backends.
package plugin
import (
"net/http"
"errors"
)
type MultiRouteHandler struct {
backendMap map[string]http.Handler
@d-smith
d-smith / open3000.sh
Created November 10, 2015 22:13
expose ports on ubuntu
#!/bin/sh
sudo ufw allow 3000/tcp