Skip to main content

Python wrapper library and CLI for papertrail API.

Project description

pypertrail
==========

|pypi| |travis| |doc| |pyup|

Python wrapper library and CLI for papertrail API.

Installation
------------

Install using pip:

.. code:: bash

You can't use 'macro parameter character #' in math mode export PAPERTRAIL_API_TOKEN=my_token
pypertrailuserslistViaimplicit /.pypertrail.yml:..code::bash echo "token: my_token" > ~/.pypertrail.yml
pypertrailuserslistVia(conf/c)option:..code::bash echo "token: my_token" > /path/to/config
pypertrailconf/path/to/configuserslistVia(token/t)option:..code::bash pypertrail --token my_token users list

Subcommands
~~~~~~~~~~~

.. code:: plain

Usage: pypertrail.py [OPTIONS] COMMAND [ARGS]...

Options:
-d, --debug Debug mode.
-p, --pretty Prettify JSON output.
-t, --token TEXT Papertrail API token.
-c, --conf TEXT Path to config (~/.pypertrail.yml).
--version Show the version and exit.
-h, --help Show this message and exit.

Commands:
accounts
archives
groups
saved_searches
search
systems
users

Accounts
~~~~~~~~

.. code:: plain

Usage: papertrail.py accounts [OPTIONS] COMMAND [ARGS]...

Options:
-h, --help Show this message and exit.

Commands:
list List account usage

Examples:

.. code:: bash

pypertrailprettyaccountslistArchives        ..code::plainUsage:papertrail.pyarchives[OPTIONS]COMMAND[ARGS]...Options:h,helpShowthismessageandexit.Commands:listListarchiveinformationExamples:..code::bash pypertrail --pretty archives list

Saved searches
~~~~~~~~~~~~~~

.. code:: plain

Usage: cli.py saved_searches [OPTIONS] COMMAND [ARGS]...

Options:
-h, --help Show this message and exit.

Commands:
create Create a saved search
delete Delete a saved search
list List saved_searches
show Show a saved search
update Update a saved search

Examples:

.. code:: bash

pypertrailsavedsearchescreatepayload"search[name]":"foo","search[query]":"bar" pypertrail saved_searches delete 1
pypertrailsavedsearcheslist pypertrail saved_searches show 1
pypertrailsavedsearchesupdate1payload"search[query]":"anotherquery"Groups      ..code::plainUsage:papertrail.pygroups[OPTIONS]COMMAND[ARGS]...Options:h,helpShowthismessageandexit.Commands:deleteDeleteagrouplistListgroupsshowShowagroupupdateUpdateagroupExamples:..code::bash pypertrail groups delete 1
pypertrailgroupslist pypertrail groups show 1
pypertrailgroupsupdate1payload"group[name]":"anothername"Search      ..code::plainUsage:papertrail.pysearchevents[OPTIONS]SearcheventsOptions:q,queryTEXTTermstoquery.s,systemINTEGERSystemtosearch.g,groupINTEGERGrouptosearch.e,mintimeINTEGEREarliesttimetosearchfrom.l,maxtimeINTEGERLatesttimetosearchfrom.f,followContinuerunningandprintingnewevents(off).d,delayINTEGERDelaybetweenrefresh(5).j,jsonOutputrawJSONdata(off).c,color[program|system|all|off]Attribute(s)tocolorizebasedon(program).h,helpShowthismessageandexit.Examples:..code::bash pypertrail search events
pypertrailsearcheventsfollow pypertrail search events --follow --color program
pypertrailsearcheventsfollowquerysshd pypertrail search events --follow --json

Systems
~~~~~~~

.. code:: plain

Usage: papertrail.py systems [OPTIONS] COMMAND [ARGS]...

Options:
-h, --help Show this message and exit.

Commands:
create Create a saved search
delete Delete a system
join_group Join a group
leave_group Leave a group
list List systems
show Show a system
update Update a system

Examples:

.. code:: bash

pypertrailsystemscreatepayload"system[name]":"foo","system[hostname]":"bar","destinationport":46865 pypertrail systems delete 1
pypertrailsystemsjoingroup1payload"groupid":10 pypertrail systems leave_group 1 --payload '{"group_id":10}'
pypertrailsystemslist pypertrail systems show 1
pypertrailsystemsupdate1payload"system[name]":"anothername"Users     ..code::plainUsage:papertrail.pyusers[OPTIONS]COMMAND[ARGS]...Options:h,helpShowthismessageandexit.Commands:deleteDeleteauserinviteInviteauserlistListusersExamples:..code::bash pypertrail users delete 1
pypertrailusersinvitepayload"email":"contact@quent.in","readonly":true pypertrail users list

Documentation
=============

- https://pypertrail.readthedocs.io
- http://help.papertrailapp.com/kb/how-it-works/http-api

History
=======

View the `changelog`_

Authors
=======

- `Quentin Rousseau`_

License
=======

.. code:: plain

Copyright (c) 2016 Quentin Rousseau <contact@quent.in>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

.. _changelog: https://github.com/kwent/pypertrail/blob/master/HISTORY.rst
.. _Quentin Rousseau: https://github.com/kwent

.. |pypi| image:: https://img.shields.io/pypi/v/pypertrail.svg
:target: https://pypi.python.org/pypi/pypertrail
.. |travis| image:: https://img.shields.io/travis/kwent/pypertrail.svg
:target: https://travis-ci.org/kwent/pypertrail
.. |doc| image:: https://readthedocs.org/projects/pypertrail/badge/?version=latest
:target: https://pypertrail.readthedocs.io/en/latest/?badge=latest
.. |pyup| image:: https://pyup.io/repos/github/kwent/pypertrail/shield.svg
:target: https://pyup.io/repos/github/kwent/pypertrail/


=======
History
=======

1.0.0 (2016-10-06)
------------------

* First release on PyPI.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page