Studio Service

Tutorial: Get/Export playback logs

Tutorial: Get Playback Logs

In order to retrieve playback logs via API, we will need to use the getPlaybackLogs query. Search the Reference for the getPlaybackLogs query.

getPlaybackLogs requires GetPlaybackLogsInput type. The input is totally optional. If you don't send any input by default you will receive logs for the past week.

(See the GetPlaybackLogsInput fields)

1.limit. You can set how many logs you want to be returned. Default value is 5000

NOTE: limit cannot exceed more than 5000.

  1. startTime and endTime indicate the range for your log query. By default, it is set to last 7 days with startTime being currentDateTime - 7 and endTime as currentDateTime.

NOTE: The values are timestamps with nanosecond precision UTC

  1. direction determines order of the logs. It can have forward or backward as inputs, forward retrieves logs in ascending order and backward in descending. Default value is descending and you will get the most recent logs first

  2. filterParams provides a wide range of options which can be used to filter logs by a specific screen/content/space etc., By default no filters are applied (See the GetLogsFilterParams fields)

    Most of the fields are self-explanatory. Few odd ones are:

    • keyword : This acts like a universal search, you can query by any keyword like Content name,Screen name,Space etc.,
    • type : Filter logs by type can be info, error
    • message : Filter by messages like start, finish
    • source : If a content is being played from a playlist or a channel, you can filter using playlist,channel-zone
    • name : Name of the content
    • consumer : Filter logs by adding studio filter to get only studio logs. By default removing this filter will get you all logs

NOTE: All filters in filterParams can take multiple values. Meaning you can query multiple screens/spaces/content names in a single API call.

query{
getPlaybackLogs(input:{
limit:500,
filterParams: {
"screenName": ["Lobby Screen","Reception"],
"spaceName":["London","Bangkok"]
}
}) {
status
data
}
}

Tutorial: Export Playback Logs

In order to export playback logs, we will need to use the exportPlaybackLogs query. Search the Reference for the exportPlaybackLogs query.

exportPlaybackLogs requires ExportPlaybackLogsInput type. The input is totally optional. If you don't send any input by default you will receive logs for the past week.

(See the ExportPlaybackLogsInput fields)

All the input data for querying exportPlaybackLogs is similar to getPlaybackLogs. Get playback logs retrieves data as a JSON response where as export logs gives you in CSV string format.

query{
exportPlaybackLogs(input:{
limit:500,
filterParams: {
"screenName": ["Lobby Screen","Reception"],
"spaceName":["London","Bangkok"]
}
})
}

Graphql API doesn't support other content-types than application/json so the response will come as a string and columns with comma(,) separated values, /n can be used to identify the next row of CSV file. Sample response is attached below.

{
"data": {
"exportPlaybackLogs": "\"timestamp\",\"type\",\"message\",\"spaceId\",\"spaceName\",\"screenId\",\"screenName\",\"platform\",\"contentId\",\"contentType\",\"name\",\"appid\",\"appname\",\"instanceId\",\"appViewerUrl\",\"viewUrl\",\"source\",\"channelZoneId\",\"channelId\",\"channelName\",\"playlistId\",\"playlistName\",\"playbackType\",\"playerVersion\",\"studioPlayerVersion\"\n\"Oct 26, 2021, 9:26:10 AM GMT+00:00\",\"info\",\"Show Image test.jpeg\",,\"Default\",\"test-id\",\"Test Browser Player\",\"browser\",,\"image/jpeg\",\"test.jpeg\",,,,,,,,,,,,,,\n\"Oct 26, 2021, 9:26:10 AM GMT+00:00\",\"info\",\"Start playback\",\"test-id\",\"Default\",\"test-id\",\"Test Browser Player\",\"browser\",\"test-id\",\"file\",\"test.jpeg\",,,,,,\"playlist\",,,,\"test-id\",\"Test Gallery\",\"timeline\",\"test-id\","
}
}