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

help: input: Handle listen to be a parameter for setting up listen address #8952

Conversation

cosmo0920
Copy link
Contributor

Before this commit, fluent-bit -J produces the incorrect schema for listen address for ip.
host should be used for specifing to hostname.
And, listen parameter should be used for setting up for listen address.

This is because the following lines in flb_input.c:

    else if (prop_key_check("listen", k, len) == 0) {
        flb_utils_set_plugin_string_property("listen", &ins->host.listen, tmp);
    }
    else if (prop_key_check("host", k, len) == 0) {
        flb_utils_set_plugin_string_property("host", &ins->host.name, tmp);
    }

Set up for listen address and hostname respectively. And the host member is typed as struct flb_net_host whose definition is:

struct flb_input_instance {
/* snip */
    /*
     * Input network info:
     *
     * An input plugin can be specified just using it shortname or using the
     * complete network address format, e.g:
     *
     *  $ fluent-bit -i cpu -o plugin://hostname:port/uri
     *
     * where:
     *
     *   plugin   = the output plugin shortname
     *   name     = IP address or hostname of the target
     *   port     = target TCP port
     *   uri      = extra information that may be used by the plugin
     */
    struct flb_net_host host;
/* snip */
};

Then, the type of struct flb_net_host should be:

/* Defines a host service and it properties */
struct flb_net_host {
    int ipv6;              /* IPv6 required ?        */
    flb_sds_t address;     /* Original address       */
    int port;              /* TCP port               */
    flb_sds_t name;        /* Hostname               */
    flb_sds_t listen;      /* Listen interface       */
    struct flb_uri *uri;   /* Extra URI parameters   */
};

So, the usage and generating for host and listen parameters are inverted
and I have to add a host config_map for DNS resolutions.


Enter [N/A] in the box, if an item is not applicable to your change.

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

  • Example configuration file for the change
  • 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

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.

…en address

Before this commit, fluent-bit -J produces the incorrect schema for
listen address for ip.
host should be used for specifing to hostname.
And, listen parameter should be used for setting up for listen address.

This is because the following lines in flb_input.c:
```c
    else if (prop_key_check("listen", k, len) == 0) {
        flb_utils_set_plugin_string_property("listen", &ins->host.listen, tmp);
    }
    else if (prop_key_check("host", k, len) == 0) {
        flb_utils_set_plugin_string_property("host", &ins->host.name, tmp);
    }
```

Set up for listen address and hostname respectively.
And the host member is typed as struct flb_net_host whose definition is:
```c
struct flb_input_instance {
/* snip */
    /*
     * Input network info:
     *
     * An input plugin can be specified just using it shortname or using the
     * complete network address format, e.g:
     *
     *  $ fluent-bit -i cpu -o plugin://hostname:port/uri
     *
     * where:
     *
     *   plugin   = the output plugin shortname
     *   name     = IP address or hostname of the target
     *   port     = target TCP port
     *   uri      = extra information that may be used by the plugin
     */
    struct flb_net_host host;
/* snip */
};
```

Then, the type of struct flb_net_host should be:
```c
/* Defines a host service and it properties */
struct flb_net_host {
    int ipv6;              /* IPv6 required ?        */
    flb_sds_t address;     /* Original address       */
    int port;              /* TCP port               */
    flb_sds_t name;        /* Hostname               */
    flb_sds_t listen;      /* Listen interface       */
    struct flb_uri *uri;   /* Extra URI parameters   */
};
```

So, the usage and generating for host and listen parameters are inverted
and I have to add a host config_map for DNS resolutions.

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@cosmo0920 cosmo0920 changed the title help: input: Correct listen should be a parameter for setting up listen address help: input: Handle listen to be a parameter for setting up listen address Jun 13, 2024
@cosmo0920 cosmo0920 marked this pull request as ready for review June 13, 2024 05:28
@edsiper edsiper merged commit 72a543e into master Jun 13, 2024
48 checks passed
@edsiper edsiper deleted the cosmo0920-fix-incorrect-schema-for-network-related-parameters-in-input-plugins branch June 13, 2024 13:26
@edsiper
Copy link
Member

edsiper commented Jun 13, 2024

thank you

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

Successfully merging this pull request may close these issues.

2 participants