> For the complete documentation index, see [llms.txt](https://lern.sunbird.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lern.sunbird.org/use/developer-guide/lms-service/telemetry-events.md).

# Logs, Telemetry Events

Telemetry is a specification to instrument all the key events. Using this specification reference applications & services will generate telemetry events. For more info refer Sunbird-Telemetry documentation [here](https://telemetry.sunbird.org/). Also to know how telemetry is processed refer to Telemetry Processing Documentation in <https://lern.sunbird.org/learn/telemetry-processing>.

Logs also use telemetry specification and request tracing/ tracking is accomplished by passing the request context into the logs and telemetry. This helps in troubleshooting issues. Request context has below details:

```
uid //user id from user authentication token in header (x-authenticated-user-token)
did //device id from request header (x-device-id)
sid //session id from request header (x-session-id)
reqId //request id from request header (x-request-id)
```

This request id also set to API response as msgid. This helps in tracking once request that invokes multiple APIs and flows.

<div data-full-width="true"><figure><img src="/files/3RlcjnV8sItyR5lVyY8G" alt=""><figcaption></figcaption></figure></div>

### Configuration

Telemetry has request context information and it is set during the telemetry logging.

Below are the properties set by the application to add the producer information into the telemetry data:

\#Telemetry producer related info

```
telemetry_pdata_id=local.sunbird.learning.service
telemetry_pdata_pid=learning-service
telemetry_pdata_ver=5.1.0
```

Telemetry is processed using logback in LMS service. logback.xml configuration has a ConsoleAppender, which will log the telemetry generated by the code to console. In server, these logs are then pushed to graylog for troubleshooting.&#x20;

### List of Events <a href="#list-of-events" id="list-of-events"></a>

<details>

<summary>Audit Event</summary>

```
Sample Event:
{
   "eid":"AUDIT",
   "ets":1649241154959,
   "ver":"3.0",
   "mid":"14e5a964-402c-4291-8fb6-a9f4cd2fb6c3",
   "actor":{
      "id":"a3c92f3f-6957-4626-8196-3951f3157d05",
      "type":"User"
   },
   "context":{
      "channel":"0126796199493140480",
      "pdata":{
         "id":"staging.diksha.app",
         "pid":"lms-service",
         "ver":"1.0"
      },
      "env":"CourseBatch",
      "did":"412acce677943edd5efd7dd0e986cd2bb829862f",
      "cdata":[
         {
            "id":"do_21347643166776524811456",
            "type":"Course"
         },
         {
            "id":"01347652394590208047",
            "type":"CourseBatch"
         },
         {
            "id":"14e5a964-402c-4291-8fb6-a9f4cd2fb6c3",
            "type":"Request"
         }
      ],
      "rollup":{
         
      }
   },
   "object":{
      "id":"a3c92f3f-6957-4626-8196-3951f3157d05",
      "type":"User",
      "rollup":{
         "l1":"do_21347643166776524811456"
      }
   },
   "edata":{
      "state":"Create",
      "type":"enrol",
      "props":[
         "courseId",
         "enrolledDate",
         "userId",
         "batchId",
         "active"
      ]
   }
}
```

</details>

<details>

<summary>Error Event</summary>

```
Sample Event:
{
   "eid":"ERROR",
   "ets":1649235152368,
   "ver":"3.0",
   "mid":"49932122-143e-384a-89e8-8f6c7334856e",
   "actor":{
      "id":"0ced9624-e65b-4fd0-a0d3-2f6e86dd3ef7",
      "type":"User"
   },
   "context":{
      "channel":"01272777697873100812",
      "pdata":{
         "id":"staging.sunbird.portal",
         "pid":"lms-service",
         "ver":"1.0"
      },
      "env":"Batch",
      "did":"4bd1aa17b232e391407a2466931acf1f",
      "cdata":[
         {
            "id":"49932122-143e-384a-89e8-8f6c7334856e",
            "type":"Request"
         }
      ],
      "rollup":{
         
      }
   },
   "edata":{
      "err":"INTERNAL_ERROR",
      "stacktrace":"controllers.BaseController.createCommonExceptionResponse(BaseController.java:501)controllers.BaseCon",
      "errtype":"api_access"
   }
}
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://lern.sunbird.org/use/developer-guide/lms-service/telemetry-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
