Skip to content

Commit d801a3c

Browse files
committed
x-pack/filebeat/input/salesforce: Use new JWT provider to include optional token endpoint
1 parent 9190f77 commit d801a3c

File tree

10 files changed

+31
-11
lines changed

10 files changed

+31
-11
lines changed

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14469,11 +14469,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-seccomp-bpf@
1446914469

1447014470
--------------------------------------------------------------------------------
1447114471
Dependency : github.com/elastic/go-sfdc
14472-
Version: v0.0.0-20241010131323-8e176480d727
14472+
Version: v0.0.0-20250415195157-fd0324f12c86
1447314473
Licence type (autodetected): MIT
1447414474
--------------------------------------------------------------------------------
1447514475

14476-
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]20241010131323-8e176480d727/LICENSE.txt:
14476+
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]20250415195157-fd0324f12c86/LICENSE.txt:
1447714477

1447814478
MIT License
1447914479

filebeat/docs/modules/salesforce.asciidoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Example config:
118118
client.username: "[email protected]"
119119
client.key_path: client_key.pem
120120
url: https://login.salesforce.com
121+
token_url: "https://[custom-domain].my.salesforce.com"
121122
user_password_flow:
122123
enabled: true
123124
client.id: "my-client-id"
@@ -168,6 +169,10 @@ Path to the client key file for JWT authentication.
168169

169170
The audience URL for JWT authentication.
170171

172+
*`var.authentication.jwt_bearer_flow.token_url`*::
173+
174+
The Salesforce OAuth token endpoint for JWT authentication. This endpoint is used for JWT Bearer flow and defaults to `var.authentication.jwt_bearer_flow.url` if empty. Only use a custom value if you have a custom domain and don't allow default endpoints such as `https://login.salesforce.com` or `https://test.salesforce.com`.
175+
171176
*`var.authentication.user_password_flow.enabled`*::
172177

173178
Set to true to use user-password authentication.
@@ -562,6 +567,7 @@ Check the Elastic Agent logs for errors. Verify the module configuration is corr
562567

563568
:modulename!:
564569

570+
565571
[float]
566572
=== Fields
567573

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ require (
179179
github.com/elastic/elastic-agent-system-metrics v0.11.11
180180
github.com/elastic/go-elasticsearch/v8 v8.17.1
181181
github.com/elastic/go-quark v0.3.0
182-
github.com/elastic/go-sfdc v0.0.0-20241010131323-8e176480d727
182+
github.com/elastic/go-sfdc v0.0.0-20250415195157-fd0324f12c86
183183
github.com/elastic/mito v1.18.0
184184
github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015
185185
github.com/elastic/sarama v1.19.1-0.20250304185506-df6449b5c996

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+
6262
github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8=
6363
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=
6464
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
65-
github.com/Azure/azure-sdk-for-go/sdk/monitor/query/azmetrics v1.1.0 h1:X/C/tY3dxwsuFnSNArmTWKr0O6P59SRY6VsUcIkefEw=
66-
github.com/Azure/azure-sdk-for-go/sdk/monitor/query/azmetrics v1.1.0/go.mod h1:wCAGp7Xm35A5laB8z8yK9p/kU8OEBFuTvUm4eKCzr/M=
6765
github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs v1.3.0 h1:skbmKp8umb8jMxl4A4CwvYyfCblujU00XUB/ytUjEac=
6866
github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs v1.3.0/go.mod h1:nynTZqX7jGM6FQy6Y+7uFT7Y+LhaAeO3q3d48VZzH5E=
67+
github.com/Azure/azure-sdk-for-go/sdk/monitor/query/azmetrics v1.1.0 h1:X/C/tY3dxwsuFnSNArmTWKr0O6P59SRY6VsUcIkefEw=
68+
github.com/Azure/azure-sdk-for-go/sdk/monitor/query/azmetrics v1.1.0/go.mod h1:wCAGp7Xm35A5laB8z8yK9p/kU8OEBFuTvUm4eKCzr/M=
6969
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0 h1:0nGmzwBv5ougvzfGPCO2ljFRHvun57KpNrVCMrlk0ns=
7070
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0/go.mod h1:gYq8wyDgv6JLhGbAU6gg8amCPgQWRE+aCvrV2gyzdfs=
7171
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement v1.1.1 h1:ehSLdbLah6kk6HTVc6e/lrbmbz7MMbpNxkOd3OYlhB0=
@@ -382,8 +382,8 @@ github.com/elastic/go-quark v0.3.0 h1:d4vokx0psEJo+93fnhvWpTJMggPd9rfMJSleoLva4x
382382
github.com/elastic/go-quark v0.3.0/go.mod h1:bO/XIGZBUJGxyiJ9FTsSYn9YlfOTRJnmOP+iBE2FyjA=
383383
github.com/elastic/go-seccomp-bpf v1.5.0 h1:gJV+U1iP+YC70ySyGUUNk2YLJW5/IkEw4FZBJfW8ZZY=
384384
github.com/elastic/go-seccomp-bpf v1.5.0/go.mod h1:umdhQ/3aybliBF2jjiZwS492I/TOKz+ZRvsLT3hVe1o=
385-
github.com/elastic/go-sfdc v0.0.0-20241010131323-8e176480d727 h1:yuiN60oaQUz2PtNpNhDI2H6zrCdfiiptmNdwV5WUaKA=
386-
github.com/elastic/go-sfdc v0.0.0-20241010131323-8e176480d727/go.mod h1:sw1pzz4pIqzDQxFWt3dFoG2uIUFAfThxlMfWpjH590E=
385+
github.com/elastic/go-sfdc v0.0.0-20250415195157-fd0324f12c86 h1:/R15+u4zjjwizTHwiq0F4Uz7UlcFF+bDsqkSixCXxLI=
386+
github.com/elastic/go-sfdc v0.0.0-20250415195157-fd0324f12c86/go.mod h1:sw1pzz4pIqzDQxFWt3dFoG2uIUFAfThxlMfWpjH590E=
387387
github.com/elastic/go-structform v0.0.12 h1:HXpzlAKyej8T7LobqKDThUw7BMhwV6Db24VwxNtgxCs=
388388
github.com/elastic/go-structform v0.0.12/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4=
389389
github.com/elastic/go-sysinfo v1.15.0 h1:54pRFlAYUlVNQ2HbXzLVZlV+fxS7Eax49stzg95M4Xw=

x-pack/filebeat/filebeat.reference.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ filebeat.modules:
14941494
# - enabled: Set to true to enable ingestion of Salesforce module fileset
14951495
# - initial_interval: Initial interval for log collection. This setting determines the time period for which the logs will be initially collected when the ingestion process starts, i.e. 1d/h/m/s
14961496
# - api_version: API version for Salesforce, version should be greater than 46.0
1497+
# - url: URL for Salesforce instance
14971498

14981499
# Authentication Configurations:
14991500
# User-Password Authentication:
@@ -1510,6 +1511,7 @@ filebeat.modules:
15101511
# - client.username: Username for JWT authentication
15111512
# - client.key_path: Path to client key for JWT authentication
15121513
# - url: Audience URL for JWT authentication
1514+
# - token_url: Token URL for JWT authentication
15131515

15141516
# Event Monitoring:
15151517
# - real_time: Set to true to enable real-time logging using object type data collection
@@ -1629,7 +1631,8 @@ filebeat.modules:
16291631
var.url: "https://instance_id.my.salesforce.com"
16301632

16311633
var.real_time: true
1632-
var.real_time_interval: 5m
1634+
var.real_time_interval: 5m
1635+
16331636
#----------------------------- Google Santa Module -----------------------------
16341637
- module: santa
16351638
log:

x-pack/filebeat/input/salesforce/config_auth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type JWTBearerFlow struct {
3333
Enabled *bool `config:"enabled"`
3434

3535
URL string `config:"url"`
36+
TokenURL string `config:"token_url"` // If not provided, the URL will be used by go-sfdc package.
3637
ClientID string `config:"client.id"`
3738
ClientUsername string `config:"client.username"`
3839
ClientKeyPath string `config:"client.key_path"`

x-pack/filebeat/input/salesforce/input.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ func (s *salesforceInput) getSFDCConfig(cfg *config) (*sfdc.Configuration, error
438438

439439
passCreds := credentials.JwtCredentials{
440440
URL: cfg.Auth.OAuth2.JWTBearerFlow.URL,
441+
TokenURL: cfg.Auth.OAuth2.JWTBearerFlow.TokenURL,
441442
ClientId: cfg.Auth.OAuth2.JWTBearerFlow.ClientID,
442443
ClientUsername: cfg.Auth.OAuth2.JWTBearerFlow.ClientUsername,
443444
ClientKey: signKey,

x-pack/filebeat/module/salesforce/_meta/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# - enabled: Set to true to enable ingestion of Salesforce module fileset
55
# - initial_interval: Initial interval for log collection. This setting determines the time period for which the logs will be initially collected when the ingestion process starts, i.e. 1d/h/m/s
66
# - api_version: API version for Salesforce, version should be greater than 46.0
7+
# - url: URL for Salesforce instance
78

89
# Authentication Configurations:
910
# User-Password Authentication:
@@ -20,6 +21,7 @@
2021
# - client.username: Username for JWT authentication
2122
# - client.key_path: Path to client key for JWT authentication
2223
# - url: Audience URL for JWT authentication
24+
# - token_url: Token URL for JWT authentication
2325

2426
# Event Monitoring:
2527
# - real_time: Set to true to enable real-time logging using object type data collection
@@ -139,4 +141,4 @@
139141
var.url: "https://instance_id.my.salesforce.com"
140142

141143
var.real_time: true
142-
var.real_time_interval: 5m
144+
var.real_time_interval: 5m

x-pack/filebeat/module/salesforce/_meta/docs.asciidoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ Example config:
111111
client.username: "[email protected]"
112112
client.key_path: client_key.pem
113113
url: https://login.salesforce.com
114+
token_url: "https://[custom-domain].my.salesforce.com"
114115
user_password_flow:
115116
enabled: true
116117
client.id: "my-client-id"
@@ -161,6 +162,10 @@ Path to the client key file for JWT authentication.
161162

162163
The audience URL for JWT authentication.
163164

165+
*`var.authentication.jwt_bearer_flow.token_url`*::
166+
167+
The Salesforce OAuth token endpoint for JWT authentication. This endpoint is used for JWT Bearer flow and defaults to `var.authentication.jwt_bearer_flow.url` if empty. Only use a custom value if you have a custom domain and don't allow default endpoints such as `https://login.salesforce.com` or `https://test.salesforce.com`.
168+
164169
*`var.authentication.user_password_flow.enabled`*::
165170

166171
Set to true to use user-password authentication.
@@ -553,4 +558,4 @@ Check the Elastic Agent logs for errors. Verify the module configuration is corr
553558

554559
:fileset_ex!:
555560

556-
:modulename!:
561+
:modulename!:

x-pack/filebeat/modules.d/salesforce.yml.disabled

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# - enabled: Set to true to enable ingestion of Salesforce module fileset
88
# - initial_interval: Initial interval for log collection. This setting determines the time period for which the logs will be initially collected when the ingestion process starts, i.e. 1d/h/m/s
99
# - api_version: API version for Salesforce, version should be greater than 46.0
10+
# - url: URL for Salesforce instance
1011

1112
# Authentication Configurations:
1213
# User-Password Authentication:
@@ -23,6 +24,7 @@
2324
# - client.username: Username for JWT authentication
2425
# - client.key_path: Path to client key for JWT authentication
2526
# - url: Audience URL for JWT authentication
27+
# - token_url: Token URL for JWT authentication
2628

2729
# Event Monitoring:
2830
# - real_time: Set to true to enable real-time logging using object type data collection
@@ -142,4 +144,4 @@
142144
var.url: "https://instance_id.my.salesforce.com"
143145

144146
var.real_time: true
145-
var.real_time_interval: 5m
147+
var.real_time_interval: 5m

0 commit comments

Comments
 (0)