daxxog / gopher-squeeze

log streaming experiment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gopher Squeeze

log streaming experiment

Gopher Squeeze is a program written in Go that takes input from STDIN in chunks, compresses the data with gzip, and sends it to an HTTP endpoint. The server receives the compressed data, decompresses it, and logs it to STDOUT.

Requirements

  • Go 1.20 or higher

Installation

  1. Clone the repository:

    git clone https://github.com/daxxog/gopher-squeeze.git
  2. Navigate to the project directory:

    cd gopher-squeeze
  3. Build the client and server binaries:

    make

Usage

Server

  1. Set the WEBHOOK_SECRET environment variable with the desired secret value:

    export WEBHOOK_SECRET=your-secret
    export WEBHOOK_LISTEN=127.0.0.1:8000
  2. Start the server:

    ./gopher-squeeze
  3. The server will start listening on localhost:8000 (default). It will receive the compressed data, decompress it, and log it to STDOUT.

Client

  1. Set the WEBHOOK_ENDPOINT environment variable with the same secret value used for the server:

    export WEBHOOK_ENDPOINT=http://localhost:8000/log/your-secret
  2. Pipe the input data to the client binary:

    cat input.txt | ./gopher-squeeze
  3. The client will read the input from STDIN in chunks, compress each chunk with gzip, and send it to the server. It will receive a response from the server (optional) and log it to STDOUT.

License

This project is licensed under the Apache License Version 2.0. See the LICENSE file for details.

About

log streaming experiment

License:Apache License 2.0


Languages

Language:Makefile 45.2%Language:Go 30.0%Language:Dockerfile 24.8%