If this is your first time working with logging, we recommend starting with our Logging guides.
Explore documentation
Get started with logging
Introduction
Better Stack allows you to collect logs across your stack, be it from your node.js app or a Kubernetes cluster, and centralize them into one place. But it's not just storage. With Better Stack, you can live tail and query your logs with blazing speeds using SQL. You can build actionable dashboards and explore all the insights your logs have to give.
On top of that, you can configure presence/absence alerts and get notified whenever there is an issue. All that while collaborating with your colleagues by commenting on specific log fragments and sharing links.
Starting with centralized logging
To start logging, we need to connect a source to our Better Stack account. A source is a service that generates logs which are then sent to Better Stack, for example, an application or a web server.
Step 1: Create a source
- Go to Better Stack β Sources.
- Click Connect source.
- Then name your source (name can be changed later)
- Then select the type of the source you are connecting. For example, if you are integrating Better Stack into a Node application, select "Node.js". Logs will be then automatically parsed based on the platform.
Step 2: Test the pipes
You can now test the pipes to see if the Logs are arriving correctly. For this, you will need a Source token. Every source has a unique source token that identifies it and is used to connect the actual source to Better Stack.
- Go to Sources β your source β Configure.
- Copy the Source token from the Basic information section.
curl -X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer $SOURCE_TOKEN' \
-d '{"dt":"'"$(date -u +'%Y-%m-%d %T UTC')"'","message":"Hello from Better Stack!"}' \
-k \
https://in.logs.betterstack.com
Now, navigate to Live tail. You'll see a log message like this:
{
"dt":"2022-06-15 11:24:09.000 UTC",
"message_string":"Hello from Better Stack!"
}
Amazing job! π
You have just sent your first log message.
Next steps to enhance your logging setup πββοΈ
Now that Better Stack is set up to receive your logs, you can integrate it into your applications.
The integration setup depends on where you want to collect logs from. Here are guides for the most popular sources:
Source not listed here?
Check out Logs sources in the left sidebar for the full list of available sources.