Logentries Docs

Find comprehensive guides and documentation to help you start and continue to work with Logentries.


Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Logentries provides direct support using bsphere’s GoLang library.


Log in to Logentries and create a new log by clicking the Add New Log button. Now click Manual Configuration button from the list of options. Give your log a name of your choice, select Token TCP and finally click the Register new log button. A token will be displayed in green. Please record it as we will use it later to configure the library.

Install the GoLang Library

Navigate to your GoLang /go/src directory in your Terminal (you can use your $GOPATH/<your path>). Enter go get github.com/bsphere/le_go in the Terminal. This will download the GoLang library for Logentries into your PKG folder (under the following path go/pkg/linux_amd_64/github.com/bsphere/le_go.a). It will also download the files into your go/src/github.com/bsphere/le_go. The github.com folder should be in the same root directory as your GoLang project to allow your program to access the GoLang Logentries libraries upon building your project. If your $GOPATH is setup correctly this will all be automatically stored

Insert your logging code

package main

import ( 
func main() {
 le, err := le_go.Connect("########-####-####-####-##########") // replace #s with your log token

 if err != nil {
 defer le.Close()
 le.Println("Logentries test log message")
 le.Println("{\"events\": { \"count\":10} }")

Replace LOGENTRIES TOKEN with the token we copied earlier. It connects this logger with that file on Logentries. If you haven’t taken note of the token when creating your log, you can retrieve it by logging in to Logentries. Once logged in, select the host containing the log for which you want to retrieve the token (e.g. from the side bar on the left hand side of the page). All the token-based logs of this host are then displayed with a Token icon on the right hand side. Click this icon to display the token.

Build your go program with the appropriate $GOPATH for your program.

$GOPATH/src/<unique_name.com>/user/<your_program_name> go install

Run your program


Your Logs should appear in your specified log on your Logentries account.