Skip to content

A log transporter which polls messages from STAN and sends them to loggly

Notifications You must be signed in to change notification settings

meinside/stan-loggly-transporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stan-loggly-transporter

A log transporter which polls messages from STAN and sends them to loggly.

build

$ git clone github.com/meinside/stan-loggly-transporter
$ cd stan-loggly-transporter
$ go build

configure

Duplicate the sample config file and edit it:

$ cp config.json.sample config.json
$ vi config.json
{
	"stanClusterId": "my-stan-cluster-id",
	"stanClientId": "this-client-id",
	"natsServers": [
		"tls://localhost:4242",
		"tls://localhost:4243"
	],
	"natsClientUsername": "USER",
	"natsClientPasswd": "PASSWORD",
	"natsClientCertPath": "/path/to/certs/cert.pem",
	"natsClientKeyPath": "/path/to/certs/key.pem",
	"natsRootCaPath": "/path/to/certs/ca.pem",

	"logSubject": "logmsgs.loggly",

	"logglyToken": "0123-4567-abcd"
}

Edit values to yours.

how to run

run it directly

$ ./stan-loggly-transporter

or,

run it with systemd

Copy systemd service file and edit it:

$ sudo cp systemd/stan-loggly-transporter.service /lib/systemd/stan-loggly-transporter.service
$ sudo vi /lib/systemd/stan-loggly-transporter.service
[Unit]
Description=STAN-to-Loggly Log Transporter
Wants=stan.service
After=network.target syslog.target stan.service

[Service]
Type=simple
User=some_user
Group=some_user
WorkingDirectory=/path/to/stan-loggly-transporter
ExecStart=/path/to/stan-loggly-transporter/stan-loggly-transporter
Restart=always
RestartSec=5
Environment=

[Install]
WantedBy=multi-user.target

then enable/start it:

$ sudo systemctl enable stan-loggly-transporter.service
$ sudo systemctl start stan-loggly-transporter.service

how to log messages

Send messages with the same subject name in the config.json file. (eg. "logmsgs.loggly")

You can see a sample logger application here.

license

MIT

About

A log transporter which polls messages from STAN and sends them to loggly

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages