Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sumo-search

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sumo-search

  • 2.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Gem Version Build Status Code Climate Dependency Status

This gem interfaces with the Sumo Logic Search Job API. It may be used through native Ruby, or via a CLI that has been provided.

Installation

From the command line:

$ [sudo] gem install sumo-search

From your application's Gemfile:

gem 'sumo-search'

Configuration

Your credentials go into the YAML file ~/.sumo_creds. An example YAML file is listed below:

backend:
  email: email@test.net
  password: trustno1
default:
  email: email2@test.net
  password: test-pass

The credentials in the default namespace are loaded by default. To change this, set ENV['SUMO_CREDENTIAL'] to the credential that you would like to load.

Ruby Usage

To create a search job from ruby, the Sumo.search method is provided. For example, the following creates a search job for everything from the 2014-01-01:

search = Sumo.search(
  :query => '*',
  :from => '2014-01-01T00:00:00',
  :to => '2014-01-01T23:59:59',
  :time_zone => 'UTC'
)

To iterate through the messages returned by the API, use the #messages method on the object returned by Sumo.search.

search.messages.each { |message| puts message }

Similarly, iterating through the records can be acheived through the #records method.

search.records.each { |record| puts record }

Note that the two above methods lazily grab the results in chunks, so iterating through these will take some time. The difference between records and messages is described at the bottom of this section of the api docs.

CLI Usage

The executable packaged with this gem is called sumo.

OptionRequiredDescription
-q --querytrueThe query to send to the API
-f --fromtrueThe start date of the query (iso8601)
-t --totrueThe end date of the query (iso8601)
-z --time-zonetrueThe time zone of the start and end dates
-e --extract-keyfalseExtract the given key from the returned message
-r --recordsfalsePrint out the records, not messages
-v --versionfalsePrint the version and exit
-h --helpfalsePrint the help message and exit.

Examples:

# Search for everything from 2014-01-01.
sumo --query '*' --from '2014-01-01T00:00:00' --to '2014-01-01T23:59:59' --time-zone 'UTC'

# Search for everything containing 'StagingFitness' in 2013, extracting the 'message' key from the response.
sumo --query 'StagingFitness' --from '2013-01-01T00:00:00' --to '2014-01-01T00:00:00' --time-zone 'UTC' --extract-key 'message'

FAQs

Package last updated on 29 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc