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:
limitcannot exceed more than 5000.
startTimeandendTimeindicate the range for your log query. By default, it is set to last7days withstartTimebeing currentDateTime - 7 andendTimeas currentDateTime.
NOTE: The values are timestamps with
nanosecondprecisionUTC
directiondetermines order of the logs. It can haveforwardorbackwardas inputs,forwardretrieves logs in ascending order andbackwardin descending. Default value isdescendingand you will get the most recent logs firstfilterParamsprovides 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 beinfo,errormessage: Filter by messages likestart,finishsource: If a content is being played from a playlist or a channel, you can filter usingplaylist,channel-zonename: Name of the contentconsumer: Filter logs by addingstudiofilter to get onlystudiologs. By default removing this filter will get you all logs
NOTE: All filters in
filterParamscan 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"]}}) {statusdata}}
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\","}}