Logging

From open-smil
Jump to: navigation, search

Implementation

Designating a URL to the Log Storage. Add the following scripts to the head of a SMIL script to define the log's destination:

<head>
  <metadata>
    <x-server xmlns="http://schemas.open-smil.org/smartapi-1.0">
      <subscriptionList>
        <subscription>
          <type>PlaylogCollection</type>
          <action>http://server/webdav_path</action>
          <method>put</method>
          <refreshInterval>3600</refreshInterval>
          <retryInterval>3600</retryInterval>
        </subscription>
      </subscriptionList>
    </x-server>
  </metadata>
</head>

Logs will be sent to a WebDAV-enabled log server and the server location is defined by adding <action>http://server/webdav_path</action>. The report update frequency can be controlled by adding an extra <refreshInterval> tag to adjust the refresh interval. A log file named as "playlog-{time-based-uuid}.xml" will be created on the server.

File name example: playlog-0b024720-9109-11e5-b487-0050c2b377f3.xml

Time-based-uuid version 1 is a combination of node identifier (MAC address), time-stamp and a random seed. The version one generator uses the commons-discovery package to determine the implementation. The implementations are specified by system properties. The UUID specification is written with the frame of reference that one or more physical (MAC address) node identifiers belong to a machine.

Sending logs to server-side script If the assigned server does not support WebDAV, a server-side script can be implemented instead to handle an HTTP PUT against the URL http://server/webdav_path/playlog-{time-based-uuid}.xml. Since the URL is dynamic and time-based, the server configuration is needed to be modified so the PUT requests will be redirected to the handler. Popular servers like Apache and Microsoft IIS support URL rewriting.

Microsoft IIS

1. Set up a rewrite rule to match regular expression "webdav_path/playlog-(.*).xml" (where webdav_path is replaced by the specified "action" field)

2. Have the rewrite rule rendered as "loghandler.aspx?{R:1}" (where {R:1} is to be replaced by the pattern matched) so the handler (here loghandler.aspx as an example) will receive the time-based UUID as its query parameter.

Play logs

Logging in SMIL is implemented by using the PUT method on a HTTP server.

Designating a Log ID to a Media File

Logging will be enabled if a log ID is assigned to a media file:

<video src="http://server/video.mpg">
  <param name="logContentId" value="uuid-video" />
</video>

uuid-video is a string (user defined) for identification of a media. This ID will be sent to the log server when a media with log ID is played.

Log File Format

SMIL uploads log files to a server (similar to the POPAI Log Standard 1.0). Several redundant fields are removed to optimize network performance.

Here is an example of a log file uploaded to a server:

<report xmlns="http://schemas.open-smil.org/smartapi-1.0">
  <date>{createDate}</date>
  <version>1.0</version>
  <player id="{playerId}" multi-channel="true">
    <contentPlayLog displayDeviceId="display:0">
      <contentPlayed>
        <contentId>{log-id}</contentId>
        <startTime>{start-time}</startTime>
        <endTime>{end-time}</endTime>
        <playCompletion>aborted</playCompletion> <!-- The last record is only partially played -->
      </contentPlayed>
      <!-- ... more contentPlayed records -->
    </contentPlayLog>
  </player>
</report>

Event logs

Player events

The occurrence of the following type of events can be logged:

Download failure (event FETCH_FAILED):

Occurs when a file cannot be downloaded due to network failure or URL not found.

File not found error (event MEDIA_NOT_AVAILABLE):

Occurs when file does not exist in player's storage. This can happen due to insufficient space which causes the player's storage "garbage collector" erasing files least-recently-used (LRU).

Media format error (event MEDIA_OPEN_ERROR):

Occurs when the header information of the media file describes a format not supported by the player.

Media contents error (event MEDIA_PLAYBACK_ERROR):

Occurs during playback of a media file, most likely due to a corrupt media stream.

Event Report Format

Here is an example of a event report uploaded to a server:

<report xmlns="http://schemas.open-smil.org/smartapi-1.0">
   <date>{createDate}</date>
   <version>1.0</version>
   <player id="{playerId}">
     <playerEventLog>
       <event>
         <eventType>informational|warning|error|critical</eventType>
         <eventTime>{eventTime}</eventTime>
         <eventSource>{moduleName}</eventSource>
         <eventName>{eventEnumName}</eventName>
         <metadata>
           <meta name="{meta1-name}" content="{meta1-content}"/>
           <meta .../>
         </metadata>
       </event>
     </playerEventLog>
  </player>
</report>

Player Event Listed by Event Source

Player events listed by different event sources as below:

Source : ContentManager

event:
    LRU_OBJECT_REMOVED
eventType:
    informational if lastAccessTime is before 30 days
meta "resourceURI":
    URI for the object that removed
meta "lastAccessTime":
    object last access time
event:
    OBJECT_REMOVED
eventType:
    informational
meta "resourceURI":
    URI for the object that removed
event:
    OBJECT_UPDATED
eventType:
    informational
meta "resourceURI":
    URI for the object that updated
meta "contentLength":
    content length in bytes
meta "lastModifiedTime":
    object last modified time
event:
    FETCH_FAILED
eventType:
    error if no other versions available in cache; warning if an earlier version exists
meta "resourceURI":
    URI for the file that failed to transfer
meta "transferLength":
    Number of bytes transferred so far
meta "lastCachedLength":
    If a previous version exists, its length in bytes
meta "lastCachedModifiedTime":
    If a previous version exists, its modified time
event:
    FETCH_FAILED : E_CHECKSUM_NOT_MATCHED
eventType:
    error
meta "xmp:errorMessage":
    E_CHECKSUM_NOT_MATCHED
meta "md5":
    MD5 calculated from downloaded media
event:
    BROKEN_OBJECT_REMOVED
eventType:
    warning
meta "resourceURI":
    URI for the object that removed
meta "lastModifiedTime":
    object last modified time
meta "contentLength":
    content length in bytes
meta "transferLength":
    actual file size; -1 means file not found

Source: MediaPlayer

event:
    MEDIA_NOT_AVAILABLE
eventType:
    error
meta "resourceURI":
    URI for the object that not available
event:
    MEDIA_OPEN_ERROR
eventType:
    error
meta "resourceURI":
    URI for the object that fails to open
event:
    MEDIA_PLAYBACK_ERROR
eventType:
    error
meta "resourceURI":
    URI for the object that fails to play

Source: MediaControl

event:
    SMIL_LOADED
eventType:
    informational
meta "instanceId":
    fixed value:"display:0" 
meta "resourceURI":
    URI for the object that loaded
meta "contentLength":
    object length in bytes
meta "lastModifiedTime":
    object last modified time
event:
    SMIL_NOT_AVAILABLE
eventType:
    informational
meta "instanceId":
    fixed value:"display:0" 
meta "resourceURI":
    URI for the object that not available
event:
    SMIL_OPEN_ERROR
eventType:
    error document error (too large, syntax error, other errors), other internal errors
meta "instanceId":
    fixed value:"display:0" 
meta "resourceURI":
    URI for the object that loaded
meta "contentLength":
    object length in bytes
meta "lastModifiedTime":
    object last modified time

Source: System

event:
    STORAGE_FORMATTED
eventType:
    warning
event:
    STORAGE_TRUNCATED
eventType:
    warning

Source: TimeService

event:
    TIME_SYNCHRONIZED
eventType:
    informational
meta "protocol":
    Time synchornization protocol ( http | rdate )
meta "server":
    URI for the time server
meta "adjustment":
    the time being adjusted after syhchronization
event:
    TIME_SYNCHRONIZATION_ERROR
eventType:
    warning
meta "protocol":
    Time synchornization protocol ( http | rdate )
meta "server":
    URI for the time server

System reports

SMIL player reports its player configuration. The report is sent back to designated server every 5 minutes.

Designating a URL to the SystemReport Handler

Add the following scripts to the head of a SMIL to define the log's destination:

<head>
  <metadata>
    <x-server xmlns="http://schemas.open-smil.org/smartapi-1.0">
      <subscriptionList>
        <subscription>
          <type>SystemReport</type>
          <action>http://server/filename</action>
          <method>put</method>
          <refreshInterval>3600</refreshInterval>
          <retryInterval>3600</retryInterval>
        </subscription>
      </subscriptionList>
    </x-server>
  </metadata>
</head>

If <action>http://server/filename</action> doesn't have a file name, the file will be named as "SystemReport.xml".

System Report File Format

Here is an example of a log file uploaded to a server:

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://schemas.open-smil.org/smartapi-1.0">
  <date>{createdate}</date>
  <version>1.0</version>
  <player id="{playerId}">
    <systemInfo>
      <systemStartTime>{startTime}</systemStartTime>
      <systemTZ>{timeZone}</systemTZ>
      <totalCapacity>7845879808</totalCapacity>
      <totalFreeSpace>7098961920</totalFreeSpace>
      <network>
        <interface id="eth0">
          <type>ethernet</type>
          <mac>{macAddress}</mac>
          <ip>{ipAddress}</ip>
          <netmask>{netMask}</netmask>
        </interface>
      </network>
      <configuration>
        <modelInfo>
          <prop name="manufacturer" value="Qbic"/>
          <prop name="vendor" value="SharingCloud"/>
          <prop name="displayID" value="FHD-100"/>
          <prop name="modelID" value="FHD-100"/>
          <prop name="device" value="ironman"/>
          <prop name="product" value="ironman"/>
          <prop name="serialNumber" value="{serialNumber}"/>
        </modelInfo>
        <factoryDefault>
          <variant>string</variant>
        </factoryDefault>
        <userPref>
          <prop name="security.wifi.blocked" value="false"/>
          <prop name="info.playerName" value="{playerName}"/>
          <prop name="info.playGroup" value="{playGroup}"/>
          <prop name="net.proxy.type" value="HTTP"/>
          <prop name="net.proxy.host" value=""/>
          <prop name="net.proxy.port" value="1080"/>
          <prop name="net.proxy.user" value=""/>
          <prop name="net.wifi.enabled" value="false"/>
          <prop name="net.wifi.ssid" value=""/>
          <prop name="net.wifi.authentication" value=""/>
          <prop name="net.wifi.encryption" value=""/>
          <prop name="net.ethernet.enabled" value="true"/>
          <prop name="net.ethernet.dhcp.enabled" value="true"/>
          <prop name="net.ethernet.dhcp.vendorClass" value="digital_signage"/>
          <prop name="net.ethernet.ip" value=""/>
          <prop name="net.ethernet.netmask" value=""/>
          <prop name="net.ethernet.gateway" value=""/>
          <prop name="net.ethernet.domain" value=""/>
          <prop name="net.ethernet.dnsServers" value=""/>
          <prop name="net.mobile.apn" value="internet"/>
          <prop name="net.mobile.dialup_number" value="*99#"/>
          <prop name="net.mobile.user" value=""/>
          <prop name="time.tzDescription" value="Taiwan"/>
          <prop name="time.tzCode" value="CST-08:00"/>
          <prop name="time.autoUpdate.protocol" value="content"/>
          <prop name="time.autoUpdate.server" value="time.digisignage.net"/>
          <prop name="hardware.videoOut.0.format" value="CEA_720p50|CEA_720p60|CEA_1080p50|CEA_1080p60|CEA_2160p30|CEA_2160p60"/>
          <prop name="hardware.videoOut.0.orientation" value="auto"/>
          <prop name="hardware.videoOut.0.brightness" value="100%"/>
          <prop name="hardware.audioOut.0.soundLevel.streamMusic" value="100"/>
          <prop name="hardware.audioOut.0.soundLevel.streamNotification" value="100"/>
          <prop name="hardware.audioOut.0.soundLevel.streamAlarm" value="100"/>
          <prop name="content.bootFromServer" value="true"/>
          <prop name="content.serverUrl" value="{contentsourceUrl}"/>
          <prop name="task.scheduledReboot.days" value="Sunday Monday Tuesday Wednesday Thursday Friday Saturday"/>
          <prop name="task.scheduledReboot.time" value="04:00"/>
          <prop name="task.scheduledReboot.timeOptimized" value="true"/>
          <prop name="task.scheduledOn.time" value="09:00"/>
          <prop name="task.scheduledOff.time" value="20:00"/>
          <prop name="task.ota.xml" value="http://username:password@otaXmlURL"/>
          <prop name="debug.adb.enabled" value="true"/>
          <prop name="debug.adb.tcp.port" value="5555"/>
          <prop name="hardware.serial.0.driver" value=""/>
        </userPref>
      </configuration>
    </systemInfo>
    <hardwareInfo>
      <hardware id="display:0">
        <prop name="modelName" value="{string}"/>
        <prop name="vendorId" value="{string}"/>
        <!--only when screen supports HDMI CEC -->
        <prop name="power" value="on"/>
      </hardware>
    </hardwareInfo>
  </player>
</report>