Coder Social home page Coder Social logo

geek-boy / sumologic-cli Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 105 KB

This application allows you to run queries against the Sumologic Search Job API (https://help.sumologic.com/APIs/Search-Job-API/About-the-Search-Job-API). It will download resuts locally to your home directory.

PHP 100.00%
sumologic api query queries

sumologic-cli's Introduction

Sumologic CLI

Tool for running Sumologic queries from the command line. This application allows you to run queries against the Sumologic Search Job API (https://help.sumologic.com/APIs/Search-Job-API/About-the-Search-Job-API). It will download resuts locally to your home directory.

Installation

After cloning the repository then install using composer from the code directory:

composer install

Once this is done you should be good to use the application by using:

./sumologic-cli

The main command, query:run, makes a request to the Sumologic Job Search API to run a Query and save results locally. The search query for the Sumologic Job Search API can be provided either from a file, if it is more complex, or by using the --search-query option for simpler search queries.

Examples ways to run the query:run command:

  • sumologic-cli query:run /home/user/query_file 2021-06-05T11:09:00 2021-06-05T12:09:00
  • sumologic-cli query:run --end="-7days" /home/user/query_file.txt 2021-06-05T11:09:00
  • sumologic-cli query:run --format=csv /home/user/query_file 2021-06-05T11:09:00 2021-06-05T12:09:00
  • sumologic-cli query:run --search-query="namespace=agoorah.apache-access" 2021-06-05T11:09:00 2021-06-05T12:09:00
  • sumologic-cli query:run --search-query="namespace=agoorah.apache-access" --start="-2hours" --end="-1hour"
  • sumologic-cli query:run --search-query="namespace=agoorah.apache-access" --start="-2hours" --end="-1hour" --format=tab
  • sumologic-cli query:run --search-query="namespace=agoorah.apache-access" --start="-2hours"
  • sumologic-cli query:run --search-query="namespace=agoorah.apache-access" --fields-only --start="-2hours" --end="-1hour"
  • sumologic-cli query:run --search-query="namespace=agoorah.apache-access" --fields-only --start="-2hours" --end="-1hour" --format=tab

See https://www.php.net/manual/en/class.datetimeinterface.php for ISO Date format.

See https://www.php.net/manual/en/datetime.formats.relative.php for valid relative time formats.

sumologic-cli's People

Contributors

geek-boy avatar nupurlohokare avatar purencool avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mcdruid jonpizzle

sumologic-cli's Issues

Fix up $input reference for PHP 8

When running the code for PHP 8 the following error occurs when attempting to download messages:

PHP Fatal error:  Uncaught TypeError: Symfony\Component\Console\Helper\QuestionHelper::ask(): Argument #1 ($input) must be of type Symfony\Component\Console\Input\InputInterface, null given, called in /Users/mark.corben/Projects/sumologic-cli/src/Command/QueryRunCommand.php on line 648 and defined in /Users/mark.corben/Projects/sumologic-cli/vendor/symfony/console/Helper/QuestionHelper.php:48
Stack trace:
#0 /Users/mark.corben/Projects/sumologic-cli/src/Command/QueryRunCommand.php(648): Symfony\Component\Console\Helper\QuestionHelper->ask(NULL, Object(Symfony\Component\Console\Output\ConsoleOutput), Object(Symfony\Component\Console\Question\ConfirmationQuestion))
#1 /Users/mark.corben/Projects/sumologic-cli/src/Command/QueryRunCommand.php(478): App\Command\QueryRunCommand->saveQueryResults(Object(Symfony\Component\Console\Output\ConsoleOutput), '3A888A79A7F3A39...', 31, 0, 10000, 'json', 'messages')
#2 /Users/mark.corben/Projects/sumologic-cli/vendor/symfony/console/Command/Command.php(256): App\Command\QueryRunCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /Users/mark.corben/Projects/sumologic-cli/vendor/symfony/console/Application.php(971): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Example command that produces error:

./sumologic-cli query:run --search-query="amplife.php-errors \"2021-09-09T23:24:35\"" --start="-6days" --end="now"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.