Skip to content

Latest commit

 

History

50 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logzio Golang API client

Sends logs to logz.io over HTTP

GoDoc Build Status Coverage Status Go Report

Installation

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

Quick Start

package main

import (
"fmt"
"github.com/dougEfresh/logzio-go"
"os"
"time"
)

func main() {
  l, err := logzio.New(os.Args[1]) // Token is required
  if err != nil {
    panic(err)
  }
  msg := fmt.Sprintf("{ \"%s\": \"%s\"}", "message", time.Now().UnixNano())

  err = l.Send([]byte(msg))
  if err != nil {
     panic(err)
  }

  l.Stop() //logs are buffered on disk. Stop will drain the buffer
}

logzio sender is a low level lib meant to be integrated with other logging libs

Usage

Setting drain duration (flush logs on disk) : logzio.New(token, SetDrainDuration(time.Hour))

Setting url mode: logzio.New(token, SetUrl(ts.URL))

Setting debug mode: logzio.New(token, SetDebug(os.Stderr))

Setting queue dir: logzio.New(token, SetSetTempDirectory(os.Stderr))

Disk queue

Logzio go client uses goleveldb and goqueue as a persistent storage. Every 5 seconds logs are sent to logz.io (if any are available)

Examples

Uber Zap: zapz

GO kit: kitz

Prerequisites

go 1.x

Tests

$ go test -v

See travis.yaml for running benchmark tests

Deployment

Contributing

All PRs are welcome

Authors

License

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

Acknowledgments

TODO

About

Low level go client for Logz

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages