All Projects → un000 → tailor

un000 / tailor

Licence: MIT license
Tailor, the library for tailing logs under logrotate, written in go.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to tailor

logtail
logtail is a log tailing utility, support tailing multiple commands output stream, transferring matching content to file/webhook(like dingtalk)
Stars: ✭ 33 (-5.71%)
Mutual labels:  log, tail
Laravel Tail
An artisan command to tail your application logs
Stars: ✭ 587 (+1577.14%)
Mutual labels:  log, tail
logs-monitor
An application like Linux tail for Windows. Using Windows FindFirstChangeNotification API to monitoring file changes.
Stars: ✭ 43 (+22.86%)
Mutual labels:  log, tail
Flow
A realtime log analyzer
Stars: ✭ 69 (+97.14%)
Mutual labels:  log, tail
TailLog
实时日志(tail log)查看监控客户端工具
Stars: ✭ 79 (+125.71%)
Mutual labels:  log, tail
Open Log Viewer
A multi-platform log viewer built with Electron and styled with Material Design
Stars: ✭ 125 (+257.14%)
Mutual labels:  log, tail
log-master
split the log
Stars: ✭ 28 (-20%)
Mutual labels:  log
clue
a extremely high performance log library for android. 高性能的Android日志库
Stars: ✭ 27 (-22.86%)
Mutual labels:  log
Klog
🎼 A Kotlin log lib, making the output log more elegant and more beautiful.
Stars: ✭ 21 (-40%)
Mutual labels:  log
RFKit
Toolkit for daily Cocoa development. Since 2012.
Stars: ✭ 20 (-42.86%)
Mutual labels:  log
fast log
Rust async log High-performance asynchronous logging
Stars: ✭ 104 (+197.14%)
Mutual labels:  log
XLog
一个简易的日志打印框架(支持打印策略自定义,默认提供2种策略:logcat打印和磁盘打印)
Stars: ✭ 33 (-5.71%)
Mutual labels:  log
ULog
Unified cross-platform logging framework for C, C++, Objective-C, Swift, ASL and C#.
Stars: ✭ 13 (-62.86%)
Mutual labels:  log
kuafu
This is a tool library that includes log, fsm, state machine...
Stars: ✭ 83 (+137.14%)
Mutual labels:  log
CocoaLogKit
Log framework based on CocoaLumberjack and ZipArchive
Stars: ✭ 17 (-51.43%)
Mutual labels:  log
slack-backup
Make copy of slack converstaions
Stars: ✭ 15 (-57.14%)
Mutual labels:  log
fakessh
A dockerized fake SSH server honeypot written in Go that logs login attempts.
Stars: ✭ 42 (+20%)
Mutual labels:  log
sprout
Golang logging library supporting log retrieval.
Stars: ✭ 85 (+142.86%)
Mutual labels:  log
logging
mod: zap logging in golang
Stars: ✭ 44 (+25.71%)
Mutual labels:  log
bk-log
蓝鲸日志平台是为了解决运维场景中查询日志难的问题而推出的一款SaaS,基于业界主流的全文检索引擎,通过蓝鲸智云的专属agent进行日志采集,无需登录各台机器,集中管理所有日志。
Stars: ✭ 102 (+191.43%)
Mutual labels:  log

Tailor, the library for tailing logs under logrotate

Go Doc Sourcegraph Go Report Card

Tailor provides the functionality of tailing for e. g. nginx logs under logrotate. Tailor will follow a selected log file and reopen it if it's been rotated. Now, tailor doesn't require inotify, because it polls logs with a tiny delay. So the library can achieve cross-platform.

There is no plan to implement truncate detection.

Currently this library is used in production, handling 5k of opened files with a load over 100k rps per instance, without such overhead. Actual usage

Install

go get github.com/un000/tailor

Features

  • Tail files from any offsets
  • Reopening on logrotate
  • Rate limiter + support custom rate limiters
  • Leaky bucket
  • Performant helpers to trim or convert bytes to string
  • Lag monitoring

Example

package main

import (
	"context"
	"fmt"
	"io"
	"time"

	"github.com/un000/tailor"
)

func main() {
	t := tailor.New(
		"./github.com_access.log",
		tailor.WithSeekOnStartup(0, io.SeekStart),
		tailor.WithPollerTimeout(10*time.Millisecond),
	)

	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()

	err := t.Run(ctx)
	if err != nil {
		panic(err)
	}

	fmt.Println("Tailing file:", t.FileName())
	for {
		select {
		case line, ok := <-t.Lines():
			if !ok {
				return
			}

			fmt.Println(line.StringTrimmed())
		case err, ok := <-t.Errors():
			if !ok {
				return
			}

			panic(err)
		}
	}
}

Contributions are appreciated, feel free ✌️

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].