openLuup log files - LuaUPnP.log and LuaUPnP_startup.log
-
To try and minimized the frequency of writing to the SD card I want to move these log files to a RAM drive, like I already do with /var/log. Is there an 'official' way of doing this?
_John.
-
Mount the drive then symlink folder to that?
C
-
For the regular log, a Lua Startup line saying:
luup.attr_set ("openLuup.Logfile.Name", "/path/to/wherever/your_file_name.log"
This is described on page 25 of the User Manual.
The Startup log is very short and very rarely written (like, only when you restart?) Simply not worth the trouble, although a dynamic link should work. You can’t do this from within openLuup, since it has to write to it while starting up, and before reading the user_data.json file!
-
Tried luup.attr_set ("openLuup.Logfile.Name", "/path/to/wherever/your_file_name.log" in the startup - no effect. I have tried symlinks and that didn't work either. The only thing that comes to mind is that I have cmh-ludl in my home directory rather than in /etc.
-
The best option for raspberry it's
-
Doesn’t matter where the openLuup home folder is, or what it’s called.
The Lua Startup change will, of course, only take effect after the second system reload.
-
@DesT said in openLuup log files - LuaUPnP.log and LuaUPnP_startup.log:
ramlog like for systemd (Put log into a ram folder)
In fact, all my openLuup systems write their logs to ram disc. This is the startup code I use:
-- openLuup logs in RAM local lfs = require "lfs" local logs = "/dev/shm/logs" if not lfs.attributes (logs) then lfs.mkdir (logs) end luup.attr_set ("openLuup.Logfile.Name", logs .. "/LuaUPnP.log") -- /var/log/cmh/ ensure it's there for AltUI logs -- won't work the first time it's created local altlog = logs .. "/altui" lfs.mkdir (altlog) lfs.link (altlog, "/var/log/cmh", true) -- true for symbolic link
-
Tried a second restart - still not working. I will try the above suggestion tomorrow.
-
Disadvantage of using RAM I find that the logs are gone after a restart. Any suggestions for that?
Also now I use an SSD I think it will be less of a problem.
-
They’re certainly gone after rebooting the system, but they’re certainly there between openLuup restarts, which is when you need them. How often do you reboot your system? Can’t remember when mine did... perhaps a power outage last winter some time?
-
Compromise would be to save log files to HD on a regular basis with crontab... But yeah I agree that I practically never reboot my openLuup machine unless I have a major OS upgrade.
-
The script I sent log2ram is doing all that! At boot time it's creating a RAM drive for logs and writing the logs at some interval on disk!
We are installing log2ram by default on all our Raspberry using a SD!
-
Would be useful on any machine I would think depending on how big the logs are.
-
Hey AK,
I have two requests regarding log files that I hope would be easy to implement:
The first is a horizontal scroll bar for the running log as I have numerous log entries that extend well past the right hand side of the screen, and currently, I can't see that extended information unless I manually open the given log file in a text editor.The second is a startup configuration option specifying the number of log pages to save before deleting the oldest and rolling over, ---perhaps with a dangerous 0 option that would allow unlimited log pages. I'm asking for this as I sometimes see odd behavior in a device, but by the time I get to the log file, the log notation (if it existed at all) has already been overwritten. This option would be very useful for debugging long term performance of a given problem, and once solved, one could revert back to the standard 5 pages of log files. i could probably do this through some linux automation, but rather than create another 'easy to forget what I did' OS routine, an entry in startup would be easily accessible and modifiable.
-
@Buxton said in openLuup log files - LuaUPnP.log and LuaUPnP_startup.log:
The first is a horizontal scroll bar for the running log as I have numerous log entries that extend well past the right hand side of the screen
Actually, I hate web pages which scroll sideways. Would wrapping the text help? In fact, also, many log entries are truncated as a matter of course. What’s producing long lines?
@Buxton said in openLuup log files - LuaUPnP.log and LuaUPnP_startup.log:
The second is a startup configuration option specifying the number of log pages to save before deleting the oldest and rolling over
There is one, but noting the discussion here, there is currently a bug in implementation... I must fix it!
https://smarthome.community/topic/173/logging-and-rotation?_=1596321655453
-
Prefer scroll much more than wrap.
-
Mainly Reactor Sensor entries but many devices, including openLuup, will occasionally wander off the page:
<code>2020-08-02 16:07:08.608 openLuup.server:: GET /data_request?id=variableget&DeviceNum=0&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&Variable=Mode&_=1596409627025 HTTP/1.1 tcp{client}: 0x564821cd4ce8
</code>Anything that allows the full display of the log line would help.
-
Hi akbooer,
sometimes openluup restore the file user_data.json to the default and I need to restore the configured one. I notice in the LuaUPnP_startup.log these msgs :
2024-07-18 07:46:19.585 :: openLuup STARTUP :: /etc/cmh-ludl 2024-07-18 07:46:19.586 openLuup.init:: version 2022.11.28 @akbooer 2024-07-18 07:46:19.595 openLuup.scheduler:: version 2021.03.19 @akbooer 2024-07-18 07:46:19.723 openLuup.io:: version 2021.03.27 @akbooer 2024-07-18 07:46:19.723 openLuup.mqtt:: version 2022.12.16 @akbooer 2024-07-18 07:46:19.727 openLuup.wsapi:: version 2023.02.10 @akbooer 2024-07-18 07:46:19.727 openLuup.servlet:: version 2021.04.30 @akbooer 2024-07-18 07:46:19.727 openLuup.client:: version 2019.10.14 @akbooer 2024-07-18 07:46:19.729 openLuup.server:: version 2022.08.14 @akbooer 2024-07-18 07:46:19.737 openLuup.scenes:: version 2023.03.03 @akbooer 2024-07-18 07:46:19.750 openLuup.chdev:: version 2022.11.05 @akbooer 2024-07-18 07:46:19.750 openLuup.userdata:: version 2021.04.30 @akbooer 2024-07-18 07:46:19.751 openLuup.requests:: version 2021.02.20 @akbooer 2024-07-18 07:46:19.751 openLuup.gateway:: version 2021.05.08 @akbooer 2024-07-18 07:46:19.757 openLuup.smtp:: version 2018.04.12 @akbooer 2024-07-18 07:46:19.764 openLuup.historian:: version 2022.12.20 @akbooer 2024-07-18 07:46:19.764 openLuup.luup:: version 2023.01.06 @akbooer 2024-07-18 07:46:19.767 openLuup.pop3:: version 2018.04.23 @akbooer 2024-07-18 07:46:19.768 openLuup.compression:: version 2016.06.30 @akbooer 2024-07-18 07:46:19.768 openLuup.timers:: version 2021.05.23 @akbooer 2024-07-18 07:46:19.769 openLuup.logs:: version 2018.03.25 @akbooer 2024-07-18 07:46:19.769 openLuup.json:: version 2021.05.01 @akbooer 2024-07-18 07:46:19.774 luup.create_device:: [1] D_ZWaveNetwork.xml / / () 2024-07-18 07:46:19.774 openLuup.chdev:: ERROR: unable to read XML file I_ZWave.xml 2024-07-18 07:46:19.800 luup.create_device:: [2] D_openLuup.xml / I_openLuup.xml / D_openLuup.json (openLuup) 2024-07-18 07:46:19.800 openLuup.init:: loading configuration user_data.json 2024-07-18 07:46:19.801 openLuup.userdata:: loading user_data json... 2024-07-18 07:46:19.805 openLuup.userdata:: JSON decode error @[8173 of 8192, line: 176] unterminated string ' = luup.attr_set\n\n <<<HERE>>> -- Geographical loca' 2024-07-18 07:46:19.805 openLuup.userdata:: ...user_data loading completed 2024-07-18 07:46:19.805 openLuup.init:: running _openLuup_STARTUP_ 2024-07-18 07:46:19.805 luup_log:0: startup code completed 2024-07-18 07:46:19.806 openLuup.init:: init phase completed 2024-07-18 07:46:19.806 :: openLuup LOG ROTATION :: (runtime 0.0 days)
Is this a my error in some configuration files ?
tnks
-
@Donato said in openLuup log files - LuaUPnP.log and LuaUPnP_startup.log:
sometimes openluup restore the file user_data.json to the default
I've never seen that happen, and would like to understand the situation in which this occurs for you in more detail.
@Donato said in openLuup log files - LuaUPnP.log and LuaUPnP_startup.log:
I notice in the LuaUPnP_startup.log these msgs
When do you see this? After having restored the earlier file?
This message...
2024-07-18 07:46:19.774 openLuup.chdev:: ERROR: unable to read XML file I_ZWave.xml
...is of no consequence. It simply means you're missing the file. It shouldn't matter because openLuup never subsequently uses it.
However, these...
2024-07-18 07:46:19.801 openLuup.userdata:: loading user_data json... 2024-07-18 07:46:19.805 openLuup.userdata:: JSON decode error @[8173 of 8192, line: 176] unterminated string ' = luup.attr_set\n\n <<<HERE>>> -- Geographical loca'
...do indicate an error in your Lua Startup code, and points to the location of the error.
-
This is the line 176 of User_Data Json file :
"StartupCode":"\n-- You can personalise the installation by changing these attributes,\n-- which are persistent and may be removed from the Startup after a reload.\nlocal attr = luup.attr_set\n\n-- Geographical location\nattr ("City_description", "Rome")\nattr ("Country_description", "Italy")\nattr ("Region_description", "Lazio")\nattr ("latitude", "51.48")\nattr ("longitude", "0.0")\n\n-- other parameters\nattr ("TemperatureFormat", "C")\nattr ("PK_AccessPoint", "99000007")\nattr ("currency", "£")\nattr ("date_format", "dd/mm/yy")\nattr ("model", "Not a Vera")\nattr ("timeFormat", "24hr")\n\n-- Any other startup processing may be inserted here...\nluup.log "startup code completed"\n\n",
I modify these parameter through the console openluup app and these are the values :
-- You can personalise the installation by changing these attributes,
-- which are persistent and may be removed from the Startup after a reload.
local attr = luup.attr_set-- Geographical location
attr ("City_description", "Rome")
attr ("Country_description", "Italy")
attr ("Region_description", "Lazio")
attr ("latitude", "51.48")
attr ("longitude", "0.0")-- other parameters
attr ("TemperatureFormat", "C")
attr ("PK_AccessPoint", "99000007")
attr ("currency", "£")
attr ("date_format", "dd/mm/yy")
attr ("model", "Not a Vera")
attr ("timeFormat", "24hr")-- Any other startup processing may be inserted here...
luup.log "startup code completed"Is there any error ?
tnks