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] Value of cursor is not being set in the first call in the chained calls #33213

Closed
yug-rajani opened this issue Sep 28, 2022 · 9 comments · Fixed by #33664
Assignees
Labels

Comments

@yug-rajani
Copy link
Contributor

@elasticmachine
Copy link
Collaborator

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

@ShourieG ShourieG removed the Team:Service-Integrations Label for the Service Integrations team label Oct 28, 2022
@ShourieG ShourieG self-assigned this Oct 28, 2022
@ShourieG
Copy link
Contributor

@yug-elastic thanks for bringing this up. Will be creating a PR to fix this soon. What's the urgency for this and what's the current impact ?

@yug-rajani
Copy link
Contributor Author

@yug-elastic thanks for bringing this up. Will be creating a PR to fix this soon. What's the urgency for this and what's the current impact ?

@ShourieG, thanks for helping out!

The salesforce filebeat module is in production, which should be impacted by this, and the main issue that is being caused there is duplication of the ingested documents. I have created a separate issue to track it (#33212), but there might be other integrations/modules (leveraging httpjson chained calls mechanism) which might be impacted because of this issue.

As far as the urgency is concerned, @rameshelastic or @lalit-satapathy from the @elastic/obs-service-integrations team should be able to help you out with it based on their planning.

@ShourieG
Copy link
Contributor

ShourieG commented Nov 3, 2022

@yug-elastic can you provide the config for httpjson that is causing this behaviour. I've spoken to @lalit-satapathy on this, and reproducing the issue for httpjson would help us fix it.

@ShourieG
Copy link
Contributor

ShourieG commented Nov 7, 2022

@yug-elastic do you have any update on this ?

@kush-elastic
Copy link
Collaborator

Hey @ShourieG ,
Sorry for the delay. here is the httpjson config file for the chained calls where you can reproduce this same issue. let me know if you need anything apart from this.

filebeat.inputs:
- type: httpjson
  interval: 20s
  request.method: GET
  auth.oauth2:
    enabled: true
    client.id: {{ client_id }}
    client.secret: {{ client_secret }}
    token_url: {{ token_url }}
    user: {{ user }}
    password: {{ password }}
  request.url: {{ url }}/services/data/v52.0/query?q=login+rest
  request.proxy_url: {{ proxy_url }}
  request.transforms:
    - set:
        target: url.params.q
        value: "SELECT Id,CreatedDate,LogDate,LogFile FROM EventLogFile WHERE Interval = 'Hourly' AND EventType = 'Login' AND CreatedDate > [[.cursor.last_published_login]] ORDER BY CreatedDate ASC NULLS FIRST"
        default: "SELECT Id,CreatedDate,LogDate,LogFile FROM EventLogFile WHERE Interval = 'Hourly' AND EventType = 'Login' ORDER BY CreatedDate ASC NULLS FIRST"
  response.split:
    target: body.records
  chain:
    - step:
        request.url: {{ url }}/services/data/v52.0/sobjects/EventLogFile/$.records[:].Id/LogFile
        request.method: GET
        replace: $.records[:].Id
  cursor:
    last_published_login:
      value: '[[.last_event.CreatedDate]]'

ShourieG added a commit to ShourieG/beats that referenced this issue Nov 14, 2022
ShourieG added a commit that referenced this issue Nov 17, 2022
…33664)

* added bugfix for duplicate data issue #33213

* updated with PR suggetions

* updated comments

* re-engineered bugfix to update cursors properly

* spelling fix
@SpencerLN
Copy link
Contributor

@ShourieG is there any chance of backporting this fix to 8.6?

@ShourieG
Copy link
Contributor

ShourieG commented Nov 21, 2022

@SpencerLN This has already been merged for the 8.6 release, so no issues.

@SpencerLN
Copy link
Contributor

@ShourieG I could be missing something obvious here, but I don't see the commit in the 8.6 branch: https://github.com/elastic/beats/tree/8.6/x-pack/filebeat/input/httpjson

mergify bot pushed a commit that referenced this issue Nov 22, 2022
…33664)

* added bugfix for duplicate data issue #33213

* updated with PR suggetions

* updated comments

* re-engineered bugfix to update cursors properly

* spelling fix

(cherry picked from commit afb2beb)
ShourieG added a commit that referenced this issue Nov 23, 2022
…33664) (#33767)

* added bugfix for duplicate data issue #33213

* updated with PR suggetions

* updated comments

* re-engineered bugfix to update cursors properly

* spelling fix

(cherry picked from commit afb2beb)

Co-authored-by: ShourieG <[email protected]>
chrisberkhout pushed a commit that referenced this issue Jun 1, 2023
…33664)

* added bugfix for duplicate data issue #33213

* updated with PR suggetions

* updated comments

* re-engineered bugfix to update cursors properly

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

Successfully merging a pull request may close this issue.

5 participants