Announcement

Collapse
No announcement yet.

Where is the log file?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Where is the log file?

    I want to be able to tail the log file. I can't figure out what directory it is in, looked all through /usr/local/HomeSeer. Does not seem to be anything but startup in /Logs.

    Motivation is troubleshooting high CPU locking up the Zee. I can run shell commands to check for high CPU every 10 seconds in /proc/loadavg. When found I want to dump the end of the HomeSeer logs to a file to help ID what might have led to the high CPU. If there are other ideas how to find this I'm open to them.

    #2
    There should be a log file in /usr/local/HomeSeer/logs
    What are you log settings set to in the path Tools > Setup > Log Settings.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      The log file should end with a .hsd extension.
      Note that the log file is a SQLite database file so you wont be able to use the tail command.
      You would need to copy it somewhere and use SQLite browser to look at the logs.
      HS4Pro on a Raspberry Pi4
      54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
      Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

      HSTouch Clients: 1 Android

      Comment


        #4
        There is a "Logs" dir but no "logs" dir. It does not contain any .hsd file. The Log Setting part of the Setup page has no path I can find showing where the Logs should be going. I can only use the linux tools page to look at stuff from work. Strangely, I can't cd into the Logs dir using that, but could going directly in via ssh at home. I can however look at what is in the Logs dir.

        running comand pwd
        /usr/local/HomeSeer

        running comand ls -al
        total 15724
        drwxr-sr-x 20 homeseer root 4096 Aug 18 04:34 .
        drwxrwsr-x 11 root staff 4096 Dec 31 1969 ..
        -rwxr-xr-x 1 homeseer root 77 Nov 21 2014 autostart_hs
        drwxr-sr-x 4 homeseer root 4096 Jul 30 08:31 bin
        drwxr-sr-x 3 root root 4096 Apr 19 16:23 Bin
        <snip>
        -rwxr-xr-x 1 homeseer root 36 Nov 21 2014 install.sh
        -rw-r--r-- 1 root root 480 May 7 07:51 last_exception.txt
        -rwxr-xr-x 1 homeseer root 319 Mar 3 2015 led.sh
        drwxr-sr-x 2 homeseer root 4096 Aug 17 21:17 Logs
        -rwxr-xr-x 1 homeseer root 930816 Nov 21 2014 Mail.dll
        drwxr-sr-x 2 homeseer root 4096 Aug 4 16:59 Media
        drwxr-sr-x 2 homeseer root 4096 Jul 30 08:31 mochad
        <snip>

        running comand ls -al Logs
        total 32
        drwxr-sr-x 2 homeseer root 4096 Aug 17 21:17 .
        drwxr-sr-x 20 homeseer root 4096 Aug 18 04:34 ..
        -rw-r--r-- 1 root root 9722 Aug 10 07:18 Previous_Startup.log
        -rw-r--r-- 1 root root 9362 Aug 17 21:43 Startup.log

        Click image for larger version

Name:	HSlogSetting.jpg
Views:	1
Size:	77.5 KB
ID:	1186732

        Edit: Added find command looking for all .hsd files in the HomeSeer directory.

        running comand find . -name *.hsd

        ./Data/HomeSeerData_3.hsd
        ./Data/HomeSeerData_9.hsd
        ./Data/Energy/Energy.hsd
        ./Data/HomeSeerData_10.hsd
        ./Data/HomeSeerData_7.hsd
        ./Data/HomeSeerData_4.hsd
        ./Data/HomeSeerData_1.hsd
        ./Data/HomeSeerData_6.hsd
        ./Data/HomeSeerData_2.hsd
        ./Data/HomeSeerData.hsd
        ./Data/HomeSeerData_8.hsd
        ./Data/HomeSeerData_5.hsd
        Last edited by jhearty; August 18, 2016, 08:51 AM. Reason: Added find command results

        Comment


          #5
          Still anxious to hear ideas. Do others with a Zee have an .hsd file in a /usr/local/HomeSeer/logs directory? Wondering if something is screwy with my install. I can see logs via the web server, but once the CPU pegs I can't look at them there and must restart. So I can never look back at what led up to the problem.

          Comment


            #6
            Thats very strange. I no longer have my Zee booted up or I would look for it.
            It's possible it is in the root HomeSeer folder but without an extension. Not sure what it would be called.

            When HS is running, and the log has some recent activity, run this command from the HomeSeer folder:
            ls -lt |head

            This will list the top 10 most recent files that have been updated.
            HS4Pro on a Raspberry Pi4
            54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
            Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

            HSTouch Clients: 1 Android

            Comment


              #7
              Originally posted by rmasonjr View Post
              Thats very strange. I no longer have my Zee booted up or I would look for it.
              It's possible it is in the root HomeSeer folder but without an extension. Not sure what it would be called.

              When HS is running, and the log has some recent activity, run this command from the HomeSeer folder:
              ls -lt |head

              This will list the top 10 most recent files that have been updated.
              For some reason running that via linux tools web page comes up blank. Without piping to head I see results and only the below directory within the HomeSeer directory shows current activity:

              drwxr-sr-x 7 homeseer root 4096 Aug 19 08:23 Data

              In that Data directory, these are the files with recent time stamps:

              drwxr-sr-x 2 homeseer root 4096 Aug 19 08:24 Energy
              -rw-r--r-- 1 root root 3143680 Aug 19 08:27 HomeSeerData.hsd
              drwxr-sr-x 7 homeseer root 4096 Aug 19 08:27 .

              Are the logs perhaps in the /usr/local/HomeSeer/Data/HomeSeerData.hsd file? I think I need to be home and ssh'd in directly to look at it with SQLite.

              Comment


                #8
                ah - that HomeSeerData.hsd does indeed look pretty large - it's possible that is the log. Like you said, from home, you can copy that file down and use a SQLite browser to see what is in it.

                Good luck!
                HS4Pro on a Raspberry Pi4
                54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
                Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

                HSTouch Clients: 1 Android

                Comment


                  #9
                  Does not look like those files contain logs so still wondering where logs are in a Zee. Here's what they look like in SQLite Browser:

                  Click image for larger version

Name:	HSdataStructure.png
Views:	1
Size:	62.5 KB
ID:	1186750

                  Edit: I did find the current log in /tmp/HomeSeerLog.hsd but that looks like only since last reboot. I did not find any other archive logs. To shoot this problem I need to see archived logs. I suppose I could cobble together something to archive periodically, but may still miss the stuff causing the CPU to peg. Does anyone know if logs are archived somewhere already?
                  Last edited by jhearty; August 21, 2016, 09:25 AM.

                  Comment


                    #10
                    How to backup log on restart?

                    As noted at the end of my last post I found the log in /tmp/HomeSeerLog.hsd. Any recommendations how to back it up upon restart of HS3? I think it gets overwritten on a restart, so if you are trying to debug something that caused a restart you are SOL.

                    I saw many different "rc" directories in different places and am not sure which one(s) get used when HS3 starts, or if there is some other place that is good to put mv or cp commands in to back up the log before HS3 starts. Thanks in advance for suggestions.

                    Comment


                      #11
                      It occurred to me that they likely put the log file in /tmp on the Zee mainly because that is the tmpfs file system in RAM. If it were on a file system mounted on the SD card it would be wearing out the same spot on the SD card leading to the common SD card failures seen on Pi's. Also, the log file is really a DB file and not a flat text file, and could get accessed frequently so better in RAM.

                      I still would like to hear recommendations for best way to back it up on reboot. Right now I'm SCP'ing it hourly to my PC, but that might miss something key that led to a reboot. I was thinking I could cobble something together in the restart.sh and shutdown.sh files, though those could get overwritten on release updates.

                      Comment


                        #12
                        Originally posted by jhearty View Post
                        As noted at the end of my last post I found the log in /tmp/HomeSeerLog.hsd. Any recommendations how to back it up upon restart of HS3? I think it gets overwritten on a restart, so if you are trying to debug something that caused a restart you are SOL.
                        I'm not sure it gets overwritten. It doesn't in Windows, but perhaps it was designed differently for the Zee since the directory is different. The web interface by default shows the info since the last restart, but the older data is still available. If the Zee does overwrite it, you could perhaps modify/setup the startup script that starts HS to copy the database file first.

                        Cheers
                        Al
                        HS 4.2.8.0: 2134 Devices 1252 Events
                        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                        Comment


                          #13
                          The file size of the hourly SCP I do dropped from 31M before to 104K after the restart last night. Looking at the restart.sh script I presume is what runs when you select Restart System, it stops the mono process and then the last line is "reboot" to restart the system. There's nothing copying files anywhere in the script. So if tmpfs where /tmp is located is in RAM, it is lost during the reboot.

                          Comment


                            #14
                            Originally posted by jhearty View Post
                            The file size of the hourly SCP I do dropped from 31M before to 104K after the restart last night. Looking at the restart.sh script I presume is what runs when you select Restart System, it stops the mono process and then the last line is "reboot" to restart the system. There's nothing copying files anywhere in the script. So if tmpfs where /tmp is located is in RAM, it is lost during the reboot.
                            Sounds like the process is completely different than on Windows. Modifying restart.sh to copy the file should work, except it won't work if the Zee restarts due to power loss or some other issue.

                            Cheers
                            Al
                            HS 4.2.8.0: 2134 Devices 1252 Events
                            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                            Comment


                              #15
                              You are correct that /tmp is not located on the SD card.

                              Code:
                              $ df -h /tmp
                              Filesystem      Size  Used Avail Use% Mounted on
                              tmpfs           218M     0  218M   0% /tmp
                              Shows that /tmp is mounted on a tmpfs filesystem, which exists only in RAM.

                              Saving the logfile before reboot turned out to be a bigger PITA that I had imagined. Try this:

                              1) save code below to file /etc/init.d/hslogsave
                              2) set ownership & permissions:
                              $ sudo chown root:root /etc/init.d/hslogsave
                              $ sudo chmod +x !$
                              3) register the script into the init system:
                              $ sudo update-rc.d hslogsave defaults
                              After this step, the script is set to run on start and stop:
                              Code:
                              $ ls -l /etc/rc*.d/*hslogsave
                              lrwxrwxrwx 1 root root 19 Sep 17 20:43 /etc/rc0.d/K01hslogsave -> ../init.d/hslogsave
                              lrwxrwxrwx 1 root root 19 Sep 17 20:43 /etc/rc1.d/K01hslogsave -> ../init.d/hslogsave
                              lrwxrwxrwx 1 root root 19 Sep 17 20:43 /etc/rc2.d/S01hslogsave -> ../init.d/hslogsave
                              lrwxrwxrwx 1 root root 19 Sep 17 20:43 /etc/rc6.d/K01hslogsave -> ../init.d/hslogsave
                              At shutdown, the logfile should be copied to a date tagged entry in /home/homeseer/logsave.

                              Code:
                              #!/bin/sh
                              ### BEGIN INIT INFO
                              # Provides:          hslogsave
                              # Required-Start:    $local_fs
                              # Required-Stop:     $local_fs
                              # Default-Start:     2
                              # Default-Stop:      0 1 6
                              # Short-Description: Save the Homeseer log file
                              ### END INIT INFO
                              
                              # file location: /etc/init.d/hslogsave
                              
                              LOGFILE=/tmp/HomeSeerLog.hsd
                              SAVEDIR=/home/homeseer/logsave
                              
                              # for testing -- ensure a logfile exists
                              # test "$1" = start && sudo -u homeseer touch $LOGFILE
                              
                              if test "$1" = stop -a -f "$LOGFILE";then
                                  sudo -u homeseer mkdir -p $SAVEDIR
                                  cp -p "$LOGFILE" "$SAVEDIR/`basename $LOGFILE`-`date '+%Y%m%d-%T'`"
                              fi
                              exit 0

                              Comment

                              Working...
                              X