Question

Log forwarding from functions to logtail/Better Stack throws 401

I set up a function with the following project.yml file

packages:
  - name: sample
    actions:
      - name: hello
        runtime: 'python:default'
environment:
  LOG_DESTINATIONS: '[{"logtail":{"token":"MY_SOURCE_TOKEN"}}]'

When executing the function I get the following error

2025-04-26T11:43:54.97811523Z  stderr: Failed to flush logs: failed to ingest log line, code: 401

A curl using the token works tho

curl -X POST "https://s1287463.eu-nbg-2.betterstackdata.com" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer MY_SOURCE_TOKEN" \
-d '{"message":"Test from curl"}'

Does anybody have an idea how I could investigate the issue?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

The support was super helpful and we solved it. Choose “Digital Ocean” as Platform on logtail/Better Stack instead of “HTTP”. Documentation still says “HTTP”. So that’s what confused me.

Bobby Iliev
Site Moderator
Site Moderator badge
April 28, 2025

Hi there,

I could suggest double-checking the MY_SOURCE_TOKEN value to make sure that it is correct and that it does not have any whitespaces for example.

If everything looks right and it’s still failing, it’s worth reaching out to the DigitalOcean Support to double-check if there’s an issue on their side.

- Bobby

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.