@@ -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
@@ -79,6 +79,9 @@ This plugin supports the following configuration options plus the <<plugins-{typ
79
79
| <<plugins-{type}s-{plugin}-client_secret>> |<<password,password>>|Yes
80
80
| <<plugins-{type}s-{plugin}-interval>> |<<number,number>>|No
81
81
| <<plugins-{type}s-{plugin}-password>> |<<password,password>>|Yes
82
+ | <<plugins-{type}s-{plugin}-range_field>> |<<string,string>>|No
83
+ | <<plugins-{type}s-{plugin}-range_filter>> |<<string,string>>|No
84
+ | <<plugins-{type}s-{plugin}-range_field_value_file>> |<<string,string>>|No
82
85
| <<plugins-{type}s-{plugin}-security_token>> |<<password,password>>|Yes
83
86
| <<plugins-{type}s-{plugin}-sfdc_fields>> |<<array,array>>|No
84
87
| <<plugins-{type}s-{plugin}-sfdc_filters>> |<<string,string>>|No
@@ -103,7 +106,7 @@ 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.
107
110
108
111
[id="plugins-{type}s-{plugin}-client_id"]
109
112
===== `client_id`
@@ -112,10 +115,10 @@ To override this, set this to something like "32.0" for example
112
115
* Value type is <<string,string>>
113
116
* There is no default value for this setting.
114
117
115
- Consumer Key for authentication. You must set up a new SFDC
116
- connected app with oath to use this output . More information
118
+ Consumer Key for authentication. You must set up a new Salesforce
119
+ connected app with OAuth enabled to use this plugin . More information
117
120
can be found here:
118
- https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm
121
+ https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm.
119
122
120
123
[id="plugins-{type}s-{plugin}-client_secret"]
121
124
===== `client_secret`
@@ -124,7 +127,7 @@ https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm
124
127
* Value type is <<password,password>>
125
128
* There is no default value for this setting.
126
129
127
- Consumer Secret from your oauth enabled connected app
130
+ Consumer secret from your OAuth enabled connected app.
128
131
129
132
[id="plugins-{type}s-{plugin}-interval"]
130
133
===== `interval`
@@ -150,21 +153,95 @@ If this property is not specified or is set to -1, the plugin will run once and
150
153
* Value type is <<password,password>>
151
154
* There is no default value for this setting.
152
155
153
- The password used to login to sfdc
156
+ The password used to log in to Salesforce.
154
157
155
- [id="plugins-{type}s-{plugin}-security_token "]
156
- ===== `security_token`
158
+ [id="plugins-{type}s-{plugin}-range_field "]
159
+ ===== `range_field`
157
160
158
- * This is a required setting.
159
- * Value type is <<password,password>>
161
+ * Value type is <<string,string>>
162
+ * There is no default value for this setting.
163
+
164
+ The field to track for incremental data loads. This field will
165
+ be used in an `ORDER BY ... ASC` clause that is added to the Salesforce query.
166
+ This field _should_ also be used in the <<plugins-{type}s-{plugin}-range_filter>> clause
167
+ to actually achieve incremental loading of data.
168
+
169
+ The last value (which is the highest value if the query sorts by this field ascending)
170
+ value for this field will be saved to the file at the path configured by
171
+ <<plugins-{type}s-{plugin}-range_field_value_file>>, if specified.
172
+
173
+ This field should ideally be strictly ascending for new records. An
174
+ autonumber field is ideal for this.
175
+
176
+ The standard `LastModifiedDate` field can be used, but since it is not _strictly_
177
+ ascending (multiple records can have the same `LastModifiedDate`, the
178
+ <<plugins-{type}s-{plugin}-range_filter>> should account for this by using the `>=`
179
+ operator, and duplicates should be expected.
180
+
181
+ Note that Salesforce does not guarantee that the standard `Id` field has ascending
182
+ values for new records (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_best_practices.htm).
183
+ Therefore, using `Id` as range field risks missing records and is not recommended.
184
+
185
+ If this field is not already included in the <<plugins-{type}s-{plugin}-sfdc_fields>>,
186
+ it is added.
187
+
188
+ [id="plugins-{type}s-{plugin}-range_field_value_file"]
189
+ ===== `range_field_value_file`
190
+
191
+ * Value type is <<string,string>>
192
+ * There is no default value for this setting.
193
+
194
+ The full path to the file from which the latest range field value from the previous
195
+ plugin invocation will be read, and to which the new latest range field value will be
196
+ written after the current plugin invocation.
197
+
198
+ This keeps persistent track of the last seen value of the range field used for incremental
199
+ loading of data.
200
+
201
+ The file should be readable and writable by the Logstash process.
202
+
203
+ If the file exists and a <<plugins-{type}s-{plugin}-range_filter>> is configured,
204
+ a range filter clause is added to the query (and combined with any <<plugins-{type}s-{plugin}-sfdc_filters>>
205
+ clause that is configured using the `AND` operator).
206
+
207
+ If the result set is not empty, the value for `range_field` from the last row is
208
+ written to the file.
209
+
210
+ [id="plugins-{type}s-{plugin}-range_filter"]
211
+ ===== `range_filter`
212
+
213
+ * Value type is <<string,string>>
160
214
* There is no default value for this setting.
161
215
216
+ The filter to add to the Salesforce query when a previous range field value
217
+ was read from the <<plugins-{type}s-{plugin}-range_field_value_file>>.
218
+ The string can (and should) contain a placeholder `%+{range_field_value}+` that
219
+ will be substituted with the actual value read from the <<plugins-{type}s-{plugin}-range_field_value_file>>.
220
+
221
+ This clause is combined with any <<plugins-{type}s-{plugin}-sfdc_filters>>
222
+ clause that is configured using the `AND` operator.
223
+
224
+ The value should be properly quoted according to the SOQL rules for the field
225
+ type.
226
+
227
+ **Examples:**
228
+
229
+ "range_filter" => "Number > '%{range_field_value}'"
230
+ "range_filter" => "LastModifiedDate >= %{range_field_value}"
231
+
232
+ [id="plugins-{type}s-{plugin}-security_token"]
233
+ ===== `security_token`
234
+
235
+ * This is a required setting.
236
+ * Value type is <<password,password>>
237
+ * There is no default value for this setting.
238
+
162
239
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
240
+ generating a security token, see:
241
+ https://help.salesforce.com/apex/HTViewHelpDoc?id=user_security_token.htm.
165
242
166
243
[id="plugins-{type}s-{plugin}-sfdc_fields"]
167
- ===== `sfdc_fields`
244
+ ===== `sfdc_fields`
168
245
169
246
* Value type is <<array,array>>
170
247
* Default value is `[]`
@@ -178,9 +255,9 @@ If this is empty, all fields are returned.
178
255
* Value type is <<string,string>>
179
256
* Default value is `""`
180
257
181
- These options will be added to the WHERE clause in the
258
+ These options will be added to the ` WHERE` clause in the
182
259
SOQL statement. Additional fields can be filtered on by
183
- adding field1 = value1 AND field2 = value2 AND...
260
+ adding ` field1 = value1 AND field2 = value2 AND...` .
184
261
185
262
[id="plugins-{type}s-{plugin}-sfdc_instance_url"]
186
263
===== `sfdc_instance_url`
@@ -202,7 +279,7 @@ but not both to configure the url to which the plugin connects to.
202
279
* Value type is <<string,string>>
203
280
* There is no default value for this setting.
204
281
205
- The name of the salesforce object you are creating or updating
282
+ The name of the Salesforce object you are creating or updating.
206
283
207
284
[id="plugins-{type}s-{plugin}-timeout"]
208
285
===== `timeout`
@@ -221,7 +298,7 @@ read, an error occurs.
221
298
* Value type is <<boolean,boolean>>
222
299
* Default value is `false`
223
300
224
- Setting this to true will convert SFDC 's NamedFields__c to named_fields__c
301
+ Setting this to true will convert Salesforce 's `++ NamedFields__c++` to `++ named_fields__c++`.
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