A log transporter which polls messages from STAN and sends them to loggly.
$ git clone github.com/meinside/stan-loggly-transporter
$ cd stan-loggly-transporter
$ go build
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.
$ ./stan-loggly-transporter
or,
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
Send messages with the same subject name in the config.json
file.
(eg. "logmsgs.loggly")
You can see a sample logger application here.
MIT