-
Notifications
You must be signed in to change notification settings - Fork 604
[salesforce] Add salesforce package foundation along with logout_rest data stream
#4323
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
kush-elastic
merged 11 commits into
elastic:main
from
yug-rajani:package_salesforce_logout_rest
Dec 19, 2022
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4d7bb2e
Add Salesforce package skeleton with 'logout_rest' data stream
yug-rajani 67bb160
Add changelog entry
yug-rajani a01b9fd
Autogenerate README.md
yug-rajani 9e821e7
Update mechanism to avoid data duplication
yug-rajani a275581
Merge branch 'main' of https://github.com/yug-elastic/integrations in…
yug-rajani 6f31cfe
Minor updates to the pipeline
yug-rajani 285a323
Update README as per review comments, other minor changes
yug-rajani 24d0242
Merge branch 'main' of https://github.com/yug-elastic/integrations in…
yug-rajani 47dd608
Merge branch 'main' of https://github.com/yug-elastic/integrations in…
kush-elastic 2a81630
Address Review Comments
kush-elastic 20eaa57
Address Review comments
kush-elastic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/salesforce/data_stream/logout_rest/_dev/test/pipeline/test-common-config.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| dynamic_fields: | ||
| event.ingested: ".*" | ||
| fields: | ||
| tags: | ||
| - preserve_original_event |
1 change: 1 addition & 0 deletions
1
packages/salesforce/data_stream/logout_rest/_dev/test/pipeline/test-logout-rest.log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"EVENT_TYPE":"Logout","TIMESTAMP":"20211019050707.13","REQUEST_ID":"4exLFFQZNa5xxFl1cJNwOV","ORGANIZATION_ID":"00D5j000000VI3n","USER_ID":"0055j000000utlP","USER_TYPE":"X","SESSION_TYPE":"C","SESSION_LEVEL":"1","BROWSER_TYPE":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36","PLATFORM_TYPE":"1015","RESOLUTION_TYPE":"9999","APP_TYPE":"1000","CLIENT_VERSION":"9998","API_TYPE":"fo","API_VERSION":"54.0","USER_INITIATED_LOGOUT":"1","SESSION_KEY":"/b1/C123g6WXplkT","LOGIN_KEY":"OK123uSUIZVr9YzF","TIMESTAMP_DERIVED":"2021-10-19T05:07:07.128Z","USER_ID_DERIVED":"0055j000000utlPAAQ","CLIENT_IP":"175.16.199.0"} |
74 changes: 74 additions & 0 deletions
74
.../salesforce/data_stream/logout_rest/_dev/test/pipeline/test-logout-rest.log-expected.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| { | ||
| "expected": [ | ||
| { | ||
| "@timestamp": "2021-10-19T05:07:07.128Z", | ||
| "ecs": { | ||
| "version": "8.4.0" | ||
| }, | ||
| "event": { | ||
| "action": "logout", | ||
| "category": [ | ||
| "authentication" | ||
| ], | ||
| "code": "4exLFFQZNa5xxFl1cJNwOV", | ||
| "dataset": "salesforce.logout_rest", | ||
| "kind": "event", | ||
| "module": "salesforce", | ||
| "original": "{\"EVENT_TYPE\":\"Logout\",\"TIMESTAMP\":\"20211019050707.13\",\"REQUEST_ID\":\"4exLFFQZNa5xxFl1cJNwOV\",\"ORGANIZATION_ID\":\"00D5j000000VI3n\",\"USER_ID\":\"0055j000000utlP\",\"USER_TYPE\":\"X\",\"SESSION_TYPE\":\"C\",\"SESSION_LEVEL\":\"1\",\"BROWSER_TYPE\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36\",\"PLATFORM_TYPE\":\"1015\",\"RESOLUTION_TYPE\":\"9999\",\"APP_TYPE\":\"1000\",\"CLIENT_VERSION\":\"9998\",\"API_TYPE\":\"fo\",\"API_VERSION\":\"54.0\",\"USER_INITIATED_LOGOUT\":\"1\",\"SESSION_KEY\":\"/b1/C123g6WXplkT\",\"LOGIN_KEY\":\"OK123uSUIZVr9YzF\",\"TIMESTAMP_DERIVED\":\"2021-10-19T05:07:07.128Z\",\"USER_ID_DERIVED\":\"0055j000000utlPAAQ\",\"CLIENT_IP\":\"175.16.199.0\"}", | ||
| "type": [ | ||
| "info" | ||
| ] | ||
| }, | ||
| "related": { | ||
| "ip": [ | ||
| "175.16.199.0" | ||
| ] | ||
| }, | ||
| "salesforce": { | ||
| "logout": { | ||
| "access_mode": "rest", | ||
| "api": { | ||
| "type": "fo", | ||
| "version": "54.0" | ||
| }, | ||
| "app_type": "Application", | ||
| "browser_type": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36", | ||
| "client_version": "9998", | ||
| "event_type": "Logout", | ||
| "login_key": "OK123uSUIZVr9YzF", | ||
| "organization_id": "00D5j000000VI3n", | ||
| "platform_type": "Windows 10", | ||
| "resolution_type": "9999", | ||
| "session": { | ||
| "level": "Standard Session", | ||
| "type": "Content" | ||
| }, | ||
| "user_id": "0055j000000utlP", | ||
| "user_initiated_logout": "1" | ||
| } | ||
| }, | ||
| "source": { | ||
| "geo": { | ||
| "city_name": "Changchun", | ||
| "continent_name": "Asia", | ||
| "country_iso_code": "CN", | ||
| "country_name": "China", | ||
| "location": { | ||
| "lat": 43.88, | ||
| "lon": 125.3228 | ||
| }, | ||
| "region_iso_code": "CN-22", | ||
| "region_name": "Jilin Sheng" | ||
| }, | ||
| "ip": "175.16.199.0" | ||
| }, | ||
| "tags": [ | ||
| "preserve_original_event" | ||
| ], | ||
| "user": { | ||
| "id": "0055j000000utlPAAQ", | ||
| "roles": "Salesforce Administrator" | ||
| } | ||
| } | ||
| ] | ||
| } |
12 changes: 12 additions & 0 deletions
12
packages/salesforce/data_stream/logout_rest/_dev/test/system/test-default-config.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| input: httpjson | ||
| service: salesforce | ||
| vars: | ||
| instance_url: http://{{Hostname}}:{{Port}} | ||
| client_id: temp_client_id | ||
| client_secret: forty_characters_long_secret_key | ||
| username: temp_user | ||
| password: temp_password | ||
| token_url: http://{{Hostname}}:{{Port}}/services/oauth2/token | ||
| data_stream: | ||
| vars: | ||
| preserve_original_event: true |
44 changes: 44 additions & 0 deletions
44
packages/salesforce/data_stream/logout_rest/agent/stream/httpjson.yml.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| config_version: 2 | ||
| interval: {{period}} | ||
| request.method: GET | ||
| auth.oauth2: | ||
| enabled: true | ||
| client.id: {{client_id}} | ||
| client.secret: {{client_secret}} | ||
| token_url: {{token_url}} | ||
| user: {{username}} | ||
| password: {{password}} | ||
| request.url: {{instance_url}}/services/data/v54.0/query?q=logout+rest | ||
| request.transforms: | ||
| - set: | ||
| target: url.params.q | ||
| value: "SELECT Id,CreatedDate,LogDate,LogFile FROM EventLogFile WHERE Interval = 'Hourly' AND EventType = 'Logout' AND LogDate > [[.cursor.last_published_logout]] ORDER BY CreatedDate ASC NULLS FIRST" | ||
| default: "SELECT Id,CreatedDate,LogDate,LogFile FROM EventLogFile WHERE Interval = 'Hourly' AND EventType = 'Logout' ORDER BY LogDate ASC NULLS FIRST" | ||
| response.split: | ||
| target: body.records | ||
| chain: | ||
| - step: | ||
| request.url: {{instance_url}}/services/data/v54.0/sobjects/EventLogFile/$.records[:].Id/LogFile | ||
| request.method: GET | ||
| replace: $.records[:].Id | ||
| cursor: | ||
| last_published_logout: | ||
| value: '[[.last_event.LogDate]]' | ||
| tags: | ||
| {{#if preserve_original_event}} | ||
| - preserve_original_event | ||
| {{/if}} | ||
| {{#each tags as |tag|}} | ||
| - {{tag}} | ||
| {{/each}} | ||
| {{#contains "forwarded" tags}} | ||
| publisher_pipeline.disable_host: true | ||
| {{/contains}} | ||
| processors: | ||
| - add_fields: | ||
| target: salesforce | ||
| fields: | ||
| instance_url: {{instance_url}} | ||
| {{#if processors}} | ||
| {{processors}} | ||
| {{/if}} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.