Wich tool for parsing logfile?

Hi,

I'd like watch owncloud's log but the format seem not to be a standard JSON.

I try with JSON.sh & .jq but the message value seem to be unparsable and I'd like to clean this one further.

try this http://www.pspad.com/de/download.php

standard text and code editor will do the job

Thanks for answering...
I don't understand why the log file isn't standard JSON, and why there is no tool for cleanning log file for human eyes...

Anyway, if it could help someone, I use jq & sed to clean this up a bit:

freezed@machine ~ # tail owncloud.log | jq '.' | sed -e 's/\\//g' | sed -e 's/{"Message/\n  {\n  "Message/g'| sed -e 's/","/",\n  "/g'| sed -e 's/,"U/,\n  "u/g'| sed -e 's/"}"/"\n  }/g'                               

{
  "reqId": "e/XhkNDoOkONxOVW1zQ9",
  "remoteAddr": "192.168.1.2",
  "app": "webdav",
  "message": "Exception: 
  {
  "Message":"HTTP/1.1 404 Calendar object not found",
  "Exception":"SabreDAVExceptionNotFound",
  "Code":0,"Trace":"#0 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Tree.php(76): OCADAVCalDAVCalendar->getChild('version.wcap')n#1 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php(79): SabreDAVTree->getNodeForPath('calendars/user1...', 0)n#2 [internal function]: SabreDAVCorePlugin->httpGet(Object(SabreHTTPRequest), Object(SabreHTTPResponse))n#3 /var/www/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)n#4 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(459): SabreEventEventEmitter->emit('method:GET', Array)n#5 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(248): SabreDAVServer->invokeMethod(Object(SabreHTTPRequest), Object(SabreHTTPResponse))n#6 /var/www/owncloud/apps/dav/lib/Server.php(169): SabreDAVServer->exec()n#7 /var/www/owncloud/apps/dav/appinfo/v2/remote.php(29): OCADAVServer->exec()n#8 /var/www/owncloud/remote.php(164): require_once('/var/www/ownclo...')n#9 {main}",
  "File":"/var/www/owncloud/apps/dav/lib/CalDAV/Calendar.php",
  "Line":171,
  "user":"user1"
  },
  "level": 0,
  "time": "2016-08-17 09:38:48",
  "method": "GET",
  "url": "/remote.php/dav/calendars/user1/cal_2_shared_by_user2/version.wcap?fmt-out=text%2Fcalendar",
  "user": "user1"
}
{
  "reqId": "AkNpCbSsF3JoEt6qzKzj",
  "remoteAddr": "192.168.1.2",
  "app": "webdav",
  "message": "Exception: 
  {
  "Message":"HTTP/1.1 404 Calendar object not found",
  "Exception":"SabreDAVExceptionNotFound",
  "Code":0,"Trace":"#0 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Tree.php(76): OCADAVCalDAVCalendar->getChild('version.wcap')n#1 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php(79): SabreDAVTree->getNodeForPath('calendars/user1...', 0)n#2 [internal function]: SabreDAVCorePlugin->httpGet(Object(SabreHTTPRequest), Object(SabreHTTPResponse))n#3 /var/www/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)n#4 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(459): SabreEventEventEmitter->emit('method:GET', Array)n#5 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(248): SabreDAVServer->invokeMethod(Object(SabreHTTPRequest), Object(SabreHTTPResponse))n#6 /var/www/owncloud/apps/dav/lib/Server.php(169): SabreDAVServer->exec()n#7 /var/www/owncloud/apps/dav/appinfo/v2/remote.php(29): OCADAVServer->exec()n#8 /var/www/owncloud/remote.php(164): require_once('/var/www/ownclo...')n#9 {main}",
  "File":"/var/www/owncloud/apps/dav/lib/CalDAV/Calendar.php",
  "Line":171,
  "user":"user1"
  },
  "level": 0,
  "time": "2016-08-17 09:41:48",
  "method": "GET",
  "url": "/remote.php/dav/calendars/user1/cal_2_shared_by_user2/version.wcap?fmt-out=text%2Fcalendar",
  "user": "user1"
}
{
  "reqId": "+X1pdGdhy6uWP9ju1Gv/",
  "remoteAddr": "92.90.17.191",
  "app": "caldav",
  "message": "Exception: 
  {
  "Message":"HTTP/1.1 401 No 'Authorization: Basic' header found. Either the client didn't send one, or the server is mis-configured",
  "Exception":"SabreDAVExceptionNotAuthenticated",
  "Code":0,"Trace":"#0 [internal function]: SabreDAVAuthPlugin->beforeMethod(Object(SabreHTTPRequest), Object(SabreHTTPResponse))n#1 /var/www/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)n#2 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(446): SabreEventEventEmitter->emit('beforeMethod', Array)n#3 /var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(248): SabreDAVServer->invokeMethod(Object(SabreHTTPRequest), Object(SabreHTTPResponse))n#4 /var/www/owncloud/apps/dav/appinfo/v1/caldav.php(81): SabreDAVServer->exec()n#5 /var/www/owncloud/remote.php(164): require_once('/var/www/ownclo...')n#6 {main}",
  "File":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Auth/Plugin.php",
  "Line":188,
  "user":false}",
  "level": 0,
  "time": "2016-08-17 10:18:24",
  "method": "PROPFIND",
  "url": "/remote.php/caldav/calendars/depann/cal_1_shared_by_user2/",
  "user": "--"
}
1 Like