Skip to content

logicmonitor/lm-logs-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lm-logs-sdk-go(1.0.0)

Go SDK for sending logs to LogicMonitor

NOTE: This SDK was created for use by LogicMonitor-built log integrations and is not intended to be used or supported otherwise.

// Initialize the library
lmIngest := ingest.Ingest{
	CompanyName: "<<account-name>>",
	AccessID:  "<<accesss-id>>",
	AccessKey: "<<access-key>>",
	LogSource: "<<log-source>>",
	VersionID: "<<version-id>>",
}

// Create logs
logs := []ingest.Log{{
    Message:    "Hello from LogicMonitor!",
    ResourceID: map[string]string{"<<lm-property>>": "<<lm-property-value>>"},
}}


// Send logs to Logic Monitor
ingestResponse, err := lmIngest.SendLogs(logs)
log.Println(ingestResponse) // {"success":true,"message":"Accepted","errors":null,"RequestId":"c952611b-edbf-b670-f94a-9023b38bfdba"}