A short survey of log collection options and why you picked the wrong one. 😜
I'm Steve Coffman and I work at Ithaka. We do JStor (academic journals) and other stuff. How big is it?
Number | what it means |
---|---|
101,332,633 | unique visitors in 2017 |
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
# https://unix.stackexchange.com/a/10065 | |
# if stdout is a terminal | |
if test -t 1; then | |
# see if it supports colors | |
ncolors=$(tput colors) | |
if test -n "$ncolors" && test $ncolors -ge 8; then | |
bold="$(tput bold)" | |
underline="$(tput smul)" | |
standout="$(tput smso)" | |
normal="$(tput sgr0)" |
Responding to requests via simple route matching is built in to Go's net/http
standard library package. Just register the path prefixes and callbacks you want invoked and then call the ListenAndServe
to have the default request handler invoked on each request. For example:
package main
import (
Exhaustive list of SPDX (Software Package Data Exchange) licenses: https://spdx.org/licenses/
FROM ubuntu:16.04 | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
ca-certificates \ | |
apt-transport-https \ | |
openjdk-8-jre-headless \ | |
curl \ | |
xz-utils \ | |
unzip \ | |
bzip2 \ |
[Unit] | |
Description=Puma HTTP Server | |
After=network.target | |
# Uncomment for socket activation (see below) | |
# Requires=puma.socket | |
[Service] | |
# Foreground process (do not use --daemon in ExecStart or config.rb) | |
Type=simple |
# problem: when presenting, I want to obscure | |
# my prompt to act like it's at root of file system | |
# and be very basic with no git info, etc. | |
# solution: this theme lets you set a ENV to the path | |
# of your presentation, which will help remove unneeded prompt | |
# features while in that path | |
# oh-my-zsh theme for presenting demos | |
# based off the default rubbyrussell theme |