Coder Social home page Coder Social logo

bobby4k / caddy-redis-logger Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pberkel/caddy-storage-redis

0.0 0.0 0.0 90 KB

LPUSH caddy log to redis

Home Page: https://github.com/bobby4k/caddy-redis-logger

License: Apache License 2.0

Go 100.00%
caddy logger logger-middleware redis caddy-plugin

caddy-redis-logger's Introduction

Redis logger module for Caddy

This plugin sends Caddy logs to Redis using the LPUSH command, allowing other consumers to process the logs.

  • It helps address issues related to centralized log collection and the I/O and storage challenges of keeping logs locally.
  • It's particularly suited for small-scale operations deployed on VPS.
  • In the future, if scaling is needed, you can consider using Redis Cluster or DragonflyDB.

通过本插件,可把caddy日志通过LPUSH发送给redis, 以供其他消费端处理。

  • 它可以解决日志收集中心化、本地日志存储带来的io和容量问题。
  • 比较适合部署在VPS上的小规模业务
  • 未来如果要扩容,可以考虑Redis Cluster或Dragonflydb

Configuration

Simple mode

Enable Redis logger for Caddy by specifying the module configuration in the Caddyfile:

{
    order redis_logger after log
}

:80 {
    route {
        redis_logger my_redis_key {
            redis_address localhost:6379
            redis_password mypassword
            with_request_body
        }
        respond "Hello, World!"
    }
}

Note that address and db values can be configured (or accept the defaults) .

The module supports environment variable substitution within Caddyfile parameters:

{
    redis_logger my_redis_key {
        redis_address        "{$REDIS_ADDRESS}"
        redis_password       "{$REDIS_PASSWORD}"
    }
}

NOTE however the following configuration options also support runtime substition:

  • redis_db // default 0
  • dial_timeout // 连接超时时间 default 5s
  • write_timeout // 写入超时时间 default 3s
  • max_retries // 最大重试次数 default 3

Not support

  • Redis Cluster
  • Failover mode
  • TLS

caddy-redis-logger's People

Contributors

pberkel avatar bobby4k avatar dependabot[bot] avatar tgeoghegan avatar elee1766 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.