Skip to content

[salesforce] Add salesforce package foundation along with login_rest data stream #4261

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

Merged
merged 23 commits into from
Dec 6, 2022

Conversation

yug-rajani
Copy link
Contributor

@yug-rajani yug-rajani commented Sep 21, 2022

  • Enhancement

What does this PR do?

  • Generated the skeleton of Salesforce integration package.
  • Added 1 data stream ( login_rest )
  • Added data collection logic.
  • Added the ingest pipelines.
  • Mapped fields according to the ECS schema and added Fields metadata in the appropriate yml files.
  • Added system test cases.

sf

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • If I'm introducing a new feature, I have modified the Kibana version constraint in my package's manifest.yml file to point to the latest Elastic stack release (e.g. ^7.13.0).

How to test this PR locally

  • Clone integrations repo.
  • Install elastic-package locally.
  • Start elastic stack using elastic-package.
  • Move to integrations/packages/salesforce directory.
  • Run the following command to run tests.

elastic-package test

image

@yug-rajani yug-rajani added enhancement New feature or request Team:Service-Integrations Label for the Observability Service Integrations team Integration:salesforce Salesforce labels Sep 21, 2022
@yug-rajani yug-rajani self-assigned this Sep 21, 2022
@yug-rajani yug-rajani linked an issue Sep 21, 2022 that may be closed by this pull request
8 tasks
@elasticmachine
Copy link

elasticmachine commented Sep 21, 2022

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@elasticmachine
Copy link

elasticmachine commented Sep 21, 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-12-05T07:15:58.067+0000

  • Duration: 15 min 46 sec

Test stats 🧪

Test Results
Failed 0
Passed 6
Skipped 0
Total 6

🤖 GitHub comments

Expand to view the GitHub comments

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

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Sep 21, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 100.0% (1/1) 💚 3.0
Classes 100.0% (1/1) 💚 3.0
Methods 100.0% (14/14) 💚 12.903
Lines 95.339% (225/236) 👍 3.407
Conditionals 100.0% (0/0) 💚

@yug-rajani yug-rajani changed the title Add salesforce package foundation along with login_rest data stream [salesforce] Add salesforce package foundation along with login_rest data stream Sep 27, 2022
@yug-rajani yug-rajani marked this pull request as ready for review October 3, 2022 05:49
Copy link
Contributor

@kush-elastic kush-elastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@agithomas
Copy link
Contributor

agithomas commented Oct 13, 2022

If specifying the version is important, then below questions apply

  • Will the salesforce version that supports /services/data/v54.0/query endpoint support /services/data/v53.0/query
  • What is the difference between v54 and v53? Are these endpoints not available in v53. If these endpoints are available in v53, integration can be said it supports v53 as well. Isn’t it so?
  • What is the relationship between the salesforce product version and API version?
  • Does API version increment with minor version upgrade or major version upgrade?
  • What is the step a user of salesforce must follow to find out the version of salesforce they are using?
  • What is the step a user of salesforce must follow to find out the API VERSION of salesforce they are using?
  • Will the users of Salesforce always be using the latest version of Salesforce?

@yug-rajani
Copy link
Contributor Author

If specifying the version is important, then below questions apply

  • Will the salesforce version that supports /services/data/v54.0/query endpoint support /services/data/v53.0/query

Yes, it should. The deployment logic associated with the old version is still available for use as long as you force the API to use the old version (reference).

  • What is the difference between v54 and v53? Are these endpoints not available in v53. If these endpoints are available in v53, integration can be said it supports v53 as well. Isn’t it so?

Technically, it must be supported in 53.0. We tested the version 52.0 when we developed the Filebeat Module (which was the latest stable version then), while we tested it with the latest stable version now (based on Workbench) i.e. 54.0 when developing the current integration for Salesforce. However, we are hard-coding the version and hence using the API v53.0 wouldn't be possible here.

  • What is the relationship between the salesforce product version and API version?

Whenever Salesforce releases a new application version, Salesforce internally updates the API version (reference).

  • Does API version increment with minor version upgrade or major version upgrade?

Based on the release notes here, I think the API version increments with the major version upgrade.

  • What is the step a user of salesforce must follow to find out the version of salesforce they are using?

The steps can be found here.

  • What is the step a user of salesforce must follow to find out the API VERSION of salesforce they are using?

The steps can be found here.

  • Will the users of Salesforce always be using the latest version of Salesforce?

As it is a cloud platform, I think the users will always be using the latest version of Salesforce. Also, the test instance we use was created approximately a year ago, when the latest version was v52.0. However, when I checked the version using the steps mentioned in the above question, the version was v55.0. Based on this, I believe that the answer to this question should be a 'Yes'.

@yug-rajani yug-rajani requested a review from agithomas October 17, 2022 13:42
@kush-elastic
Copy link
Contributor

Here in the system test event contains the TIMESTAMP_DERIVED which is in 2021 so the @timestamp is in 2021 and as the system test was run in 2022 so the event.created is in 2022.

Technically correct, but logically incorrect, i fear In the manifest.yml, the max log collection frequency is 1hr. Considering this, a timestamp of creation and TIMESTAMP_DERIVED date must max be separated by 1hr, if my understanding is correct and 1 year is too much of a difference to mention in the documentation.

This is system test event only that's why you are seeing this difference. For customer there won't be a scenario in which they'll face this huge difference. Let me update current test event with the live response so you won't see this difference in the system test as well.

@agithomas
Copy link
Contributor

agithomas commented Nov 28, 2022

Can we also attempt to do a Maps visualization in the dashboard, making use of the source.geo.location towards the end of the dashboard to show the distribution of geo invocation?

This is the requirement i mentioned in the TDD document

@agithomas
Copy link
Contributor

If the user has multiple salesforce URLs (spanned across multiple policy), how would the user select a specific salesforce instance in kibana? Shouldn't HostControl be used to help user?

@agithomas
Copy link
Contributor

agithomas commented Nov 28, 2022

Can we also attempt to do a Maps visualization in the dashboard, making use of the source.geo.location towards the end of the dashboard to show the distribution of geo invocation?

This is the requirement i mentioned in the TDD document

Please hold this requirement until more clarity is available on elastic/elastic-package#1053 (comment)

@agithomas
Copy link
Contributor

Can we also attempt to do a Maps visualization in the dashboard, making use of the source.geo.location towards the end of the dashboard to show the distribution of geo invocation?

This is the requirement i mentioned in the TDD document

Reference : elastic/elastic-package#1053 (comment)

@ruflin , @jsoriano If the geoIP processor might not always give the latitute and longitude values, is it a good approach to go with a kibana map for geo distribution of users (in this case salesforce users).

Three approaches I can think of are :

Approach 1 :
Since certain events (events failing geoIP translation) would miss the map representation, indicate in the title of the dashboard panel - limited events ?

Approach 2 :
Geo Map representation with no indication that certain IPs (or events) are filtered.

Approach 3:
Only tabular representation of top 10 IPs and no geo maps used.

This is a challenge in every dashboard where geomap is used. What can be the best approach? Please note, Geo Map representation is an additional representation over the table representation displaying top 10 source IPs.

I find that GeoMap representation would be a convenient representation for security audit users.

@ruflin
Copy link
Contributor

ruflin commented Nov 29, 2022

I think we use "Approach 2" already in quite a few dashboards and did not have complaints yet. I would expect that in general it is understood that not 100% of ip addresses can be translated to geo locations so that some ip addresses are missing is expected. I personally always like to see the map visualisation as it is eye catching.


- In case of data ingestion if the user finds following type of error logs:
```
{"log.level":"error","@timestamp":"2022-11-24T12:59:36.835+0530","log.logger":"input.httpjson-cursor","log.origin":{"[file.name](http://file.name/)":"compat/compat.go","file.line":124},"message":"Input 'httpjson-cursor' failed with: input.go:130: input 8A049E17A5CA661D failed (id=8A049E17A5CA661D)\n\toauth2 client: error loading credentials using user and password: oauth2: cannot fetch token: 400 Bad Request\n\tResponse: {\"error\":\"invalid_grant\",\"error_description\":\"authentication failure\"}","[service.name](http://service.name/)":"filebeat","id":"8A049E17A5CA661D","ecs.version":"1.6.0"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do the formatting.


Example:

Address Bar Content: https://elastic1234-dev-ed.my.salesforce.com/home/home.jsp?source=lex
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please elaborate as

If Address bar content is Salesforce Instance URL is


### Steps to find out the version of Salesforce

On the Home tab in Salesforce Classic, on the top right of the screen is a link to release like `Summer '22`. This indicates your release.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about for Salesforce Lightening?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could not find the exact way for the Salesforce Lightning, However User will still have two options

  1. Switch his view to Classic and can find the same, they just need one click to perform this activity.
  2. To find out the version of Salesforce by hitting the following URL: (Salesforce Instance URL)/services/data
    The option 2 is already mentioned in the Readme

@agithomas
Copy link
Contributor

@SubhrataK , kindly have a look at the README and share your feedback.

@agithomas agithomas requested a review from SubhrataK November 30, 2022 08:18
@SubhrataK
Copy link

Feedback shared via the Google Doc. @kush-elastic kindly update the readme based on my comments provided in the doc.

@agithomas
Copy link
Contributor

@SubhrataK , @kush-elastic has requested for the final approval of the PR. Can you please check if it looks good to you?

@SubhrataK
Copy link

@agithomas Looks good to me.

@agithomas
Copy link
Contributor

LGTM

Copy link
Contributor

@agithomas agithomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kush-elastic kush-elastic merged commit 5e3cac3 into elastic:main Dec 6, 2022
@elasticmachine
Copy link

Package salesforce - 0.1.0 containing this change is available at https://epr.elastic.co/search?package=salesforce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Integration:salesforce Salesforce New Integration Issue or pull request for creating a new integration package. Team:Service-Integrations Label for the Observability Service Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create package for Salesforce integration
7 participants