• Stars
    star
    306
  • Rank 135,663 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created over 3 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple web service for storing text log files

logpaste

CircleCI Docker Pulls License

A minimalist web service for uploading and sharing log files.

LogPaste animated demo

Features

  • Accept text uploads from command-line, JavaScript, and web UI
  • Simple to deploy
    • Runs in a single Docker container
    • Fits in the free tier of Heroku
  • Easy database management
    • Syncs persistent data to any S3-compatible cloud storage provider
  • Customizable UI without changing source code

Demo

Run LogPaste

From source

PORT=3001 go run cmd/logpaste/main.go

From Docker

To run LogPaste within a Docker container, mount a volume from your local system to store the LogPaste sqlite database.

docker run \
  -e "PORT=3001" \
  -p 3001:3001/tcp \
  --volume "${PWD}/data:/app/data" \
  --name logpaste \
  mtlynch/logpaste

From Docker + cloud data replication

If you specify settings for an S3 bucket, LogPaste will use Litestream to automatically replicate your data to S3.

You can kill the container and start it later, and it will restore your data from the S3 bucket and continue as if there was no interruption.

LITESTREAM_ACCESS_KEY_ID=YOUR-ACCESS-ID
LITESTREAM_SECRET_ACCESS_KEY=YOUR-SECRET-ACCESS-KEY
LITESTREAM_REGION=YOUR-REGION
DB_REPLICA_URL=s3://your-bucket-name/db

docker run \
  -e "PORT=3001" \
  -e "LITESTREAM_ACCESS_KEY_ID=${LITESTREAM_ACCESS_KEY_ID}" \
  -e "LITESTREAM_SECRET_ACCESS_KEY=${LITESTREAM_SECRET_ACCESS_KEY}" \
  -e "LITESTREAM_REGION=${LITESTREAM_REGION}" \
  -e "DB_REPLICA_URL=${DB_REPLICA_URL}" \
  -p 3001:3001/tcp \
  --name logpaste \
  mtlynch/logpaste

Some notes:

  • Only run one Docker container for each S3 location
    • LogPaste can't sync writes across multiple instances.

With custom site settings

LogPaste offers some options to customize the text for your site. Here's an example that uses a custom title, subtitle, and footer:

SITE_TITLE="My Cool Log Pasting Service"
SITE_SUBTITLE="Upload all your logs for FooBar here"
SITE_FOOTER="<h2>Notice</h2><p>Only cool users can share logs here.</p>"
SITE_DARK_MODE="true"
SITE_SHOW_DOCUMENTATION="false" # Hide usage information from homepage
PER_MINUTE_LIMIT="5" # Allow only 5 pastes per minute per IP

docker run \
  -e "PORT=3001" \
  -e "SITE_TITLE=${SITE_TITLE}" \
  -e "SITE_SUBTITLE=${SITE_SUBTITLE}" \
  -e "SITE_FOOTER=${SITE_FOOTER}" \
  -e "SITE_DARK_MODE=${SITE_DARK_MODE}" \
  -e "SITE_SHOW_DOCUMENTATION=${SITE_SHOW_DOCUMENTATION}" \
  -e "PER_MINUTE_LIMIT=${PER_MINUTE_LIMIT}" \
  -p 3001:3001/tcp \
  --name logpaste \
  mtlynch/logpaste

Parameters

Command-line flags

Flag Meaning Default Value
-title Title to display on homepage "LogPaste"
-subtitle Subtitle to display on homepage "A minimalist, open-source debug log upload service"
-footer Footer to display on homepage (may include HTML)
-darkmode Whether to use dark mode theme on homepage false
-showdocs Whether to display usage documentation on homepage true
-perminutelimit Number of pastes to allow per IP per minute 0 (no limit)

Docker environment variables

You can adjust behavior of the Docker container by passing these parameters with docker run -e:

Environment Variable Meaning
PORT TCP port on which to listen for HTTP connections (defaults to 3001)
PS_BEHIND_PROXY Set to y if running behind an HTTP proxy to improve logging
SITE_TITLE Value to set the -title command-line flag
SITE_SUBTITLE Value to set the -subtitle command-line flag
SITE_FOOTER Value to set the -footer command-line flag
SITE_DARK_MODE Value to set the -darkmode command-line flag
SITE_SHOW_DOCUMENTATION Value to set the -showdocs command-line flag
PER_MINUTE_LIMIT Value to set the -perminutelimit command-line flag
DB_REPLICA_URL S3 URL where you want to replicate the LogPaste datastore (e.g., s3://mybucket.mydomain.com/db)
LITESTREAM_REGION AWS region where your S3 bucket is located
LITESTREAM_ACCESS_KEY_ID AWS access key ID for an IAM role with access to the bucket where you want to replicate data.
LITESTREAM_SECRET_ACCESS_KEY AWS secret access key for an IAM role with access to the bucket where you want to replicate data.

Docker build args

If you rebuild the Docker image from source, you can adjust the build behavior with docker build --build-arg:

Build Arg Meaning Default Value
litestream_version Version of Litestream to use for data replication v0.3.9

Deployment

LogPaste is easy to deploy to cloud services. Here are some places it works well:

Further reading

More Repositories

1

picoshare

A minimalist, easy-to-host service for sharing images and other files
Go
2,011
star
2

whatgotdone

A tool for sharing weekly task updates with teammates.
Go
136
star
3

key-mime-pi

Use your Raspberry Pi as a remote-controlled keyboard that accepts keystrokes through a web browser.
Python
101
star
4

hello-world-cypress

A simple example of using Cypress.io for end-to-end testing
Go
54
star
5

mtlynch.io

Source for mtlynch.io, a blog about technology and entrepreneurship.
HTML
43
star
6

resticpy

Minimal Python wrapper around the restic backup command-line interface.
Python
41
star
7

process-home-videos

Helper scripts for processing home videos and uploading them to MediaGoblin
Python
36
star
8

pre-vue

A template for building pre-rendered web apps with Vue + Nuxt
Vue
30
star
9

mediagoblin-docker

Docker image for MediaGoblin, adapted from https://notabug.org/dachary/mediagoblin-docker
Dockerfile
22
star
10

zfs-encrypted-backup

Shell
18
star
11

python3_seed

A boilerplate Python 3 project
Shell
17
star
12

docker-sia

An unofficial Docker image for Sia [Deprecated as of 2020-04-02]
Dockerfile
16
star
13

zestful-client

Python
14
star
14

mediagoblin

Python
10
star
15

ansible-role-key-mime-pi

Ansible role for installing key-mime-pi service
Shell
9
star
16

beancount-chase-bank

Beancount importer for Chase bank
Python
9
star
17

mtlynch-backup

The Python script I use to back up my data with restic
Python
8
star
18

ansible-role-sia

Ansible role for the Sia distributed storage network
Shell
7
star
19

social-go

A Go parser for various social media handles and URLs
Go
6
star
20

sia_metrics_collector

Python
6
star
21

ansible-role-clipbucket

An Ansible role for the Clipbucket video platform
Python
6
star
22

plausible-proxy

Reverse proxy for Plausible Analytics, implemented as Google Cloud Function
Go
5
star
23

sia_load_tester

https://blog.spaceduck.io/sia-load-test-preview/
Python
5
star
24

beancount-mercury

Beancount importer for Mercury Startup Checking
Python
4
star
25

gofn-prosper

Go bindings for the Prosper P2P Lending API
Go
4
star
26

hello-world-vue-pre-rendered

A basic example of a website generated with Vue + Nuxt using pre-rendering.
Vue
4
star
27

stripe-snooping-example

A proof of concept of the snooping behavior of Stripe's official JavaScript library
Vue
3
star
28

ansible-role-litestream

Role for installing the Litestream sqlite replication tool
Jinja
3
star
29

docker-flask-upload-demo

Dockerfile
3
star
30

ansible-role-storj

An Ansible role for the Storj distributed storage network
Shell
3
star
31

customize-rpi

Customize a redistributable Raspberry Pi image
Shell
3
star
32

ketohub_raw_spider

Python
3
star
33

slide-decks

Nix
3
star
34

zig-c-simple

Simple example of calling C code from Zig
Zig
3
star
35

docker-cypress

Dockerfile
3
star
36

simple-encrypt

Python
2
star
37

prosperbot

An automated Prosper peer to peer lending bot
Go
2
star
38

dummy_file_generator

Python
2
star
39

python_seed

A boilerplate Python 2 project
Shell
2
star
40

process-hit-the-front-page

Process videos from Hit the Front Page of Hacker News
Shell
2
star
41

chat_unifier

Python
2
star
42

screenjournal

Like Goodreads but for couch potatoes
Go
2
star
43

rss-proxy

Go
2
star
44

dummy-appengine-demo

Python
2
star
45

eth-zvm

An implementation of the Ethereum virtual machine in pure Zig.
Zig
2
star
46

migrate-mtlynch-to-hugo

A quick 'n dirty script to migrate the Jekyll-based mtlynch.io to Hugo
Python
1
star
47

hid-formatter

HTML
1
star
48

godot-platformer-1

Just playing around with Godot Engine
GDScript
1
star
49

appengine-python-seed

Python
1
star
50

sia_timestamp_dumper

Dumps block timestamps from Sia
Python
1
star
51

docker-gifsicle

Dockerfile
1
star
52

ketohub_web_app

TypeScript
1
star
53

ndt-raspi-viz

HTML
1
star
54

docker-godot

Dockerized image for Godot Game Engine
Dockerfile
1
star
55

picoshare-fly-debug

Deploy a dev environment to Fly.io for debugging PicoShare
Dockerfile
1
star
56

simpleauth

A simple Go authentication and session management library for web apps.
Go
1
star
57

zestful-frontend2

Demo page for the Zestful ingredient parser (using Vue + Nuxt)
Vue
1
star
58

dev-scripts

Canonical version of my best dev scripts for automating programming tasks
Shell
1
star
59

syncthing-fly.io

Deploy a syncthing instance to fly.io
1
star
60

show-and-tell-code-of-conduct

Ruby
1
star
61

docker-syncthing

Unofficial Docker image of syncthing
Dockerfile
1
star
62

docker-protractor

Dockerfile
1
star
63

prosperbot-frontend

Go
1
star
64

google-analytics-v4-example

A basic example of using the Google Analytics Core Reporting v4 API
Go
1
star
65

free-usage-videos

A collection of public domain / Creative Commons videos
1
star
66

ansible-role-nginx-rtmp

Shell
1
star