# Logs

## Log object

| **\_id** ObjectId | Log object instance identifier                                                                                                                                                                                                                                               |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **org** ObjectId  | Org identifier                                                                                                                                                                                                                                                               |
| **req** ObjectId  | Request identifier                                                                                                                                                                                                                                                           |
| **pid** ObjectId  | Principal Identifier - The principal is the authenticated entity that issued the request                                                                                                                                                                                     |
| **oid** ObjectId  | Original Principal Identifier - The original principal is the authenticated entity that issued the **first** request. The "run as" argument of scripts could make the pid different from oid.                                                                                |
| **beg** Date      | Start date of this log instance                                                                                                                                                                                                                                              |
| **end** Date      | End date of this log instance                                                                                                                                                                                                                                                |
| **sts** Number    | HTTP status code (like 2xx, 3xx, 4xx)                                                                                                                                                                                                                                        |
| **src** Number    | logger: 0 api: 1 script: 2 request: 3 audit: 4 deployment: 5 export: 6                                                                                                                                                                                                       |
| **lvl** Number    | error: 0 warn: 1 info: 2 debug: 3 trace: 4                                                                                                                                                                                                                                   |
| **trc** Document  | Stack trace (file, line number, function)                                                                                                                                                                                                                                    |
| **err** Document  | Error details (error name, message, reason, faults, etc)                                                                                                                                                                                                                     |
| **in** Number     | Total bytes in                                                                                                                                                                                                                                                               |
| **out** Number    | Total bytes out                                                                                                                                                                                                                                                              |
| **sid** ObjectId  | Script identifier                                                                                                                                                                                                                                                            |
| **stp** String    | Script type (like "route", "trigger", etc)                                                                                                                                                                                                                                   |
| **ops** Number    | Number of operations used in the script                                                                                                                                                                                                                                      |
| **ctt** Number    | Total number of HTTP callouts used in the script                                                                                                                                                                                                                             |
| **cms** Number    | Total milliseconds of HTTP callouts in the script                                                                                                                                                                                                                            |
| **adr** Number    | Source IP address                                                                                                                                                                                                                                                            |
| **mtd** Number    | Request method GET: 0 POST: 1 PUT: 2 DELETE: 3 HEAD: 4 OPTIONS: 5 PATCH: 6                                                                                                                                                                                                   |
| **url** String    | Request URL path                                                                                                                                                                                                                                                             |
| **que** Any       | Request query params                                                                                                                                                                                                                                                         |
| **rte** String    | API route                                                                                                                                                                                                                                                                    |
| **aid** ObjectId  | App ID                                                                                                                                                                                                                                                                       |
| **cid** ObjectId  | App client ID                                                                                                                                                                                                                                                                |
| **ses** String    | Session ID                                                                                                                                                                                                                                                                   |
| **lid** ObjectId  | Location ID                                                                                                                                                                                                                                                                  |
| **dat** Any       | Any data passed in via the Logger                                                                                                                                                                                                                                            |
| **op** Number     | **Operation Code** set: 1 remove: 2 // remove a property value push: 3 pull: 4 delete: 5 // delete an instance auth: 6 // authentication event transfer: 7 // ownership transfer device: 8 // new device registered for account access: 9 // instance access granted/removed |
| **ctx** ObjectId  | Context ID                                                                                                                                                                                                                                                                   |
| **obj** String    | Object Name                                                                                                                                                                                                                                                                  |
| **ads** Number    | **Audit Source** request: 1 script: 2 system: 3                                                                                                                                                                                                                              |
| **acs** Number    | Natural Access                                                                                                                                                                                                                                                               |
| **grt** Number    | Granted Access                                                                                                                                                                                                                                                               |
| **pts** String    | Updated Paths                                                                                                                                                                                                                                                                |
| **pis** ObjectId  | Updated Property Identifiers                                                                                                                                                                                                                                                 |
| **dpl** ObjectId  | Deployment Identifier                                                                                                                                                                                                                                                        |

```javascript
{
  "_id": "59433e6a8cb4760100c7216e",
  "adr": 1187315762,
  "aid": "5810f6e4cc761537539d3e2c",
  "beg": "2017-06-16T02:11:54.702Z",
  "cid": "5810f6e4cc761537539d3e2d",
  "end": "2017-06-16T02:11:55.199Z",
  "err": {
    "faults": []
  },
  "in": 417,
  "lvl": 2,
  "mtd": 0,
  "out": 525,
  "pis": [],
  "pts": [],
  "que": {
    "c_public_user": "593b2a2f9a8ca001000f0435",
    "c_study": "58faa94410cc4501001fe779"
  },
  "req": "59433e6a81ae9d0100e9fca7",
  "rte": "/routes/get_public_group*",
  "src": 3,
  "sts": 200,
  "trc": [],
  "url": "/routes/get_public_group"
}
```

## List

<mark style="color:blue;">`GET`</mark> `https://api.dev.medable.com/your_org_name/v2/logs`

#### Path Parameters

| Name            | Type   | Description |
| --------------- | ------ | ----------- |
| your\_org\_name | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "_id": "59433e6a7a90230100f4815f",
            "adr": 1187315762,
            "aid": "5810f6e4cc761537539d3e2c",
            "beg": "2017-06-16T02:11:54.248Z",
            "cid": "5810f6e4cc761537539d3e2d",
            "end": "2017-06-16T02:11:54.265Z",
            "err": {
                "faults": []
            },
            "in": 321,
            "lvl": 2,
            "mtd": 0,
            "out": 0,
            "pis": [],
            "pts": [],
            "req": "59433e6ab3eb3f0100ded3bd",
            "rte": "/",
            "src": 3,
            "sts": 200,
            "trc": [],
            "url": "/"
        },
        {
            "_id": "59433e6a8cb4760100c7216e",
            "adr": 1187315762,
            "aid": "5810f6e4cc761537539d3e2c",
            "beg": "2017-06-16T02:11:54.702Z",
            "cid": "5810f6e4cc761537539d3e2d",
            "end": "2017-06-16T02:11:55.199Z",
            "err": {
                "faults": []
            },
            "in": 417,
            "lvl": 2,
            "mtd": 0,
            "out": 525,
            "pis": [],
            "pts": [],
            "que": {
                "c_public_user": "593b2a2f9a8ca001000f0435",
                "c_study": "58faa94410cc4501001fe779"
            },
            "req": "59433e6a81ae9d0100e9fca7",
            "rte": "/routes/get_public_group*",
            "src": 3,
            "sts": 200,
            "trc": [],
            "url": "/routes/get_public_group"
        },
        {
            "_id": "59433e6a8cb4760100c72170",
            "beg": "2017-06-16T02:11:54.904Z",
            "cms": 0,
            "ctt": 0,
            "dat": [
                19
            ],
            "end": "2017-06-16T02:11:54.904Z",
            "err": {
                "faults": []
            },
            "in": 0,
            "lvl": 2,
            "oid": "000000000000000000000001",
            "ops": 362,
            "out": 0,
            "pid": "58e2745649b3c401002b53d7",
            "pis": [],
            "pts": [],
            "req": "59433e6a81ae9d0100e9fca7",
            "sid": "59139ef6b0cc5f01004714d8",
            "src": 0,
            "stp": "route",
            "sts": 200,
            "trc": []
        }
      ],
    "hasMore": true,
    "object": "list"
}
```

{% endtab %}

{% tab title="400 " %}

```
{}
```

{% endtab %}
{% endtabs %}

```javascript
$.ajax({
    url: "https://api.dev.medable.com/example/v2/logs",
    method: "GET",
    dataType : "json",
    xhrFields: {
        withCredentials: true
    },
    headers: {
        "Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
    }
}).done(function(data) {
    // ...
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.medable.com/cortex-api/objects/logs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
