Skip to content

dougEfresh/zapz

Repository files navigation

Zapz: Uber's Zap --> logzio

Zapz creates a zap.Logger that sends logs to logzio. This creates a custom WriterSync that buffers data on disk and drains every 5 seconds.

Zapz uses logzio-go to transport logs via HTTP

GoDoc Build Status Coverage Status Go Report

Installation

$ go get -u github.com/dougEfresh/zapz

Quick Start

package main

import (
 "os"

 "github.com/dougEfresh/zapz"
   )

func main() {
 l, err := zapz.New(os.Args[1]) //logzio token required
 if err != nil {
   panic(err)
 }

 l.Info("tester")
 // Logs are buffered on disk, this will flush it
 if l.Sync() != nil {
     panic("oops")
 }
}

Getting Started

Get Logzio token

  1. Go to Logzio website
  2. Sign in with your Logzio account
  3. Click the top menu gear icon (Account)
  4. The Logzio token is given in the account page

Usage

Set Debug level: zapz.New(token, zapz.SetLevel(zapcore.DebugLevel))

Set CustomEncoder config: zapz.New(token, zapz.SetEncodeConfig(cfg))

Set Custom log type:

A type field is created by default: zap.String("type", "zap-logger"). You can change it like so zapz.New(token, zapz.SetType(logzType))

Examples

passwd-pot

lambdazap

Prerequisites

go 1.x

Tests

$ go test -v

Contributing

All PRs are welcome

Authors

License

This project is licensed under the Apache License - see the LICENSE file for details

Acknowledgments

logz java

TODO