Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zcong1993/docker-logger
docker container logger collector
https://github.com/zcong1993/docker-logger
Last synced: about 23 hours ago
JSON representation
docker container logger collector
- Host: GitHub
- URL: https://github.com/zcong1993/docker-logger
- Owner: zcong1993
- License: mit
- Created: 2018-06-29T10:23:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-29T10:28:22.000Z (over 6 years ago)
- Last Synced: 2024-06-20T02:04:28.292Z (5 months ago)
- Language: Go
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-logger [![Go Report Card](https://goreportcard.com/badge/github.com/zcong1993/docker-logger)](https://goreportcard.com/report/github.com/zcong1993/docker-logger) [![CircleCI branch](https://img.shields.io/circleci/project/github/zcong1993/docker-logger/master.svg)](https://circleci.com/gh/zcong1993/docker-logger/tree/master)
> docker container logger collector
## Usage
### cli
```bash
$ docker-logger
# custom endpoint
$ docker-logger -endpoint "your endpoint"
# ignore container by name
$ docker-logger -ignore foo
```### lib
```go
package mainimport (
"flag"
"fmt"
"github.com/fsouza/go-dockerclient"
"github.com/zcong1993/docker-logger/logger"
)func main() {
var (
endpoint string
ignore string
)
flag.StringVar(&endpoint, "endpoint", "unix:///var/run/docker.sock", "docker endpoint")
flag.StringVar(&ignore, "ignore", "", "ignore container")
flag.Parse()client, err := docker.NewClient(endpoint)
if err != nil {
panic(err)
}lm := logger.NewManager(client, []string{ignore})
ch := lm.Start()for ev := range ch {
fmt.Printf("container: %s - level: %s - %s\n", ev.ContainerName, ev.LogLevel, ev.Log)
}
}
```## License
MIT © zcong1993