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

upstream: Improve error message for misconfigured HTTP_PROXY variable #9328

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

lecaros
Copy link
Contributor

@lecaros lecaros commented Sep 2, 2024

Added specific messages for errors inside the function flb_utils_proxy_url_split().
Removed the call to flb_errno() since errors are displayed by flb_utils_proxy_url_split.

Fixes #9327


Testing
Before we can approve your change; please submit the following in a comment:

Fluent Bit v3.2.0
* Copyright (C) 2015-2024 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _           _____  __  
|  ___| |                | |   | ___ (_) |         |____ |/  | 
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __   / /`| | 
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / /   \ \ | | 
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /.___/ /_| |_
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/ \____(_)___/

[2024/09/02 14:51:40] [ info] Configuration:
[2024/09/02 14:51:40] [ info]  flush time     | 1.000000 seconds
[2024/09/02 14:51:40] [ info]  grace          | 5 seconds
[2024/09/02 14:51:40] [ info]  daemon         | 0
[2024/09/02 14:51:40] [ info] ___________
[2024/09/02 14:51:40] [ info]  inputs:
[2024/09/02 14:51:40] [ info]      dummy
[2024/09/02 14:51:40] [ info] ___________
[2024/09/02 14:51:40] [ info]  filters:
[2024/09/02 14:51:40] [ info] ___________
[2024/09/02 14:51:40] [ info]  outputs:
[2024/09/02 14:51:40] [ info]      stdout.0
[2024/09/02 14:51:40] [ info]      http.1
[2024/09/02 14:51:40] [ info] ___________
[2024/09/02 14:51:40] [ info]  collectors:
[2024/09/02 14:51:40] [ info] [fluent bit] version=3.2.0, commit=c69a6dfe9b, pid=1711
[2024/09/02 14:51:40] [debug] [engine] coroutine stack size: 36864 bytes (36.0K)
[2024/09/02 14:51:40] [ info] [storage] ver=1.1.6, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2024/09/02 14:51:40] [ info] [cmetrics] version=0.9.5
[2024/09/02 14:51:40] [ info] [ctraces ] version=0.5.5
[2024/09/02 14:51:40] [ info] [input:dummy:dummy.0] initializing
[2024/09/02 14:51:40] [ info] [input:dummy:dummy.0] storage_strategy='memory' (memory only)
[2024/09/02 14:51:40] [debug] [dummy:dummy.0] created event channels: read=21 write=22
[2024/09/02 14:51:40] [debug] [stdout:stdout.0] created event channels: read=23 write=24
[2024/09/02 14:51:40] [debug] [http:http.1] created event channels: read=30 write=31
[2024/09/02 14:51:40] [ info] [input] pausing dummy.0
[2024/09/02 14:51:40] [debug] [upstream] config->http_proxy: hostname.domain.tld
[2024/09/02 14:51:40] [ info] [output:stdout:stdout.0] worker #0 started
[2024/09/02 14:51:40] [error] HTTP_PROXY variable must be set in the form of 'http://[username:password@]host:port'
[2024/09/02 14:51:40] [error] [output] failed to initialize 'http' plugin
[2024/09/02 14:51:40] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2024/09/02 14:51:40] [error] [engine] output initialization failed
[2024/09/02 14:51:40] [ info] [output:stdout:stdout.0] thread worker #0 stopped
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Current documentation is correct.

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@edsiper
Copy link
Member

edsiper commented Sep 5, 2024

@lecaros thanks for this PR.

please change the commit prefix here:

  • upstream: remove call to flb_errno(). The error is displayed by flb_utils_proxy_url_split()
  • flb_utils: improve error messaging inside the flb_utils_proxy_url_split()
  • flb_utils: fix typos

flb_utils needs to be changed to utils

@lecaros lecaros changed the title flb_upstream: Improve error message for misconfigured HTTP_PROXY variable upstream: Improve error message for misconfigured HTTP_PROXY variable Sep 5, 2024
@lecaros
Copy link
Contributor Author

lecaros commented Sep 5, 2024

Thanks @edsiper
Changes done.

@edsiper edsiper merged commit ff8803f into master Sep 27, 2024
47 checks passed
@edsiper edsiper deleted the improve-error-message branch September 27, 2024 14:17
@edsiper
Copy link
Member

edsiper commented Sep 27, 2024

note: this PR was done against master, we need one for branch 3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error message for misconfigured http_proxy is misleading
2 participants