Skip to content

Smiie-2/Pretty-Caddy-Logs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Pretty Caddy Logs

A simple Bash script to view and stream Dockerized Caddy logs in a clean, colorized, and filtered format using jq.

Overview

When running Caddy in Docker, the default logs can be hard to read or cluttered with specific repetitive messages. Pretty Caddy Logs provides a streamlined way to:

  • Stream logs in real-time.
  • Colorize JSON output for better readability.
  • Seamlessly handle both JSON and plain-text (e.g., startup errors or s6-rc logs).
  • Filter out common noise.

Use Case

This script is ideal for developers and sysadmins who want a "pretty" tail of their Caddy logs without manually typing complex docker logs | jq pipes every time. It's especially useful for debugging configuration issues where you need to see both the container's startup output (text) and Caddy's structured logs (JSON).

Key Features

  • No sudo Required: Works with your standard user (provided you are in the docker group).
  • Smart Filtering: Automatically hides "aborting with incomplete response" messages which often clutter logs during normal HTTP/2 or WebSocket operations.
  • Hybrid Log Support: Uses try/catch in jq to print raw strings if the log line isn't valid JSON, ensuring you don't miss critical startup or system errors.
  • Colorized Output: High-contrast log viewing.

Prerequisites

  • Docker: The container must be named Caddy (or you can edit the script to match your container name).
  • jq: A lightweight and flexible command-line JSON processor.

Installation

  1. Clone this repository:

    git clone https://github.com/Smiie-2/Pretty-Caddy-Logs.git
    cd Pretty-Caddy-Logs
  2. Make the script executable:

    chmod +x caddy_jq_log.sh

Usage

Simply run the script:

./caddy_jq_log.sh

To exit the stream, press Ctrl+C.


Note: Ensure your Caddy container is named Caddy or modify the docker logs -f Caddy line in the script to match your environment.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages