GET Logs

GET Logs


Request used to list all Logs for an account

URL

https://REGION.rest.logs.insight.rapid7.com/management/logs

REGION is the data center for your account - e.g. "us" or "eu"

Method

GET

Authentication

Read Write or Read Only key is required.

URL Params

None

Data Params

None

Success Response

Code 200Content:

json
1
{
2
"logs": [
3
{
4
"logsets_info": [
5
{
6
"id": "ecca4c14-338d-4452-b842-5fca8c86b9cb",
7
"links": [
8
{
9
"href": "https://us.rest.logs.insight.rapid7.com/management/logsets/0f5e4d20-fef3-4b91-b4c2-c2573466bbdd",
10
"rel": "Self"
11
}
12
],
13
"name": "MyLogSet"
14
}
15
],
16
"name": "MyLog",
17
"user_data": {
18
"le_agent_filename": "/var/log/anaconda.log",
19
"le_agent_follow": "true"
20
},
21
"tokens": [],
22
"source_type": "AGENT",
23
"token_seed": null,
24
"structures": [],
25
"id": "4e6dadf9-961e-48f4-82cf-452de78eb217"
26
},{
27
"logsets_info": [
28
{
29
"id": "7162e19e-3711-4f63-9833-d042f5c70f85",
30
"links": [
31
{
32
"href": "https://us.rest.logs.insight.rapid7.com/management/logsets/3aa5da13-3bb6-4457-ab6c-0d6b01ec892d",
33
"rel": "Self"
34
}
35
],
36
"name": "MyOtherLogSet"
37
}
38
],
39
"name": "MyOtherLog",
40
"user_data": {
41
"le_agent_filename": "",
42
"le_agent_follow": "false"
43
},
44
"tokens": [
45
"70347838-87d8-43f7-82cc-fb6f63623893"
46
],
47
"source_type": "TOKEN",
48
"token_seed": null,
49
"structures": [],
50
"id": "7a70d526-b69f-4030-904f-62dfd25d8d03"
51
}
52
53
]
54
}

Sample Call

python
1
import requests
2
import json
3
import time
4
5
API_KEY = '00112233-4455-6677-8899-aabbccddeeff'
6
7
def handle_response(resp):
8
response = resp
9
time.sleep(1)
10
if response.status_code == 200:
11
print json.dumps(resp.json(), indent=4)
12
else:
13
print response.status_code
14
15
def make_request(provided_url=None):
16
headers = {'x-api-key': API_KEY}
17
18
url = "https://us.rest.logs.insight.rapid7.com/management/logs"
19
req = requests.get(url, headers=headers)
20
return req
21
22
23
def get_logs():
24
req = make_request()
25
handle_response(req)
26
27
def start():
28
get_logs()
29
30
if __name__ == '__main__':
31
start()

Notes