Skip to content

Commit c97c013

Browse files
committed
Add support for plain SOQL query
1 parent f8e6274 commit c97c013

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.4.0
2+
- feat: Add support for plain SOQL query
3+
14
## 3.3.0
25
- feat: Added `timeout` configuration to control RESTForce timeout settings (defaults to `60`)
36
- feat: Added support for reference fields (`parent__r.child`)

lib/logstash/inputs/salesforce.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class LogStash::Inputs::Salesforce < LogStash::Inputs::Base
9494
# SOQL statement. Additional fields can be filtered on by
9595
# adding field1 = value1 AND field2 = value2 AND...
9696
config :sfdc_filters, :validate => :string, :default => ""
97+
# Plain SOQL query
98+
config :sfdc_soql_query, :validate => :string, :default => ""
9799
# Setting this to true will convert SFDC's NamedFields__c to named_fields__c
98100
config :to_underscores, :validate => :boolean, :default => false
99101

@@ -163,11 +165,15 @@ def client_options
163165

164166
private
165167
def get_query()
166-
query = ["SELECT",@sfdc_fields.join(','),
167-
"FROM",@sfdc_object_name]
168-
query << ["WHERE",@sfdc_filters] unless @sfdc_filters.empty?
169-
query << "ORDER BY LastModifiedDate DESC" if @sfdc_fields.include?('LastModifiedDate')
170-
query_str = query.flatten.join(" ")
168+
if @sfdc_soql_query.empty? then
169+
query = ["SELECT",@sfdc_fields.join(','),
170+
"FROM",@sfdc_object_name]
171+
query << ["WHERE",@sfdc_filters] unless @sfdc_filters.empty?
172+
query << "ORDER BY LastModifiedDate DESC" if @sfdc_fields.include?('LastModifiedDate')
173+
query_str = query.flatten.join(" ")
174+
else
175+
query_str = @sfdc_soql_query
176+
end
171177
@logger.debug? && @logger.debug("SFDC Query", :query => query_str)
172178
return query_str
173179
end

logstash-input-salesforce.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'logstash-input-salesforce'
3-
s.version = '3.3.0'
3+
s.version = '3.4.0'
44
s.licenses = ['Apache-2.0']
55
s.summary = "Creates events based on a Salesforce SOQL query"
66
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"

0 commit comments

Comments
 (0)