OpenVidu CDR
OpenVidu Server offers a CDR logging system that informs about all the relevant events that take place in the system. To start OpenVidu Server with CDR enabled, set configuration property OPENVIDU_CDR=true
. The CDR file location is given by configuration property OPENVIDU_CDR_PATH
, default to /opt/openvidu/cdr
.
The CDR file is a plain UTF-8 text file complying with JSON Lines format: one standard JSON entry for each line. All JSON entries share the following structure:
{"EVENT_NAME": {"timestamp": 1234567890, "PROP_1":"VAL_1", "PROP_2":"VAL_2", ... , "PROP_N":"VAL_N" }}
So every entry is a JSON object with a single key (the event name) and a JSON object as value (the event content). This JSON value follows this format:
timestamp
: a number with the time when the event was registered in UTC milliseconds.PROP_1
,PROP_2
...PROP_N
: custom properties for each specific event. Their name and type differ from each other.
Events in OpenVidu CDR 🔗
- sessionCreated
- sessionDestroyed
- participantJoined
- participantLeft
- webrtcConnectionCreated
- webrtcConnectionDestroyed
- recordingStatusChanged
- filterEventDispatched
- mediaNodeStatusChangedPRO
- autoscalingPRO
sessionCreated 🔗
Recorded when a new session has been created.
Property | Description | Value |
---|---|---|
sessionId |
Session for which the event was triggered | A string with the session unique identifier |
timestamp |
Time when the event was triggered | UTC milliseconds |
{
"sessionCreated": {
"sessionId": "ses_Jd8tUyvhXO",
"timestamp": 1601394690713
}
}
sessionDestroyed 🔗
Recorded when a session has finished.
Property | Description | Value |
---|---|---|
sessionId |
Session for which the event was triggered | A string with the session unique identifier |
timestamp |
Time when the event was triggered | UTC milliseconds |
startTime |
Time when the session started | UTC milliseconds |
duration |
Total duration of the session | Seconds |
reason |
Why the session was destroyed | ["lastParticipantLeft" ,"sessionClosedByServer" ,"openviduServerStopped" ] |
{
"sessionDestroyed": {
"sessionId": "ses_Jd8tUyvhXO",
"timestamp": 1601395365656,
"startTime": 1601394690713,
"duration": 674,
"reason": "lastParticipantLeft"
}
}
participantJoined 🔗
Recorded when a user has connected to a session.
Property | Description | Value |
---|---|---|
sessionId |
Session for which the event was triggered | A string with the session unique identifier |
timestamp |
Time when the event was triggered | UTC milliseconds |
participantId |
Identifier of the participant | A string with the participant unique identifier |
location |
Geo location of the participant PRO | A string with format "CITY, COUNTRY" (or "unknown" ) |
platform |
Complete description of the platform used by the participant to connect to the session | A string with the platform description |
clientData |
Metadata associated to this participant from the client side. This corresponds to parameter metadata of openvidu-browser method Session.connect |
A string with the participant client-side metadata (generated when calling Session.connect method) |
serverData |
Metadata associated to this participant from the server side. This corresponds to parameter data of REST API operation POST /openvidu/api/sessions/<SESSION_ID>/connection or its Java/Node server SDKs variants |
A string with the participant server-side metadata |
{
"participantJoined": {
"sessionId": "ses_Jd8tUyvhXO",
"timestamp": 1601394715606,
"participantId": "con_EIeO06zgMz",
"location": "Berlin, Germany",
"platform": "Chrome 85.0.4183.121 on Linux 64-bit",
"clientData": "Mike",
"serverData": "{'user': 'client1'}"
}
}
participantLeft 🔗
Recorded when a user has left a session.
Property | Description | Value |
---|---|---|
sessionId |
Session for which the event was triggered | A string with the session unique identifier |
timestamp |
Time when the event was triggered | UTC milliseconds |
participantId |
Identifier of the participant | A string with the participant unique identifier |
location |
Geo location of the participant PRO | A string with format "CITY, COUNTRY" (or "unknown" ) |
platform |
Complete description of the platform used by the participant to connect to the session | A string with the platform description |
clientData |
Metadata associated to this participant from the client side. This corresponds to parameter metadata of openvidu-browser method Session.connect |
A string with the participant client-side metadata (generated when calling Session.connect method) |
serverData |
Metadata associated to this participant from the server side. This corresponds to parameter data of REST API operation POST /openvidu/api/sessions/<SESSION_ID>/connection or its Java/Node server SDKs variants |
A string with the participant server-side metadata |
startTime |
Time when the participant joined the session | UTC milliseconds |
duration |
Total duration of the participant's connection to the session | Seconds |
reason |
How the participant left the session | ["disconnect" ,"forceDisconnectByUser" ,"forceDisconnectByServer" ,"sessionClosedByServer" ,"networkDisconnect" ,"openviduServerStopped" ] |
{
"participantLeft": {
"sessionId": "ses_Jd8tUyvhXO",
"timestamp": 1601395365655,
"startTime": 1601394715606,
"duration": 650,
"reason": "disconnect",
"participantId": "con_EIeO06zgMz",
"location": "Berlin, Germany",
"platform": "Chrome 85.0.4183.121 on Linux 64-bit",
"clientData": "Mike",
"serverData": "{'user': 'client1'}"
}
}
webrtcConnectionCreated 🔗
Recorded when a new media stream has been established. Can be an "INBOUND" connection (the user is receiving a stream from a publisher of the session) or an "OUTBOUND" connection (the user is a publishing a stream to the session).
Property | Description | Value |
---|---|---|
sessionId |
Session for which the event was triggered | A string with the session unique identifier |
timestamp |
Time when the event was triggered | UTC milliseconds |
participantId |
Identifier of the participant | A string with the participant unique identifier |
connection |
Whether the media connection is an inbound connection (the participant is receiving media from OpenVidu) or an outbound connection (the participant is sending media to OpenVidu) | ["INBOUND" ,"OUTBOUND" ] |
receivingFrom |
If connection is "INBOUND" , the participant from whom the media stream is being received |
A string with the participant (sender) unique identifier |
audioEnabled |
Whether the media connection has negotiated audio or not | [true ,false ] |
videoEnabled |
Whether the media connection has negotiated video or not | [true ,false ] |
videoSource |
If videoEnabled is true , the type of video that is being transmitted |
["CAMERA" ,"SCREEN" ] |
videoFramerate |
If videoEnabled is true , the framerate of the transmitted video |
Number of fps |
videoDimensions |
If videoEnabled is true , the dimensions transmitted video |
String with the dimensions (e.g. "1920x1080" ) |
{
"webrtcConnectionCreated": {
"sessionId": "ses_Jd8tUyvhXO",
"timestamp": 1601394849759,
"streamId": "str_CAM_GPdf_con_EIeO06zgMz",
"participantId": "con_ThN5Rgi8Y8",
"connection": "INBOUND",
"receivingFrom": "con_EIeO06zgMz",
"videoSource": "CAMERA",
"videoFramerate": 30,
"videoDimensions": "{\"width\":1280,\"height\":720}",
"audioEnabled": true,
"videoEnabled": true
}
}
webrtcConnectionDestroyed 🔗
Recorded when any media stream connection is closed.
Property | Description | Value |
---|---|---|
sessionId |
Session for which the event was triggered | A string with the session unique identifier |
timestamp |
Time when the event was triggered | UTC milliseconds |
participantId |
Identifier of the participant | A string with the participant unique identifier |
connection |
Whether the media connection is an inbound connection (the participant is receiving media from OpenVidu) or an outbound connection (the participant is sending media to OpenVidu) | ["INBOUND" ,"OUTBOUND" ] |
receivingFrom |
If connection is "INBOUND" , the participant from whom the media stream is being received |
A string with the participant (sender) unique identifier |
audioEnabled |
Whether the media connection has negotiated audio or not | [true ,false ] |
videoEnabled |
Whether the media connection has negotiated video or not | [true ,false ] |
videoSource |
If videoEnabled is true , the type of video that is being transmitted |
["CAMERA" ,"SCREEN" ] |
videoFramerate |
If videoEnabled is true , the framerate of the transmitted video |
Number of fps |
videoDimensions |
If videoEnabled is true , the dimensions transmitted video |
String with the dimensions (e.g. "1920x1080" ) |
startTime |
Time when the media connection was established | UTC milliseconds |
duration |
Total duration of the media connection | Seconds |
reason |
How the WebRTC connection was destroyed | ["unsubscribe" ,"unpublish" ,"disconnect" ,"forceUnpublishByUser" ,"forceUnpublishByServer" ,"forceDisconnectByUser" ,"forceDisconnectByServer" ,"sessionClosedByServer" ,"networkDisconnect" ,"openviduServerStopped" ,"mediaServerDisconnect" ] |
{
"webrtcConnectionDestroyed": {
"sessionId": "ses_Jd8tUyvhXO",
"timestamp": 1601394894238,
"startTime": 1601394849759,
"duration": 44,
"reason": "unsubscribe",
"streamId": "str_CAM_GPdf_con_EIeO06zgMz",
"participantId": "con_ThN5Rgi8Y8",
"connection": "INBOUND",
"receivingFrom": "con_EIeO06zgMz",
"videoSource": "CAMERA",
"videoFramerate": 30,
"videoDimensions": "{\"width\":1280,\"height\":720}",
"audioEnabled": true,
"videoEnabled": true
}
}
recordingStatusChanged 🔗
Recorded when the status of a recording has changed. The status may be:
started
: the session is being recorded. This means the associated video(s) already exists and its size is greater than 0. NOTE: when using COMPOSED recording with video, this event does not mean there are publisher's streams being actually recorded in the video file. It only ensures the video file exists and its size is greater than 0.stopped
: the recording process has stopped and files are being processed. Depending on the type of OpenVidu deployment and configuration, properties duration and size can be set to 0 and url can be null. If this is the case, wait for status ready to get the final value of these properties.ready
: the recorded file has been successfully processed and is available for download. Properties duration, size and url will always be properly defined at this moment. For OpenVidu Pro deployments configured to upload recordings to S3 this status means that the recording has been successfully stored in the S3 bucket.failed
: the recording process has failed. The final state of the recorded file cannot be guaranteed to be stable.
Property | Description | Value |
---|---|---|
sessionId |
Session for which the event was triggered | A string with the session unique identifier |
timestamp |
Time when the event was triggered | UTC milliseconds |
startTime |
Time when the recording started | UTC milliseconds |
id |
Unique identifier of the recording | A string with the recording unique identifier |
name |
Name given to the recording file | A string with the recording name |
outputMode |
Output mode of the recording (COMPOSED or INDIVIDUAL ) |
A string with the recording output mode |
hasAudio |
Whether the recording file has audio or not | [true ,false ] |
hasVideo |
Whether the recording file has video or not | [true ,false ] |
recordingLayout |
The type of layout used in the recording. Only defined if outputMode is COMPOSED and hasVideo is true |
A RecordingLayout value (BEST_FIT, PICTURE_IN_PICTURE, CUSTOM ...) |
resolution |
Resolution of the recorded file. Only defined if outputMode is COMPOSED and hasVideo is true |
A string with the width and height of the video file in pixels. e.g. "1280x720" |
size |
The size of the video file. Only guaranteed to be greater than 0 if status is ready |
Bytes |
duration |
Duration of the video file. Only guaranteed to be greater than 0 if status is ready |
Seconds |
status |
Status of the recording | ["started" ,"stopped" ,"ready" ,"failed" ] |
reason |
Why the recording stopped. Only defined when status is stopped or ready | ["recordingStoppedByServer" ,"lastParticipantLeft" ,"sessionClosedByServer" ,"automaticStop" ,"openviduServerStopped" , "mediaServerDisconnect" ] |
{
"recordingStatusChanged": {
"sessionId": "ses_Jd8tUyvhXO",
"timestamp": 1601395005555,
"startTime": 1601394992838,
"duration": 8.6,
"reason": "recordingStoppedByServer",
"id": "ses_Jd8tUyvhXO",
"name": "MyRecording",
"outputMode": "COMPOSED",
"resolution": "1920x1080",
"recordingLayout": "BEST_FIT",
"hasAudio": true,
"hasVideo": true,
"size": 1973428,
"status": "ready"
}
}
filterEventDispatched 🔗
Recorded when a filter event has been dispatched. This event can only be triggered if a filter has been applied to a stream and a listener has been added to a specific event offered by the filter. See Voice and video filters to learn more.
Property | Description | Value |
---|---|---|
sessionId |
Session for which the event was triggered | A string with the session unique identifier |
timestamp |
Time when the event was triggered | UTC milliseconds |
participantId |
Identifier of the participant | A string with the participant unique identifier |
streamId |
Identifier of the stream for which the filter is applied | A string with the stream unique identifier |
filterType |
Type of the filter applied to the stream | A string with the type of filter |
eventType |
Event of the filter that was triggered | A string with the type of event |
data |
Data of the filter event | A string with the data returned by the filter event. Its value will depend on the type of filter and event |
{
"filterEventDispatched": {
"sessionId": "ses_Jd8tUyvhXO",
"timestamp": 1601394994829,
"participantId": "con_EIeO06zgMz",
"streamId": "str_CAM_GPdf_con_EIeO06zgMz",
"filterType": "ZBarFilter",
"eventType": "CodeFound",
"data": "{timestampMillis=1568645808285, codeType=EAN-13, source=23353-1d3c_kurento.MediaPipeline/1f56f4a5-807c-71a30d40_kurento.ZBarFilter, type=CodeFound, value=0012345678905, tags=[], timestamp=1568645808}"
}
}
mediaNodeStatusChanged 🔗
Recorded when the status of a Media Node of an OpenVidu Pro cluster has changed. Below you have the finite-state machine defining the lifecycle of a Media Node and all of the possible transitions between its statuses. Visit Scalability section for a full description of them.
Property | Description | Value |
---|---|---|
id |
Unique identifier of the Media Node | A string with the Media Node unique identifier |
environmentId |
Unique identifier of the Media Node, dependent on the deployment environment. For example, an AWS EC2 machine id if the cluster is deployed in AWS | A string with the Media Node environment unique identifier |
ip |
IP of the Media Node | A string with the Media Node IP |
uri |
URI of the Media Node. This is the actual direction where OpenVidu Server Pro Media Node connects to this Media Node | A string with the Media Node URI |
clusterId |
OpenVidu Pro cluster identifier. This allows you to identify the specific cluster to which the Media Node triggering this event belongs, especially if you have more than one OpenVidu Pro cluster running (see ) | A string with the cluster identifier |
oldStatus |
Old status of the Media Node. See Media Node statuses | A string with the Media Node old status. null if newStatus is launching |
newStatus |
New status of the Media Node. See Media Node statuses | A string with the Media Node new status |
timestamp |
Time when the event was triggered | UTC milliseconds |
Example:
{
"mediaNodeStatusChanged": {
"timestamp": 1583750581667,
"id": "kms_V3B5OxT7",
"environmentId": "c76535087c5767b83a211036197115d071daf897bfd951bc18f834fc535d9fa9",
"ip": "172.17.0.3",
"uri": "ws://172.17.0.3:8888/kurento",
"newStatus": "running",
"oldStatus": "launching",
"clusterId": "MY_CLUSTER"
}
}
autoscaling 🔗
Recorded when autoscaling is enabled and the autoscaling algorithm has generated any kind of change in the status of the Media Nodes. This includes Media Nodes that must be launched and Media Nodes that must be terminated, taking into account the different statuses the Media Nodes may have in order to make the most optimal decision. That is: which specific Media Nodes must transit from which previous status to which new status in order to reach the new desired number of Media Nodes in the least possible amount of time.
For example, when a new Media Node is needed, the algorithm will always prioritize transitioning Media Nodes in waiting-idle-to-terminate
status to running
status, instead of launching a brand new Media Node. And if some Media Node must be removed because the load is low enough, the algorithm will always cancel any launching
Media Node (setting its status to canceled
) instead of removing a running one. Check out Media Node statuses and austocaling sections to learn more.
An autoscaling event will always be followed by one or more mediaNodeStatusChanged events applying the required changes to the cluster.
Property | Description | Value |
---|---|---|
clusterId |
Unique identifier of this OpenVidu Pro cluster (configuration property OPENVIDU_PRO_CLUSTER_ID ) |
A string with the OpenVidu Pro cluster unique identifier |
reason |
A detailed description of why the autoscaling algorithm triggered this adjustment on the cluster size | A string with the reason of the autoscaling event |
mediaNodes |
An object with the Media Nodes affected by the autoscaling event | See mediaNodes |
system |
An object with a complete description of the system regarding the state of autoscaling | See system |
timestamp |
Time when the event was triggered | UTC milliseconds |
mediaNodes 🔗
Property | Description | Value |
---|---|---|
launch |
Media Nodes that are going to be added to the cluster | An object with 4 properties:
|
terminate |
Media Nodes that are going to be removed from the cluster | An object with 3 properties:
|
mediaNode 🔗
Property | Description | Value |
---|---|---|
id |
Unique identifier of the Media Node | A string with the Media Node unique identifier |
environmentId |
Unique identifier of the Media Node, dependent on the deployment environment. For example, an AWS EC2 machine id if the cluster is deployed in AWS | A string with the Media Node environment unique identifier |
ip |
IP of the Media Node | A string with the Media Node IP |
load |
The CPU load of the Media Node | A decimal number between 0.00 and 100.00 |
status |
Status of the Media Node. See Media Node statuses | A string with the Media Node new status |
system 🔗
Property | Description | Value |
---|---|---|
config |
Autoscaling configuration | An object with 4 properties with the current autoscaling-related configuration properties:
|
status |
Current cluster status, including a complete description of its Media Nodes and the current load of the cluster | See status |
status 🔗
Property | Description | Value |
---|---|---|
numNodes |
Total number of active Media Nodes in the cluster. Active nodes are those in running or launching status |
A number |
totalLoad |
Total CPU load of the cluster. It is calculated with the sum of all Media Nodes that may have load greater than 0: those in running or waiting-idle-to-terminate status |
A decimal number |
avgLoad |
The average load per Media Node. It is calculated by dividing totalLoad by numNodes . This parameter is the one compared to the limits set with configuration properties OPENVIDU_PRO_CLUSTER_AUTOSCALING_MAX_LOAD and OPENVIDU_PRO_CLUSTER_AUTOSCALING_MIN_LOAD to determine if the the cluster size must be modified |
A decimal number between 0.00 and 100.00 |
runningNodes |
Media Nodes in running status |
Array of mediaNode |
launchingNodes |
Media Nodes in launching status |
Array of mediaNode |
waitingIdleToTerminateNodes |
Media Nodes in waiting-idle-to-terminate status |
Array of mediaNode |
canceledNodes |
Media Nodes in canceled status |
Array of mediaNode |
Example:
{
"autoscaling": {
"clusterId": "MY_CLUSTER",
"reason": "The cluster average load (7.95%) is below its limits [30.00%, 70.00%] and the lower limit of Media Nodes (1) has not been reached. Current number of active nodes is 3 (2 launching and 1 running). 2 launching Media Nodes will be canceled.",
"mediaNodes": {
"launch": {
"total": 0,
"newNodes": 0,
"waitingIdleToTerminateNodes": [],
"canceledNodes": []
},
"terminate": {
"total": 2,
"runningNodes": [],
"launchingNodes": [
{
"id": "kms_MdNUPBwS",
"environmentId": null,
"ip": null,
"load": 0,
"status": "launching"
},
{
"id": "kms_Imvwxeny",
"environmentId": null,
"ip": null,
"load": 0,
"status": "launching"
}
]
}
},
"system": {
"config": {
"maxNodes": 3,
"minNodes": 1,
"maxAvgLoad": 70,
"minAvgLoad": 30
},
"status": {
"numNodes": 3,
"totalLoad": 23.84,
"avgLoad": 7.946666666666666,
"runningNodes": [
{
"id": "kms_M5VJ2N69",
"environmentId": "19e279f27f150764d26963f63d428b5e4841ff58aeffad352e4cc35fde4b2209",
"ip": "172.17.0.2",
"load": 23.84,
"status": "running"
}
],
"launchingNodes": [
{
"id": "kms_Imvwxeny",
"environmentId": null,
"ip": null,
"load": 0,
"status": "launching"
},
{
"id": "kms_MdNUPBwS",
"environmentId": null,
"ip": null,
"load": 0,
"status": "launching"
}
],
"waitingIdleToTerminateNodes": [],
"canceledNodes": []
}
},
"timestamp": 1592994854492
}
}