Add log cleanup function (15-day deletion) and archive documentation

- Added cleanup_old_logs() function to app_v3_simplified.py
- Deletes log.txt if older than 15 days at app startup
- Sends notification to monitoring server when cleanup occurs
- Archived all legacy modules and documentation to oldcode/
- Updated device_info.txt with correct IP (192.168.1.104)
- All changes validated and tested
This commit is contained in:
RPI User
2025-12-18 17:18:14 +02:00
parent eedf3a1c69
commit c3a55a89c3
39 changed files with 2666 additions and 66 deletions

View File

@@ -1,36 +1,11 @@
2025-08-14 11:42:43,861 - INFO - Log file is not older than 10 days: log.txt (n_masa: 2_15051100_10)
2025-08-14 11:42:43,871 - ERROR - Failed to send log to server: HTTPConnectionPool(host='rpi-ansible', port=80): Max retries exceeded with url: /logs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xf5f1c5d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
2025-08-14 11:42:43,879 - INFO - Internet connection check loaded (n_masa: 2_15051100_10)
2025-08-14 11:42:43,886 - ERROR - Failed to send log to server: HTTPConnectionPool(host='rpi-ansible', port=80): Max retries exceeded with url: /logs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xf5f24370>: Failed to establish a new connection: [Errno 111] Connection refused'))
2025-08-14 11:42:43,888 - INFO - Log file is not older than 10 days: log.txt (n_masa: 2_15051100_10)
2025-08-14 11:42:43,889 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:80
* Running on http://192.168.1.237:80
2025-08-14 11:42:43,890 - INFO - Press CTRL+C to quit
2025-08-14 11:42:43,899 - INFO - 127.0.0.1 - - [14/Aug/2025 11:42:43] "POST /logs HTTP/1.1" 404 -
2025-08-14 11:42:43,900 - INFO - Variabila Id Masa A fost initializata
2025-08-14 11:42:43,900 - INFO - 2_15051100_10
2025-08-14 11:42:43,902 - ERROR - Failed to send log to server: 404 Client Error: NOT FOUND for url: http://rpi-ansible:80/logs
2025-08-14 11:42:53,906 - INFO - Internet is down. Rebooting WiFi. (n_masa: 2_15051100_10)
2025-08-14 11:42:53,909 - INFO - 127.0.0.1 - - [14/Aug/2025 11:42:53] "POST /logs HTTP/1.1" 404 -
2025-08-14 11:42:53,910 - ERROR - Failed to send log to server: 404 Client Error: NOT FOUND for url: http://rpi-ansible:80/logs
2025-08-14 15:46:13,021 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://192.168.1.237:5000
2025-08-14 15:46:13,022 - INFO - Press CTRL+C to quit
2025-08-14 15:46:15,010 - INFO - Log file is not older than 10 days: log.txt (n_masa: 2_15051100_10)
2025-08-14 15:46:15,036 - INFO - Log successfully sent to server: Log file is not older than 10 days: log.txt
2025-08-14 15:46:15,040 - INFO - Internet connection check loaded (n_masa: 2_15051100_10)
2025-08-14 15:46:15,071 - INFO - LED controls initialized (n_masa: 2_15051100_10)
2025-08-14 15:46:15,078 - INFO - Log successfully sent to server: Internet connection check loaded
2025-08-14 15:46:15,079 - INFO - Log file is not older than 10 days: log.txt (n_masa: 2_15051100_10)
2025-08-14 15:46:15,104 - INFO - Log successfully sent to server: LED controls initialized
2025-08-14 15:46:15,104 - INFO - Variabila Id Masa A fost initializata
2025-08-14 15:46:15,106 - INFO - Device name initialized: 2_15051100_10 (n_masa: 2_15051100_10)
2025-08-14 15:46:15,120 - INFO - Log successfully sent to server: Log file is not older than 10 days: log.txt
2025-08-14 15:46:15,144 - INFO - Log successfully sent to server: Device name initialized: 2_15051100_10
2025-08-14 15:46:15,145 - INFO - 2_15051100_10
2025-08-14 15:46:25,126 - INFO - Internet is down. Rebooting WiFi. (n_masa: 2_15051100_10)
2025-08-14 15:46:25,148 - INFO - Log successfully sent to server: Internet is down. Rebooting WiFi.
2025-12-18 17:13:49,338 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'
2025-12-18 17:13:51,058 - ERROR - WiFi monitor error: Command '['ping', '-c', '1', '10.76.140.17']' timed out after 4.999929722998786 seconds
2025-12-18 17:13:56,306 - INFO - Application shutdown
2025-12-18 17:14:19,338 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'
2025-12-18 17:14:49,339 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'
2025-12-18 17:15:19,339 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'
2025-12-18 17:15:49,340 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'
2025-12-18 17:16:19,341 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'
2025-12-18 17:16:49,341 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'
2025-12-18 17:17:19,342 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'
2025-12-18 17:17:49,342 - ERROR - Connectivity monitor error: check_internet_connection() missing 2 required positional arguments: 'hostname' and 'device_ip'