Send Logrus logs to Logzio
- Go to Logzio website
- Sign in with your Logzio account
- Click the top menu gear icon (Account)
- The Logzio token is given in the account page
package yourpackagename
import (
"github.com/sirupsen/logrus"
"github.com/bshuster-repo/logruzio"
)
const LOGZIO_TOKEN = "fjdhslGJHSDHG23edg"
func main() {
ctx := logrus.Fields{
"ID": "12adebacd8",
"Version": "1.0.0-dev",
}
hook, err := logruzio.New(LOGZIO_TOKEN, "YourAppName", ctx)
if err != nil {
logrus.Fatal(err)
}
logrus.AddHook(hook)
logrus.Info("Lets go!")
}
NOTE: Set LOGZIO_TOKEN
to the Logzio token as mentioned in Get Logzio token
.