lib/logstash/outputs/scalyr.rb
# Method which performs connectivity check with Scalyr API, verifies that wt can talk to the API
# and that the API token is valid.
Method which performs connectivity check with Scalyr API, verifies that wt can talk to the API
and that the API token is valid.
Method which performs connectivity check with Scalyr API verifies that wt can talk to the API and that the API token is valid .
def connectivity_check()
    if not @perform_connectivity_check
      return
    end
    @logger.debug("Performing connectivity check against the Scalyr API")
    body = create_multi_event_request([], nil, nil, nil)[:body]
    begin
      @client_session.send_ping(body)
    rescue Scalyr::Common::Client::ClientError, Manticore::ResolutionFailure => e
      if not e.message.nil? and (e.message.include?("nodename nor servname provided") or
          e.message.downcase.include?("name or service not know"))
        raise LogStash::ConfigurationError,
                    format("Received error when trying to communicate with Scalyr API. This likely means that " \
                           "the configured value for 'scalyr_server' config option is invalid. Original error: %s",
                           e.message)
      end
      @logger.warn("Received error when trying to send connectivity check request to Scalyr",
                    :error => e.message)
    rescue Scalyr::Common::Client::ServerError => e
      if e.code == 401
        raise LogStash::ConfigurationError,
                    format("Received 401 from Scalyr API during connectivity check which indicates " \
                           "an invalid API key. Server Response: %s", e.body)
      end
    rescue => e
      @logger.warn("Received non-fatal error during connectivity check", :error => e.message)
    end
  end
def connectivity_check ( ) if not @perform_connectivity_check return end @logger . debug ( "Performing connectivity check against the Scalyr API" ) body = create_multi_event_request ( [ ] , nil , nil , nil ) [ :body ] begin @client_session . send_ping ( body ) rescue Scalyr :: Common :: Client :: ClientError , Manticore :: ResolutionFailure => e if not e . message . nil? and ( e . message . include? ( "nodename nor servname provided" ) or e . message . downcase . include? ( "name or service not know" ) ) raise LogStash :: ConfigurationError , format ( "Received error when trying to communicate with Scalyr API. This likely means that " "the configured value for 'scalyr_server' config option is invalid. Original error: %s" , e . message ) end @logger . warn ( "Received error when trying to send connectivity check request to Scalyr" , :error => e . message ) rescue Scalyr :: Common :: Client :: ServerError => e if e . code == 401 raise LogStash :: ConfigurationError , format ( "Received 401 from Scalyr API during connectivity check which indicates " "an invalid API key. Server Response: %s" , e . body ) end rescue => e @logger . warn ( "Received non-fatal error during connectivity check" , :error => e . message ) end end
Method which performs connectivity check with Scalyr API, verifies that wt can talk to the API
and that the API token is valid.
Method which performs connectivity check with Scalyr API verifies that wt can talk to the API and that the API token is valid .
# For now, we consider rest of the errors non fatal and just log them and don't propagate # them and fail register