All Projects → digitalocean → Captainslog

digitalocean / Captainslog

Licence: mpl-2.0
A Syslog Protocol Parser

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Captainslog

Python Coloredlogs
Colored terminal output for Python's logging module
Stars: ✭ 408 (+213.85%)
Mutual labels:  logging, syslog
Docker Logger
Logs collector for docker
Stars: ✭ 126 (-3.08%)
Mutual labels:  logging, syslog
Flowgger
A fast data collector in Rust
Stars: ✭ 606 (+366.15%)
Mutual labels:  logging, syslog
Console
OS X console application.
Stars: ✭ 298 (+129.23%)
Mutual labels:  logging, syslog
Logtrail
Kibana plugin to view, search & live tail log events
Stars: ✭ 1,343 (+933.08%)
Mutual labels:  logging, syslog
Analog
PHP logging library that is highly extendable and simple to use.
Stars: ✭ 314 (+141.54%)
Mutual labels:  logging, syslog
Graylog2 Server
Free and open source log management
Stars: ✭ 5,952 (+4478.46%)
Mutual labels:  logging, syslog
Semantic logger
Semantic Logger is a feature rich logging framework, and replacement for existing Ruby & Rails loggers.
Stars: ✭ 611 (+370%)
Mutual labels:  logging, syslog
Logbert
Logbert is an advanced log message viewer for log4net, log4j and others.
Stars: ✭ 70 (-46.15%)
Mutual labels:  logging, syslog
Nim Morelogging
Logging library for Nim
Stars: ✭ 29 (-77.69%)
Mutual labels:  logging, syslog
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (+5.38%)
Mutual labels:  logging, syslog
Rsyslog
a Rocket-fast SYStem for LOG processing
Stars: ✭ 1,385 (+965.38%)
Mutual labels:  logging, syslog
Documentation
Stars: ✭ 133 (+2.31%)
Mutual labels:  logging, syslog
Go Syslog
Blazing fast syslog parser
Stars: ✭ 370 (+184.62%)
Mutual labels:  logging, syslog
Rsyslog
An R interface to syslog, the POSIX system logger API
Stars: ✭ 21 (-83.85%)
Mutual labels:  logging, syslog
Punt
Punt is a tiny and lightweight daemon which helps ship logs to Elasticsearch.
Stars: ✭ 98 (-24.62%)
Mutual labels:  logging, syslog
Syslog Ng
syslog-ng is an enhanced log daemon, supporting a wide range of input and output methods: syslog, unstructured text, queueing, SQL & NoSQL.
Stars: ✭ 1,555 (+1096.15%)
Mutual labels:  logging, syslog
Fluentd
Fluentd: Unified Logging Layer (project under CNCF)
Stars: ✭ 10,807 (+8213.08%)
Mutual labels:  logging
Abseil Py
Abseil Common Libraries (Python)
Stars: ✭ 1,785 (+1273.08%)
Mutual labels:  logging
Zoya
Truly highly composable logging utility
Stars: ✭ 116 (-10.77%)
Mutual labels:  logging

captainslog Build Status Doc Status

Construct, emit, and parse Syslog messages.

Usage

Create a captainslog.SyslogMsg from RF3164 bytes:

b := []byte("<191>2006-01-02T15:04:05.999999-07:00 host.example.org test: engage\n")
msg, err := captainslog.NewSyslogMsgFromBytes(b)
if err != nil {
	panic(err)
}

Create a captainslog.SyslogMsg by setting its fields:

msg := captainslog.NewSyslogMsg()
msg.SetFacility(captainslog.Local7)
msg.SetSeverity(captainslog.Err)

msgTime, err := time.Parse("2006 Jan 02 15:04:05", "2017 Aug 15 16:18:34")
if err != nil {
	t.Error(err)
}

msg.SetTime(msgTime)
msg.SetProgram("myprogram")
msg.SetPid("12")
msg.SetHost("host.example.com")

captainslog.NewSyslogMsg accepts the following functional options (note: these may also be passed to SyslogMsg.Bytes() and SyslogMsg.String):

captainslog.OptionUseLocalFormat tells SyslogMsg.String() and SyslogMsg.Byte() to format the message to be compatible with writing to /dev/log rather than over the wire.

captainslog.OptionUseRemoteFormat tells SyslogMsg.String() and SyslogMsg.Byte() to use wire format for the message instead of local format.

Serialize a captainslog.SyslogMsg to RFC3164 bytes:

b := msg.Bytes()

Create a captainslog.Parser and parse a message:

p := captainslog.NewParser(<options>)
msg, err := p.ParseBytes([]byte(line)

Both captainslog.NewSyslogMsgFromBytes and captainslog.NewParser accept the following functional arguments:

captainslog.OptionNoHostname sets the parser to not expect the hostname as part of the syslog message, and instead ask the host for its hostname.

captainslog.OptionDontParseJSON sets the parser to not parse JSON in the content field of the message. A subsequent call to SyslogMsg.String() or SyslogMsg.Bytes() will then use SyslogMsg.Content for the content field, unless SyslogMsg.JSONValues have been added since the message was originally parsed. If SyslogMsg.JSONValues have been added, the call to SyslogMsg.String() or SyslogMsg.Bytes() will then parse the JSON, and merge the results with the keys in SyslogMsg.JSONVaues.

captainslog.OptionUseGJSONParser uses the tidwall/gjson parser to parse JSON in the content field of the message. This may improve parsing performance.

captainslog.OptionLocation is a helper function to configure the parser to parse time in the given timezone, If the parsed time contains a valid timezone identifier this takes precedence. Default timezone is UTC.

Contibution Guidelines

We use the Collective Code Construction Contract for the development of captainslog. For details, see CONTRIBUTING.md.

License

Copyright 2016 DigitalOcean

Captainslog is released under the Mozilla Public License, version 2.0

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].