Giter VIP home page Giter VIP logo

tglog's Introduction

tglog

tglog

Realtime log analyzer for NGinx with Telegram notifications

License: MIT Codacy Badge tglog workflow tglog go

General features:

  1. Realtime critical error notification

image

  1. Daily reports (with cron-like scheduler for time customization)

image

  1. Log file export to Excel sheet

image

image

Prerequisites

For build project you must install:

Among other things, you need create a Telegram bot through @botfather and set bot token to tgtoken parameter in your config file.

Quick start

  1. Clone repo, build and install project

    git clone [email protected]:dbkv9/tglog.git
    cd tglog
    make build
    make install
    
  2. Edit default config file in /usr/local/etc/tglog/config.yaml or create new config file with custom path.

    If you want use custom config file path, you must pass it to tglog parameter:

    ./tglog --config /custom/path/to/config.yaml
    

    Config for example:

    projects:
      project1:
        log: "/path/to/project1/log/file"
        host: "https://project1.com/"
        reportschedule: "0 * * * *"
        tgchat: -000000000
        webserver: "nginx"
        format: "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\""
    tgtoken: "XXXXXXXXXXXXX:XXXXXXXXXXX-XXXX-XXXXXXXXXX-XXXX"
    

    This file have next parameters:

    • log - path to log file;
    • host - full host to your website;
    • reportschedule - cron-like scheduler;
    • tgchat - id of your chat for send notification;
    • webserver - now nginx by default;
    • format - format of your log file (currently support only default NGinx access log file format).
  3. Run

    If you want startup tglog without systemd, just type:

    ./tglog
    ## or if you use custom config path
    ./tglog --config /path/to/config.yaml
    

    If you want use systemd, run next commands from tglog directory:

    sudo cp tglog.service /etc/systemd/system/
    sudo systemctl enable tglog.service
    sudo systemctl start tglog.service
    

TODO

  • move config file to linux system folder
  • add systemd support
  • add binaries to git release
  • add Makefile for project building
  • add geoip
  • add robots DNS detector

tglog's People

Contributors

ttywizard avatar dbkv9 avatar

Stargazers

Thomas Harr avatar Alexandr Vasilyev avatar Stefano Borzì avatar sen ✦ avatar Aliaksei avatar Nikita avatar Stefano Scafiti avatar

Watchers

 avatar

tglog's Issues

Ошибка при билде

tglog_error

...
go: downloading golang.org/x/net v0.14.0
go: downloading golang.org/x/text v0.12.0
go: downloading golang.org/x/sys v0.12.0
go: downloading github.com/richardlehane/msoleps v1.0.3

command-line-arguments

src/tglog.go:128:29: undefined: url.JoinPath
src/tglog.go:208:20: day_start.Compare undefined (type time.Time has no field or method Compare)
src/tglog.go:209:12: day_end.Compare undefined (type time.Time has no field or method Compare)
src/tglog.go:400:11: now.Compare undefined (type time.Time has no field or method Compare)
make: *** [Makefile:9: build] Ошибка 2

Add a geoip detecor

to collect more information about request can add geoIP detector, for detect user country

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.