added port
fixed error in JSON REST API for logs

The JSON REST API was broken because the logs could not be translated
by json.dumps. The flatten function has been re-written to support
basic types and database models, and this is used to convert the logs in
to a form that can be json encoded.
added missing fields to as_dict
fix for client reports that did not discover any devices

No logging data was being stored if the client submitted a log with
an empty devices array.