Skip to content
/ lepy Public

Python wrapper for Rapid7 Insight Logsearch API

License

Notifications You must be signed in to change notification settings

seamusc/lepy

Repository files navigation

LogSearch API

Build Status

lepy is a Python library to enable access to the Rapid7 Log Search API in an easy to use, programatic manner.

Install

python setup.py install

Example usage

>>> from logsearch.logsearch import LogSearch
>>> ls = LogSearch(API_KEY)
>>> web_log_id = 'e1dc8460-c28e-434e-b990-dd0faea894a8'
>>> query = 'where(response_code=500) calculate(count)'
>>> result = ls.search(log_ids=[web_log_id], query=query, time_range='Last 24 Hours')
Progress |################################| 100% 4s 0:00:00
>>> print result.display()
{
    "during": {
        "from": 1548706511751, 
        "time_range": "last 24 hours", 
        "to": 1548792911751
    }, 
    "statement": "where(response_code=500) calculate(count)"
}
Statistics response calculate( count )
Timestamp                   count
------------------------  -------
28/01/19 20:15:11.751000       92
28/01/19 17:51:11.751000       33
28/01/19 15:27:11.751000       12
28/01/19 13:03:11.751000       13
28/01/19 10:39:11.751000       14
28/01/19 08:15:11.751000      134
28/01/19 05:51:11.751000       80
28/01/19 03:27:11.751000      105
28/01/19 01:03:11.751000      386
27/01/19 22:39:11.751000      101

Releases

No releases published

Packages

No packages published