@@ -41,7 +41,7 @@ that will be used in the SOQL query.
41
41
42
42
==== HTTP proxy
43
43
44
- If your infrastructure uses a HTTP proxy, you can set the `SALESFORCE_PROXY_URI` environment variable with the desired URI value (e.g `export SALESFORCE_PROXY_URI="http://proxy.example.com:123"`).
44
+ If your infrastructure uses an HTTP proxy, you can set the `SALESFORCE_PROXY_URI` environment variable with the desired URI value (e.g `export SALESFORCE_PROXY_URI="http://proxy.example.com:123"`).
45
45
46
46
==== Example
47
47
This example prints all the Salesforce Opportunities to standard out
@@ -75,6 +75,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
75
75
|=======================================================================
76
76
|Setting |Input type|Required
77
77
| <<plugins-{type}s-{plugin}-api_version>> |<<string,string>>|No
78
+ | <<plugins-{type}s-{plugin}-changed_data_filter>> |<<string,string>>|No
78
79
| <<plugins-{type}s-{plugin}-client_id>> |<<string,string>>|Yes
79
80
| <<plugins-{type}s-{plugin}-client_secret>> |<<password,password>>|Yes
80
81
| <<plugins-{type}s-{plugin}-interval>> |<<number,number>>|No
@@ -86,6 +87,8 @@ This plugin supports the following configuration options plus the <<plugins-{typ
86
87
| <<plugins-{type}s-{plugin}-sfdc_object_name>> |<<string,string>>|Yes
87
88
| <<plugins-{type}s-{plugin}-timeout>> |<<number,number>>|No
88
89
| <<plugins-{type}s-{plugin}-to_underscores>> |<<boolean,boolean>>|No
90
+ | <<plugins-{type}s-{plugin}-tracking_field>> |<<string,string>>|No
91
+ | <<plugins-{type}s-{plugin}-tracking_field_value_file>> |<<string,string>>|No
89
92
| <<plugins-{type}s-{plugin}-use_test_sandbox>> |<<boolean,boolean>>|No
90
93
| <<plugins-{type}s-{plugin}-use_tooling_api>> |<<boolean,boolean>>|No
91
94
| <<plugins-{type}s-{plugin}-username>> |<<string,string>>|Yes
@@ -103,7 +106,29 @@ input plugins.
103
106
* There is no default value for this setting.
104
107
105
108
By default, this uses the default Restforce API version.
106
- To override this, set this to something like "32.0" for example
109
+ To override this, set this to something like "32.0" for example.
110
+
111
+ [id="plugins-{type}s-{plugin}-changed_data_filter"]
112
+ ===== `changed_data_filter`
113
+
114
+ * Value type is <<string,string>>
115
+ * There is no default value for this setting.
116
+
117
+ The filter to add to the Salesforce query when a previous tracking field value
118
+ was read from the <<plugins-{type}s-{plugin}-tracking_field_value_file>>.
119
+ The string can (and should) contain a placeholder `%+{last_tracking_field_value}+` that
120
+ will be substituted with the actual value read from the <<plugins-{type}s-{plugin}-tracking_field_value_file>>.
121
+
122
+ This clause is combined with any <<plugins-{type}s-{plugin}-sfdc_filters>>
123
+ clause that is configured using the `AND` operator.
124
+
125
+ The value should be properly quoted according to the SOQL rules for the field
126
+ type.
127
+
128
+ **Examples:**
129
+
130
+ "changed_data_filter" => "Number > '%{last_tracking_field_value}'"
131
+ "changed_data_filter" => "LastModifiedDate >= %{last_tracking_field_value}"
107
132
108
133
[id="plugins-{type}s-{plugin}-client_id"]
109
134
===== `client_id`
@@ -112,10 +137,10 @@ To override this, set this to something like "32.0" for example
112
137
* Value type is <<string,string>>
113
138
* There is no default value for this setting.
114
139
115
- Consumer Key for authentication. You must set up a new SFDC
116
- connected app with oath to use this output . More information
140
+ Consumer Key for authentication. You must set up a new Salesforce
141
+ connected app with OAuth enabled to use this plugin . More information
117
142
can be found here:
118
- https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm
143
+ https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm.
119
144
120
145
[id="plugins-{type}s-{plugin}-client_secret"]
121
146
===== `client_secret`
@@ -124,7 +149,7 @@ https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm
124
149
* Value type is <<password,password>>
125
150
* There is no default value for this setting.
126
151
127
- Consumer Secret from your oauth enabled connected app
152
+ Consumer secret from your OAuth enabled connected app.
128
153
129
154
[id="plugins-{type}s-{plugin}-interval"]
130
155
===== `interval`
@@ -150,21 +175,21 @@ If this property is not specified or is set to -1, the plugin will run once and
150
175
* Value type is <<password,password>>
151
176
* There is no default value for this setting.
152
177
153
- The password used to login to sfdc
178
+ The password used to log in to Salesforce.
154
179
155
180
[id="plugins-{type}s-{plugin}-security_token"]
156
- ===== `security_token`
181
+ ===== `security_token`
157
182
158
- * This is a required setting.
159
- * Value type is <<password,password>>
160
- * There is no default value for this setting.
183
+ * This is a required setting.
184
+ * Value type is <<password,password>>
185
+ * There is no default value for this setting.
161
186
162
187
The security token for this account. For more information about
163
- generting a security token, see:
164
- https://help.salesforce.com/apex/HTViewHelpDoc?id=user_security_token.htm
188
+ generating a security token, see:
189
+ https://help.salesforce.com/apex/HTViewHelpDoc?id=user_security_token.htm.
165
190
166
191
[id="plugins-{type}s-{plugin}-sfdc_fields"]
167
- ===== `sfdc_fields`
192
+ ===== `sfdc_fields`
168
193
169
194
* Value type is <<array,array>>
170
195
* Default value is `[]`
@@ -178,9 +203,9 @@ If this is empty, all fields are returned.
178
203
* Value type is <<string,string>>
179
204
* Default value is `""`
180
205
181
- These options will be added to the WHERE clause in the
206
+ These options will be added to the ` WHERE` clause in the
182
207
SOQL statement. Additional fields can be filtered on by
183
- adding field1 = value1 AND field2 = value2 AND...
208
+ adding ` field1 = value1 AND field2 = value2 AND...` .
184
209
185
210
[id="plugins-{type}s-{plugin}-sfdc_instance_url"]
186
211
===== `sfdc_instance_url`
@@ -202,7 +227,7 @@ but not both to configure the url to which the plugin connects to.
202
227
* Value type is <<string,string>>
203
228
* There is no default value for this setting.
204
229
205
- The name of the salesforce object you are creating or updating
230
+ The name of the Salesforce object you are creating or updating.
206
231
207
232
[id="plugins-{type}s-{plugin}-timeout"]
208
233
===== `timeout`
@@ -221,7 +246,59 @@ read, an error occurs.
221
246
* Value type is <<boolean,boolean>>
222
247
* Default value is `false`
223
248
224
- Setting this to true will convert SFDC's NamedFields__c to named_fields__c
249
+ Setting this to true will convert Salesforce's `++NamedFields__c++` to `++named_fields__c++`.
250
+
251
+ [id="plugins-{type}s-{plugin}-tracking_field"]
252
+ ===== `tracking_field`
253
+
254
+ * Value type is <<string,string>>
255
+ * There is no default value for this setting.
256
+
257
+ The field to track for incremental data loads. This field will
258
+ be used in an `ORDER BY ... ASC` clause that is added to the Salesforce query.
259
+ This field _should_ also be used in the <<plugins-{type}s-{plugin}-changed_data_filter>> clause
260
+ to actually achieve incremental loading of data.
261
+
262
+ The last value (which is the highest value if the query sorts by this field ascending)
263
+ value for this field will be saved to the file at the path configured by
264
+ <<plugins-{type}s-{plugin}-tracking_field_value_file>>, if specified.
265
+
266
+ This field should ideally be strictly ascending for new records. An
267
+ autonumber field is ideal for this.
268
+
269
+ The standard `LastModifiedDate` field can be used, but since it is not _strictly_
270
+ ascending (multiple records can have the same `LastModifiedDate`, the
271
+ <<plugins-{type}s-{plugin}-changed_data_filter>> should account for this by using the `>=`
272
+ operator, and duplicates should be expected.
273
+
274
+ Note that Salesforce does not guarantee that the standard `Id` field has ascending
275
+ values for new records (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_best_practices.htm).
276
+ Therefore, using `Id` as tracking field risks missing records and is not recommended.
277
+
278
+ If this field is not already included in the <<plugins-{type}s-{plugin}-sfdc_fields>>,
279
+ it is added.
280
+
281
+ [id="plugins-{type}s-{plugin}-tracking_field_value_file"]
282
+ ===== `tracking_field_value_file`
283
+
284
+ * Value type is <<string,string>>
285
+ * There is no default value for this setting.
286
+
287
+ The full path to the file from which the latest tracking field value from the previous
288
+ plugin invocation will be read, and to which the new latest tracking field value will be
289
+ written after the current plugin invocation.
290
+
291
+ This keeps persistent track of the last seen value of the tracking field used for incremental
292
+ loading of data.
293
+
294
+ The file should be readable and writable by the Logstash process.
295
+
296
+ If the file exists and a <<plugins-{type}s-{plugin}-changed_data_filter>> is configured,
297
+ a changed data filter clause is added to the query (and combined with any <<plugins-{type}s-{plugin}-sfdc_filters>>
298
+ clause that is configured using the `AND` operator).
299
+
300
+ If the result set is not empty, the value for `tracking_field` from the last row is
301
+ written to the file.
225
302
226
303
[id="plugins-{type}s-{plugin}-use_test_sandbox"]
227
304
===== `use_test_sandbox`
@@ -230,7 +307,7 @@ Setting this to true will convert SFDC's NamedFields__c to named_fields__c
230
307
* Default value is `false`
231
308
232
309
Set this to true to connect to a sandbox sfdc instance
233
- logging in through test.salesforce.com
310
+ logging in through test.salesforce.com.
234
311
235
312
Use either this or the `sfdc_instance_url` configuration option
236
313
but not both to configure the url to which the plugin connects to.
@@ -255,9 +332,9 @@ of elements of sfdc flows) and security health check risks.
255
332
* Value type is <<string,string>>
256
333
* There is no default value for this setting.
257
334
258
- A valid salesforce user name , usually your email address.
335
+ A valid Salesforce username , usually your email address.
259
336
Used for authentication and will be the user all objects
260
- are created or modified by
337
+ are created or modified by.
261
338
262
339
263
340
0 commit comments