Insync-headless get_logfile

The logs of insync-headless are stored in a Database in ~/.config/Insync/. I cannot read that.
Is it possible to make a command like ‘get_logs’, that prints out the logs from the database into a textfile?

The Problem was, that insync-headless was not syncing. ‘get_status’ only printed “ERROR”.
So I do not know whats happening. I had to restart the Server and now it works again. But I would like to know what went wrong.

btw: I already tried the command ‘get_errors’, but it only tells me “none”.

1 Like

Tagging our engineer @lpugoy and he will get back to you.

@Achim_Tecklenburg: The logs are sqlite3 dbs, so it can be opened by any program that can read those files. They can only be opened when Insync is not running though, and it is recommended to not change any value in those files to prevent Insync from malfunctioning.

The get_errors command should have shown you the details of the error when get_status returned ERROR. It probably returned None in your case because the error was resolved when you restarted Insync.

If this is not so hard, will be good to integrate this in insync app (cat log database as text output, like the syslog file), because not all users know that is sqlite and how to view sqlite3 database, even this is quite easy. They see in file binary symbols and are frightened.

Thanks for the feedback, @Murz! Will let our team know about it. :slight_smile:

Even if we succesfully view the sqlite database file, in some records we will see hard to read data in json format, like this:

INSERT INTO event_logs VALUES('01fbc8e05b73494487ae1a2e41936f35',3,'d47fedbc16454f10a9dee29fea98xxxx','idesksyncer.gdstate.GDState.get_user_info','697667a5423c4f945421475149d5xxxx',1532429202.4053139686,40,'gevent.event in get','ideskmain/clientlogging.py',223,NULL,NULL,
'{"message": "Uncaught error from %r", "params": ["<Greenlet at 0x7fedd2d917d0: <bound method GDState.get_user_info of <idesksyncer.gdstate.GDState object at 0x7fedd19fb8d0>>>"]}','{"type": "GDAuthError", "value": "Access token refresher stopped.", "module": "idesksyncer
.gderrs"}','{"frames": [{"function": "run", "abs_path": "gevent/greenlet.py", "vars": {"self": "<Greenlet at 0x7fedd2d917d0: <bound method GDState.get_user_info of <idesksyncer.gdstate.GDState object at 0x7fedd19fb8d0>>>"}, "module": "gevent.greenlet", "filename": "event
/greenlet.py", "lineno": 390}, {"function": "get_user_info", "abs_path": "idesksyncer/gdstate.py", "vars": {"self": "<idesksyncer.gdstate.GDState object at 0x7fedd19fb8d0>"}, "module": "idesksyncer.gdstate", "filename": "desksyncer/gdstate.py", "lineno": 201}, {"function
": "get_user_info", "abs_path": "idesksyncer/gdclient.py", "vars": {"self": "<idesksyncer.gdclient.GDClient object at 0x7fedd19fb290>", "uri": "https://www.googleapis.com/oauth2/v1/userinfo"}, "module": "idesksyncer.gdclient", "filename": "desksyncer/gdclient.py", "linen
o": 1042}, {"function": "__request", "abs_path": "idesksyncer/gdclient.py", "vars": {"content_str": "", "redirects": 0, "token_refreshed": false, "uri_string": "https://www.googleapis.com/oauth2/v1/userinfo", "timeout": 40.0, "content_parts": ["''''"], "self": "<idesksyn
cer.gdclient.GDClient object at 0x7fedd19fb290>", "idempotent": true, "content": ["0", "[]", "None"], "headers": {"Content-Length": "0", "User-Agent": "''Insync for Desktop (gzip)''"}, "server_errors": 0, "pre_read": true, "method": "GET"}, "module": "idesksyncer.gdclien
t", "filename": "desksyncer/gdclient.py", "lineno": 540}, {"function": "get_token", "abs_path": "idesksyncer/gdclient.py", "vars": {"self": "<idesksyncer.gdclient.OAuth2Client object at 0x7fedd19fb250>"}, "module": "idesksyncer.gdclient", "filename": "desksyncer/gdclient
.py", "lineno": 354}, {"function": "get", "abs_path": "gevent/event.py", "vars": {"self": "<gevent.event.AsyncResult object at 0x7feddd813790>", "timer": "<Timeout at 0x7fedd01585a0 seconds=None>", "switch": "<built-in method switch of Greenlet object at 0x7fedd2d917d0>"
, "result": "<gevent.event.AsyncResult object at 0x7feddd813790>", "timeout": null, "block": true}, "module": "gevent.event", "filename": "event/event.py", "lineno": 223}]}','{}');

So for human readable logs view we need to convert records like those to something more user friendly - do json_decode and show only message text.

1 Like