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

Get all query parameters from http server source #21321

Open
uricorin opened this issue Sep 19, 2024 · 0 comments
Open

Get all query parameters from http server source #21321

uricorin opened this issue Sep 19, 2024 · 0 comments

Comments

@uricorin
Copy link

Use cases

Hi everyone.
We're using vector to aggregate HTTP requests. Currently, query parameters must be specified, by name, or they won't be outputted.

There's no easy way to support requests with varying arguments.

References

Discussion on a similar issue #16396

Solution

I've updated the code to output all query parameters, as a string, to field query_parameters_string.
A configuration variable, all_qp, enables this functionality - It's off by default.

Here's an example configuration:

  sources:
    http:
      type: http_server
      address: 127.0.0.1:8080
      encoding: json
      headers:
        - "*"
      method: POST
      path: /mypath/
      response_code: 200
      all_qp: true # Toggle on

  transforms:
    enriched_http:
      type: remap
      inputs:
        - http
      source: |-
        .params = parse_query_string!(.query_parameters_string)
  sinks:
    # Debug http
    stdout:
      type: console
      inputs: [enriched_http]
      encoding:
        codec: json    

Proposal

I'd like to contribute this change back to the upstream project.
If you approve opening a PR I'd appreciate suggestions regarding functionality and testing.

Notes

The Heroku Logplex and http server sources reuse functions so this change will add the capability to both.

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

No branches or pull requests

1 participant