Rev 10 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 11 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #!/usr/bin/php |
1 | #!/usr/bin/php |
2 | <?php |
2 | <?php |
3 | 3 | ||
4 | /* |
4 | /* |
5 | * ViaThinkSoft LogViewer |
5 | * ViaThinkSoft LogViewer |
6 | * Copyright 2018-2022 Daniel Marschall, ViaThinkSoft |
6 | * Copyright 2018-2023 Daniel Marschall, ViaThinkSoft |
7 | * |
7 | * |
8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
9 | * you may not use this file except in compliance with the License. |
9 | * you may not use this file except in compliance with the License. |
10 | * You may obtain a copy of the License at |
10 | * You may obtain a copy of the License at |
11 | * |
11 | * |
Line 99... | Line 99... | ||
99 | $time_mysql = date('Y-m-d H:i:s', $time); |
99 | $time_mysql = date('Y-m-d H:i:s', $time); |
100 | } else { |
100 | } else { |
101 | continue; |
101 | continue; |
102 | } |
102 | } |
103 | 103 | ||
- | 104 | if (strlen($modul) > 30) { |
|
- | 105 | echo "Attention: Truncate modul: $modul\n"; |
|
- | 106 | $modul = substr($modul, 0, 512); |
|
- | 107 | } |
|
- | 108 | ||
- | 109 | if (strlen($text) > 512) { |
|
- | 110 | echo "Attention: Truncate text in file $file: $text\n"; |
|
- | 111 | $text = substr($text, 0, 512); |
|
- | 112 | } |
|
- | 113 | ||
104 | $res = mysql_query("select * from vts_fehlerlog where modul = '".mysql_real_escape_string($modul)."' and logfile = '".mysql_real_escape_string($logfile)."' and text = '".mysql_real_escape_string($text)."';"); |
114 | $res = mysql_query("select * from vts_fehlerlog where modul = '".mysql_real_escape_string($modul)."' and logfile = '".mysql_real_escape_string($logfile)."' and text = '".mysql_real_escape_string($text)."';"); |
105 | #echo mysql_error(); |
115 | #echo mysql_error(); |
106 | if (mysql_num_rows($res) > 0) { |
116 | if (mysql_num_rows($res) > 0) { |
107 | mysql_query("update vts_fehlerlog set anzahl = anzahl + 1, letzter = '$time_mysql' " . |
117 | mysql_query("update vts_fehlerlog set anzahl = anzahl + 1, letzter = '$time_mysql' " . |
108 | "where modul = '".mysql_real_escape_string($modul)."' and logfile = '".mysql_real_escape_string($logfile)."' and text = '".mysql_real_escape_string($text)."' and letzter < '".$time_mysql."';"); |
118 | "where modul = '".mysql_real_escape_string($modul)."' and logfile = '".mysql_real_escape_string($logfile)."' and text = '".mysql_real_escape_string($text)."' and letzter < '".$time_mysql."';"); |
Line 159... | Line 169... | ||
159 | $time_mysql = date('Y-m-d H:i:s', strtotime($time)); |
169 | $time_mysql = date('Y-m-d H:i:s', strtotime($time)); |
160 | } else { |
170 | } else { |
161 | continue; |
171 | continue; |
162 | } |
172 | } |
163 | 173 | ||
- | 174 | if (strpos($text, '{"reqId":"') !== false) { |
|
- | 175 | // For some reason, owncloud or nextcloud seems to write to php_error.log and not in data/nextcloud.log ?? But only sometimes ?? |
|
- | 176 | // TODO: Should we try to parse this JSON log message? |
|
- | 177 | ||
- | 178 | // [12-Sep-2023 15:01:24 UTC] {"reqId":"f2uD4QSS9xIjAAWgbeVb","level":3,"time":"2023-09-12T15:01:24+00:00","remoteAddr":"1.2.3.4","user":"--","app":"core","method":"GET","url":"/index.php/settings/admin/overview","message":"Permission denied","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36","version":"27.0.2.1","exception":{"Exception":"RedisException","Message":"Permission denied","Code":0,"Trace":[{"file":"/daten/homes/owncloud/public_html/lib/private/RedisFactory.php","line":137,"function":"pconnect","class":"Redis","type":"->"},{"file":"/daten/homes/owncloud/public_html/lib/private/RedisFactory.php","line":178,"function":"create","class":"OC\\RedisFactory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/daten/homes/owncloud/public_html/lib/private/Memcache/Redis.php","line":66,"function":"getInstance","class":"OC\\RedisFactory","type":"->"},{"file":"/daten/homes/owncloud/public_html/lib/private/Memcache/Redis.php","line":72,"function":"getCache","class":"OC\\Memcache\\Redis","type":"->"},{"file":"/daten/homes/owncloud/public_html/lib/private/App/InfoParser.php","line":58,"function":"get","class":"OC\\Memcache\\Redis","type":"->"},{"file":"/daten/homes/owncloud/public_html/lib/private/App/AppManager.php","line":732,"function":"parse","class":"OC\\App\\InfoParser","type":"->"},{"file":"/daten/homes/owncloud/public_html/lib/private/legacy/OC_App.php","line":434,"function":"getAppInfo","class":"OC\\App\\AppManager","type":"->"},{"file":"/daten/homes/owncloud/public_html/lib/private/AppFramework/App.php","line":71,"function":"getAppInfo","class":"OC_App","type":"::"},{"file":"/daten/homes/owncloud/public_html/lib/private/legacy/OC_App.php","line":155,"function":"buildAppNamespace","class":"OC\\AppFramework\\App","type":"::"},{"file":"/daten/homes/owncloud/public_html/lib/private/AppFramework/Bootstrap/Coordinator.php","line":119,"function":"registerAutoloading","class":"OC_App","type":"::"},{"file":"/daten/homes/owncloud/public_html/lib/private/AppFramework/Bootstrap/Coordinator.php","line":90,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/daten/homes/owncloud/public_html/lib/base.php","line":703,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/daten/homes/owncloud/public_html/lib/base.php","line":1180,"function":"init","class":"OC","type":"::"},{"file":"/daten/homes/owncloud/public_html/index.php","line":34,"args":["/daten/homes/owncloud/public_html/lib/base.php"],"function":"require_once"}],"File":"/daten/homes/owncloud/public_html/lib/private/RedisFactory.php","Line":137,"CustomMessage":"--"}} |
|
- | 179 | ||
- | 180 | continue; |
|
- | 181 | } |
|
- | 182 | ||
- | 183 | if (strlen($modul) > 30) { |
|
- | 184 | echo "Attention: Truncate modul: $modul\n"; |
|
- | 185 | $modul = substr($modul, 0, 512); |
|
- | 186 | } |
|
- | 187 | ||
- | 188 | if (strlen($text) > 512) { |
|
- | 189 | echo "Attention: Truncate text in file $file: $text\n"; |
|
- | 190 | $text = substr($text, 0, 512); |
|
- | 191 | } |
|
- | 192 | ||
164 | $res = mysql_query("select * from vts_fehlerlog where modul = '".mysql_real_escape_string($modul)."' and logfile = '".mysql_real_escape_string($logfile)."' and text = '".mysql_real_escape_string($text)."';"); |
193 | $res = mysql_query("select * from vts_fehlerlog where modul = '".mysql_real_escape_string($modul)."' and logfile = '".mysql_real_escape_string($logfile)."' and text = '".mysql_real_escape_string($text)."';"); |
165 | #echo mysql_error(); |
194 | #echo mysql_error(); |
166 | if (mysql_num_rows($res) > 0) { |
195 | if (mysql_num_rows($res) > 0) { |
167 | mysql_query("update vts_fehlerlog set anzahl = anzahl + 1, letzter = '$time_mysql' " . |
196 | mysql_query("update vts_fehlerlog set anzahl = anzahl + 1, letzter = '$time_mysql' " . |
168 | "where modul = '".mysql_real_escape_string($modul)."' and logfile = '".mysql_real_escape_string($logfile)."' and text = '".mysql_real_escape_string($text)."' and letzter < '".$time_mysql."';"); |
197 | "where modul = '".mysql_real_escape_string($modul)."' and logfile = '".mysql_real_escape_string($logfile)."' and text = '".mysql_real_escape_string($text)."' and letzter < '".$time_mysql."';"); |