syslog2loki

command module
v0.0.0-...-1072615 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

README

syslog2Loki

syslog2Loki is designed to listen for syslog logs and, based on custom labels, write them into a Grafana Loki log server.

Compatibility

RFC3164/RFC5424/RFC6587
Different protocol versions may have different log labels.

Usage

Config

syslog2Loki uses a configuration file in JSON format. For example:

{
  "SyslogBind": "0.0.0.0:514",
  "LokiServer": "http://192.168.6.17:3100",
  "ScrapeConfig": [
    {
      "Tag": "nginxLog",
      "Labels": {
        "AppName":"Nginx",
        "ServerName": "6.175",
        "OS":"Centos",
        "NgxVersion": "nginx/1.22.1"
      }
    },
    {
      "Tag": "192.168.6.175",
      "Labels": {
        "AppName":"NginxWithIpTag",
        "ServerName": "6.175",
        "OS":"Centos",
        "NgxVersion": "nginx/1.22.1"
      }
    }
  ]
}

Explanation:

SyslogBind:Syslog service listen port.
LokiServer:Grafana loki server url.
ScrapeConfig:
Tag:Syslog tag.You can define or use the sender's IP when sending a syslog. If nothing is defined, the sender's IP will be used as the default tag.
Labels:Custom key-value pairs are used to distinguish different services of the syslog sender.
Build
go build .
Run
Usage of syslog2loki
  -c string
        path of config.json (default "./config.json")

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL