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

[Filebeat] [httpjson] Add support for single string containing multiple relation-types in getRFC5988Link #32811

Merged
merged 4 commits into from
Aug 25, 2022

Conversation

kcreddy
Copy link
Contributor

@kcreddy kcreddy commented Aug 24, 2022

What does this PR do?

Fixes getRFC5988Link to work with header containing single string but multiple relation-types. See #32810

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

cd x-pack/filebeat/input/httpjson ; go test -v -run TestValueTpl
=== RUN   TestValueTpl
=== RUN   TestValueTpl/can_access_Go_types_in_context
=== RUN   TestValueTpl/can_render_values_from_ctx
=== RUN   TestValueTpl/can_render_default_value_if_execute_fails
=== RUN   TestValueTpl/can_render_default_value_if_template_is_empty
=== RUN   TestValueTpl/returns_error_if_result_is_empty_and_no_default_is_set
=== RUN   TestValueTpl/can_render_default_value_if_execute_panics
=== RUN   TestValueTpl/returns_error_if_panics_and_no_default_is_set
=== RUN   TestValueTpl/func_parseDuration
=== RUN   TestValueTpl/func_now
=== RUN   TestValueTpl/func_now_with_duration
=== RUN   TestValueTpl/func_parseDate
=== RUN   TestValueTpl/func_parseDate_defaults_to_RFC3339
=== RUN   TestValueTpl/func_parseDate_with_custom_layout
=== RUN   TestValueTpl/func_formatDate
=== RUN   TestValueTpl/func_formatDate_defaults_to_UTC
=== RUN   TestValueTpl/func_formatDate_falls_back_to_UTC
=== RUN   TestValueTpl/func_parseTimestamp
=== RUN   TestValueTpl/func_parseTimestampMilli
=== RUN   TestValueTpl/func_parseTimestampNano
=== RUN   TestValueTpl/func_getRFC5988Link_single_rel_matches
=== RUN   TestValueTpl/func_getRFC5988Link_multiple_rel_as_seperate_strings_matches
=== RUN   TestValueTpl/func_getRFC5988Link_multiple_rel_as_seperate_strings_in_random_order_matches
=== RUN   TestValueTpl/func_getRFC5988Link_multiple_rel_as_single_string_matches
=== RUN   TestValueTpl/func_getRFC5988Link_multiple_rel_as_single_string_in_random_order_matches
=== RUN   TestValueTpl/func_getRFC5988Link_does_not_match
=== RUN   TestValueTpl/func_getRFC5988Link_empty_header
=== RUN   TestValueTpl/can_execute_functions_pipeline
=== RUN   TestValueTpl/func_toInt
=== RUN   TestValueTpl/func_add
=== RUN   TestValueTpl/func_mul
=== RUN   TestValueTpl/func_div
=== RUN   TestValueTpl/func_sha1_hmac_Hex
=== RUN   TestValueTpl/func_sha256_hmac_Hex
=== RUN   TestValueTpl/func_invalid_hmac_Hex
=== RUN   TestValueTpl/func_sha1_hash_Hex_empty
=== RUN   TestValueTpl/func_sha1_hash_Hex
=== RUN   TestValueTpl/func_sha256_hash_Hex
=== RUN   TestValueTpl/func_invalid_hash_Hex
=== RUN   TestValueTpl/func_base64Encode_2_strings
=== RUN   TestValueTpl/func_base64Encode_no_value
=== RUN   TestValueTpl/func_hexDecode_string
=== RUN   TestValueTpl/func_hexDecode_empty_string
=== RUN   TestValueTpl/func_invalid_hexDecode_string
=== RUN   TestValueTpl/func_join
=== RUN   TestValueTpl/func_sprintf
=== RUN   TestValueTpl/func_sha1_hmac_Base64
=== RUN   TestValueTpl/func_sha256_hmac_Base64
=== RUN   TestValueTpl/func_invalid_hmac_Base64
=== RUN   TestValueTpl/func_sha1_empty
=== RUN   TestValueTpl/func_sha1_hash_Base64
=== RUN   TestValueTpl/func_sha256_hash_Base64
=== RUN   TestValueTpl/func_invalid_hmac_Base64#01
=== RUN   TestValueTpl/func_base64Decode_2_strings
=== RUN   TestValueTpl/func_base64Decode_no_value
=== RUN   TestValueTpl/func_userAgent_no_values
=== RUN   TestValueTpl/func_userAgent_blank_value
=== RUN   TestValueTpl/func_userAgent_1_value
=== RUN   TestValueTpl/func_userAgent_2_value
=== RUN   TestValueTpl/func_beatInfo_GOOS
=== RUN   TestValueTpl/func_beatInfo_Arch
=== RUN   TestValueTpl/func_beatInfo_Commit
=== RUN   TestValueTpl/func_beatInfo_Build_Time
=== RUN   TestValueTpl/func_beatInfo_Version
=== RUN   TestValueTpl/func_urlEncode_blank
=== RUN   TestValueTpl/func_urlEncode_URL_Safe
=== RUN   TestValueTpl/func_urlEncode_URL_Safe#01
--- PASS: TestValueTpl (0.00s)
    --- PASS: TestValueTpl/can_access_Go_types_in_context (0.00s)
    --- PASS: TestValueTpl/can_render_values_from_ctx (0.00s)
    --- PASS: TestValueTpl/can_render_default_value_if_execute_fails (0.00s)
    --- PASS: TestValueTpl/can_render_default_value_if_template_is_empty (0.00s)
    --- PASS: TestValueTpl/returns_error_if_result_is_empty_and_no_default_is_set (0.00s)
    --- PASS: TestValueTpl/can_render_default_value_if_execute_panics (0.00s)
    --- PASS: TestValueTpl/returns_error_if_panics_and_no_default_is_set (0.00s)
    --- PASS: TestValueTpl/func_parseDuration (0.00s)
    --- PASS: TestValueTpl/func_now (0.00s)
    --- PASS: TestValueTpl/func_now_with_duration (0.00s)
    --- PASS: TestValueTpl/func_parseDate (0.00s)
    --- PASS: TestValueTpl/func_parseDate_defaults_to_RFC3339 (0.00s)
    --- PASS: TestValueTpl/func_parseDate_with_custom_layout (0.00s)
    --- PASS: TestValueTpl/func_formatDate (0.00s)
    --- PASS: TestValueTpl/func_formatDate_defaults_to_UTC (0.00s)
    --- PASS: TestValueTpl/func_formatDate_falls_back_to_UTC (0.00s)
    --- PASS: TestValueTpl/func_parseTimestamp (0.00s)
    --- PASS: TestValueTpl/func_parseTimestampMilli (0.00s)
    --- PASS: TestValueTpl/func_parseTimestampNano (0.00s)
    --- PASS: TestValueTpl/func_getRFC5988Link_single_rel_matches (0.00s)
    --- PASS: TestValueTpl/func_getRFC5988Link_multiple_rel_as_seperate_strings_matches (0.00s)
    --- PASS: TestValueTpl/func_getRFC5988Link_multiple_rel_as_seperate_strings_in_random_order_matches (0.00s)
    --- PASS: TestValueTpl/func_getRFC5988Link_multiple_rel_as_single_string_matches (0.00s)
    --- PASS: TestValueTpl/func_getRFC5988Link_multiple_rel_as_single_string_in_random_order_matches (0.00s)
    --- PASS: TestValueTpl/func_getRFC5988Link_does_not_match (0.00s)
    --- PASS: TestValueTpl/func_getRFC5988Link_empty_header (0.00s)
    --- PASS: TestValueTpl/can_execute_functions_pipeline (0.00s)
    --- PASS: TestValueTpl/func_toInt (0.00s)
    --- PASS: TestValueTpl/func_add (0.00s)
    --- PASS: TestValueTpl/func_mul (0.00s)
    --- PASS: TestValueTpl/func_div (0.00s)
    --- PASS: TestValueTpl/func_sha1_hmac_Hex (0.00s)
    --- PASS: TestValueTpl/func_sha256_hmac_Hex (0.00s)
    --- PASS: TestValueTpl/func_invalid_hmac_Hex (0.00s)
    --- PASS: TestValueTpl/func_sha1_hash_Hex_empty (0.00s)
    --- PASS: TestValueTpl/func_sha1_hash_Hex (0.00s)
    --- PASS: TestValueTpl/func_sha256_hash_Hex (0.00s)
    --- PASS: TestValueTpl/func_invalid_hash_Hex (0.00s)
    --- PASS: TestValueTpl/func_base64Encode_2_strings (0.00s)
    --- PASS: TestValueTpl/func_base64Encode_no_value (0.00s)
    --- PASS: TestValueTpl/func_hexDecode_string (0.00s)
    --- PASS: TestValueTpl/func_hexDecode_empty_string (0.00s)
    --- PASS: TestValueTpl/func_invalid_hexDecode_string (0.00s)
    --- PASS: TestValueTpl/func_join (0.00s)
    --- PASS: TestValueTpl/func_sprintf (0.00s)
    --- PASS: TestValueTpl/func_sha1_hmac_Base64 (0.00s)
    --- PASS: TestValueTpl/func_sha256_hmac_Base64 (0.00s)
    --- PASS: TestValueTpl/func_invalid_hmac_Base64 (0.00s)
    --- PASS: TestValueTpl/func_sha1_empty (0.00s)
    --- PASS: TestValueTpl/func_sha1_hash_Base64 (0.00s)
    --- PASS: TestValueTpl/func_sha256_hash_Base64 (0.00s)
    --- PASS: TestValueTpl/func_invalid_hmac_Base64#01 (0.00s)
    --- PASS: TestValueTpl/func_base64Decode_2_strings (0.00s)
    --- PASS: TestValueTpl/func_base64Decode_no_value (0.00s)
    --- PASS: TestValueTpl/func_userAgent_no_values (0.00s)
    --- PASS: TestValueTpl/func_userAgent_blank_value (0.00s)
    --- PASS: TestValueTpl/func_userAgent_1_value (0.00s)
    --- PASS: TestValueTpl/func_userAgent_2_value (0.00s)
    --- PASS: TestValueTpl/func_beatInfo_GOOS (0.00s)
    --- PASS: TestValueTpl/func_beatInfo_Arch (0.00s)
    --- PASS: TestValueTpl/func_beatInfo_Commit (0.00s)
    --- PASS: TestValueTpl/func_beatInfo_Build_Time (0.00s)
    --- PASS: TestValueTpl/func_beatInfo_Version (0.00s)
    --- PASS: TestValueTpl/func_urlEncode_blank (0.00s)
    --- PASS: TestValueTpl/func_urlEncode_URL_Safe (0.00s)
    --- PASS: TestValueTpl/func_urlEncode_URL_Safe#01 (0.00s)
PASS
ok      github.com/elastic/beats/v7/x-pack/filebeat/input/httpjson      1.806s

Related issues

@kcreddy kcreddy requested a review from a team as a code owner August 24, 2022 14:51
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 24, 2022
@kcreddy kcreddy marked this pull request as draft August 24, 2022 14:51
@mergify
Copy link
Contributor

mergify bot commented Aug 24, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @kcreddy? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 24, 2022
@kcreddy kcreddy added Filebeat Filebeat needs_team Indicates that the issue/PR needs a Team:* label labels Aug 24, 2022
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 24, 2022
@botelastic
Copy link

botelastic bot commented Aug 24, 2022

This pull request doesn't have a Team:<team> label.

@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 24, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-08-25T12:37:15.312+0000

  • Duration: 70 min 25 sec

Test stats 🧪

Test Results
Failed 0
Passed 2210
Skipped 166
Total 2376

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@kcreddy kcreddy marked this pull request as ready for review August 25, 2022 10:40
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@kcreddy kcreddy changed the title [Filebeat] [httpjson] Fix getRFC5988Link when single string contains multiple relation-types [Filebeat] [httpjson] Add support for single string containing multiple relation-types in getRFC5988Link Aug 25, 2022
@kcreddy kcreddy added the backport-v8.4.0 Automated backport with mergify label Aug 25, 2022
@kcreddy kcreddy merged commit 9cab775 into elastic:main Aug 25, 2022
mergify bot pushed a commit that referenced this pull request Aug 25, 2022
…le relation-types in getRFC5988Link (#32811)

* case with single string but multiple rel

* misspell lint error

* Add ascii doc

(cherry picked from commit 9cab775)
kcreddy added a commit that referenced this pull request Aug 25, 2022
…le relation-types in getRFC5988Link (#32811) (#32866)

* case with single string but multiple rel

* misspell lint error

* Add ascii doc

(cherry picked from commit 9cab775)

Co-authored-by: Krishna Chaitanya Reddy Burri <[email protected]>
v1v added a commit to v1v/beats that referenced this pull request Sep 1, 2022
…ackaging

* upstream/main: (109 commits)
  Add cap_net_raw requirements to heartbeat docs (elastic#32816)
  apply a quick hotfix for having main working properly (elastic#32934)
  action: checks for x-pack/libbeat and libbeat (elastic#32754)
  Update to Go 1.18 in go.mod. (elastic#32940)
  [heartbeat] disable browser code on windows via build tags (elastic#32939)
  action: checks for heartbeat and x-pack/heartbeat (elastic#32749)
  Make event acknowledgment asynchronous in shipper output (elastic#32785)
  [Automation] Update elastic stack version to 8.5.0-fedc3e60 for testing (elastic#32930)
  Preallocate memory to reduce GC load (elastic#32905)
  [Automation] Update elastic stack version to 8.5.0-440e0896 for testing (elastic#32919)
  Skip broken ceph tests. (elastic#32912)
  Use non-deprecated docker image for testing jolokia (elastic#32885)
  update ironbank image product name (elastic#32867)
  ci: pre-commit stage within Jenkins (elastic#32839)
  Fix a couple of bugs in the logic for how AWS metric periods are calculated (elastic#32724)
  [Filebeat] [httpjson] Add support for single string containing multiple relation-types in getRFC5988Link (elastic#32811)
  [Heartbeat] Update HB k8s template to use <Mi> metric (elastic#32801)
  action: checks for metricbeat and x-pack/metricbeat (elastic#32748)
  action: checks for filebeat and x-pack/filebeat (elastic#32746)
  allow for json/ndjson content type with charset (elastic#32767)
  ...
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
…le relation-types in getRFC5988Link (#32811)

* case with single string but multiple rel

* misspell lint error

* Add ascii doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.4.0 Automated backport with mergify bugfix Filebeat Filebeat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filebeat input httpjson getRFC5988Link doesn't work with single string with multiple relation-types
3 participants