Links

Quick Start

Publish your first event.

Setup your Project

LogSnag uses projects to give you a workspace for each of your applications. Within a project, you may create as many channels to organize your events in any way you choose.
To get started, create your first project and channel. In this example, I have called my project my-website and my first channel user-register
The project and channel values should be lowercase! Alphabet characters, digits, and dashes "-" are accepted. Validation Regex: ^[a-z0-9]+(?:-[a-z0-9]+)*$

Copy your API token

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error. Head to the API page under Settings, then create and copy a new API token.
Important: If you're using LogSnag within a public-facing website or client application. Please ensure to set your Token's access level to "Public" and limit its roles to a specific project and channel.

Publish your first event

Now you can publish your first event to LogSnag. To do so, make a POST request to the log endpoint. Once you have published your event, it will show up in the LogSnag App in real-time, and you will receive a push notification if you have set the notify flag to true.
post
https://api.logsnag.com/v1/
log
Publish an event to LogSnag.
Take a look at an example for publishing events.
cURL
Python
JavaScript
NodeJS
Deno
curl --location --request POST 'https://api.logsnag.com/v1/log' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"project": "my-website",
"channel": "user-register",
"event": "User Registered",
"description": "email: [email protected]",
"icon": "🔥",
"notify": true,
"tags": {
"email": "[email protected]",
"uid": "uid1234"
}
}'
pip3 install logsnag
from logsnag import LogSnag
logsnag = LogSnag(token='<TOKEN>', project='<PROJECT>')
logsnag.publish(
channel="user-register",
event="User Registered",
description="email: [email protected]",
icon="🔥",
notify=True,
tags={
"email": "[email protected]",
"uid": "uid1234",
}
)
<script src="https://cdn.logsnag.com/js/0.1.6/ls.js"></script>
const logsnag = new window.LogSnag({
token: '<TOKEN>',
project: '<PROJECT>',
})
logsnag.publish({
channel: "user-register",
event: "User Registered",
description: "email: [email protected]",
icon: "🔥",
notify: true,
tags: {
uid: "uid1234"
}
})
.then(result => console.log(result))
.catch(error => console.log(error));
npm install logsnag
import { LogSnag } from 'logsnag';
const logsnag = new LogSnag({
token: '<TOKEN>',
project: '<PROJECT>',
})
await logsnag.publish({
channel: "user-register",
event: "User Registered",
description: "email: [email protected]",
icon: "🔥",
notify: true,
tags: {
uid: "uid1234"
}
})
import { LogSnag } from 'https://cdn.logsnag.com/deno/0.1.7/index.ts';
const logsnag = new LogSnag({
token: '<TOKEN>',
project: '<PROJECT>',
})
await logsnag.publish({
channel: "user-register",
event: "User Registered",
description: "email: [email protected]",
icon: "🔥",
notify: true,
tags: {
uid: "uid1234"
}
})
Check out the Log endpoint to learn more.

Publish your first Insight

Insights are tiny widgets you may set up in any way you want. They always represent the latest value and update in real-time. They are great for tracking KPIs, service status, metrics, etc.
post
https://api.logsnag.com/v1
/insight
Publish an insight to LogSnag.
Take a look at an example for publishing insights.
cURL
Python
JavaScript
NodeJS
Deno
curl --location --request POST 'https://api.logsnag.com/v1/insight' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"project": "my-website",
"title": "User Count",
"value": "12,500",
"icon": "🧑"
}'
pip3 install logsnag
1
from logsnag import LogSnag
2
3
logsnag = LogSnag(token='<TOKEN>', project='<PROJECT>')
4
5
logsnag.insight(
6
title='User Count',
7
value=1234,
8
icon='👨',
9
)
<script src="https://cdn.logsnag.com/js/0.1.6/ls.js"></script>
const logsnag = new window.LogSnag({
token: '<TOKEN>',
project: '<PROJECT>',
})
logsnag.insight({
title: "User Count",
value: 1234,
icon: "🧑"
})
.then(result => console.log(result))
.catch(error => console.log(error));
npm install logsnag
import { LogSnag } from 'logsnag';
const logsnag = new LogSnag({
token: '<TOKEN>',
project: '<PROJECT>',
})
await logsnag.insight({
title: "User Count",
value: 1234,
icon: "🧑"
})
import { LogSnag } from 'https://cdn.logsnag.com/deno/0.1.7/index.ts';
const logsnag = new LogSnag({
token: '<TOKEN>',
project: '<PROJECT>',
})
await logsnag.insight({
title: "User Count",
value: 1234,
icon: "🧑"
})
Check out the Insight endpoint to learn more.