Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP appender / Possible to write custom Headers #252

Closed
jeantristan opened this issue Nov 22, 2022 · 1 comment
Closed

HTTP appender / Possible to write custom Headers #252

jeantristan opened this issue Nov 22, 2022 · 1 comment
Labels
Todo: Publish Gem Need to publish a new gem with this change

Comments

@jeantristan
Copy link

Environment

Provide at least:

  • Ruby Version : 3.0
  • Semantic Logger Version : 4.12
  • Application/framework names and versions : Rails 6.1
  • Rails Semantic Logger Version, : 4.11

Expected Behavior

I want to use Logtail. It's possible to send log data with HTTPS calls using this structure:

curl -X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer mytoken' \
-d '{"dt":"'"$(date -u +'%Y-%m-%d %T UTC')"'","message":"Hello from Logtail!"}' \
-k \
https://in.logtail.com

I tried some things like:

SemanticLogger.add_appender(
   appender:  :http,
   url:       "https://in.logtail.com",
   headers:    "Bearer mytoken",
   formatter: formatter
 )

However, I am not able to do it. I've read the documentation. I have seen no option. I also check the source code. But I did not manage to find a solution

Actual Behavior

Use HTTP appender with Authorization headers.

@reidmorrison
Copy link
Owner

Agreed, does not look like that appender allows the header to be customized.

Does not look hard to do if you want to submit a pull request, passing in an optional header hash, and then ensuring the internal header settings don't overwrite the supplied values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Todo: Publish Gem Need to publish a new gem with this change
Projects
None yet
Development

No branches or pull requests

2 participants