Class: Rsplunk::Client
- Inherits:
-
Object
- Object
- Rsplunk::Client
- Extended by:
- Forwardable
- Includes:
- Search
- Defined in:
- lib/rsplunk/client.rb
Instance Attribute Summary (collapse)
-
- (Object) pass
Returns the value of attribute pass.
-
- (Object) user
Returns the value of attribute user.
Instance Method Summary (collapse)
-
- (Object) connection
Sets up the initial connection to your Splunk server.
-
- (Client) initialize(options = {})
constructor
Create a Splunk session using basic_auth parameters.
Methods included from Search
#create_job, #delete_job, #job_results, #list_jobs
Constructor Details
- (Client) initialize(options = {})
Create a Splunk session using basic_auth parameters.
Example: client = Rsplunk::Client.new(:username => 'your_username', :password => 'your_password')
16 17 18 19 |
# File 'lib/rsplunk/client.rb', line 16 def initialize(={}) @user = [:username] @pass = [:password] end |
Instance Attribute Details
- (Object) pass
Returns the value of attribute pass
10 11 12 |
# File 'lib/rsplunk/client.rb', line 10 def pass @pass end |
- (Object) user
Returns the value of attribute user
10 11 12 |
# File 'lib/rsplunk/client.rb', line 10 def user @user end |
Instance Method Details
- (Object) connection
Sets up the initial connection to your Splunk server
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rsplunk/client.rb', line 22 def connection params = {} params[:username] = @user if @user params[:password] = @pass if @pass @connection ||= Faraday::Connection.new(:url => api_url, :ssl => { :verify => false }, :params => params, :headers => default_headers) do |builder| builder.request :url_encoded builder.response :xml builder.adapter :net_http builder.basic_auth(@user, @pass) end end |