项目作者: moemoe89

项目描述 :
🤟 This repo for practicing ELK using Golang (Echo Framework), Docker, Circle CI and Codecov
高级语言: Go
项目地址: git://github.com/moemoe89/go-elk-hiro.git
创建时间: 2020-02-28T08:21:09Z
项目社区:https://github.com/moemoe89/go-elk-hiro

开源协议:MIT License

下载


CircleCI
codecov
Go Report Card

GO-ELK-HIRO

Practicing ELK Stack Using Golang (Echo Framework) as Programming Language, ELK (Elasticsearch Logstash Kibana) as Service

Directory structure

Your project directory structure should look like this

  1. + your_gopath/
  2. |
  3. +--+ src/github.com/moemoe89
  4. | |
  5. | +--+ go-elk-hiro/
  6. | |
  7. | +--+ main.go
  8. | + api/
  9. | + routers/
  10. | + ... any other source code
  11. |
  12. +--+ bin/
  13. | |
  14. | +-- ... executable file
  15. |
  16. +--+ pkg/
  17. |
  18. +-- ... all dependency_library required

Setup and Build

  • Setup Golang https://golang.org
  • Setup ELK Stack https://www.elastic.co
  • Under $GOPATH, do the following command :
    1. $ mkdir -p src/github.com/moemoe89
    2. $ cd src/github.com/moemoe89
    3. $ git clone <url>
    4. $ mv <cloned directory> go-elk-hiro

Running Application

Make config file for local :

  1. $ cp config-sample.json config.json

Build

  1. $ go build

Run

  1. $ go run main.go

How to Run with Docker

Make config file for docker :

  1. $ cp config-sample.json config.json

Build

  1. $ docker-compose build

Run

  1. $ docker-compose up

Stop

  1. $ docker-compose down

How to Test the Log

Make some log by hit the endpoints :

  1. $ curl localhost:8788/error
  2. $ curl localhost:8788/info
  3. $ curl localhost:8788/warn

Navigate kibana on your browser :

  1. localhost:5601