To begin logging, you first need to link a log source to your LogFire account. A log source is a service that generates logs which are then transmitted to LogFire, such as an application or a web server.

Step 1: Create a Source

image

Navigate to LogFire → Sources. Click on “Create source.”

Assign a name to your source (you can modify this later). Choose the type of source (platform) you’re connecting. For instance, if you’re incorporating LogFire into a Django application, select “Python” as platform. This will ensure logs are automatically parsed according to the platform.

Step 2: Test the Connection

Test the connection to ensure that logs are being received correctly. Each source has a unique source token used for this purpose.

Go to Sources → your source → Configure. image Copy the Source token from the Basic Information section.

Use the following command to send logs to LogFire:


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 LogFire!"}' \
-k \
https://in.logfire.ai

Replace $SOURCE_TOKEN with your actual source token.

Explore the following sections to learn how to add different Source Platforms: