(Last Updated: August 2, 2020)
For those who registered but didn't received the confirmation email, please send an email to support@smarthome.community with the email you used

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.