How can log files be deleted?

Is it possible to delete files such as:-

empty_dustbin.20171028042739.log
nugget.20170819181253.log
nugget.20180902154236.log
recmon.20161214002753.log
recmon.20161217235739.log
redring.20180618235636.log
rsvsync.20171221235639.log

Reason: tidiness.

If it is possible, a step by step guide would be appreciated.
 
Are they listed under WebIF >> Diagnostics >> View Log Files? If so, just click the X.
This doesn't remove them it just empties them which may be all that is required.
However to delete them I FTP into the box and manually remove them. The logs can be found in /mod/tmp
 
If it is possible, a step by step guide would be appreciated.
Open a terminal session: if package webshell is installed WebIF >> Diagnostics >> Command Line; otherwise Telnet (https://wiki.hummy.tv/wiki/Telnet).

If asked for a PIN: the default is "0000" unless you've changed it.

If presented with the "Telnet Menu" enter "cli" (Command Line Interface) to get to a command prompt. For example:

Code:
HDRFOX3# cd /mod/tmp                                                                                      
HDRFOX3# ls
                                                                                              
activity.log                      crash.log                         recmon.20180913114341.log            
auto.20181218235709.log           dafail.log                        recmon.20181230173153.log            
auto.20181230173153.log           detectads.20180808023829.log      recmon.log                            
auto.20190106153953.log           detectads.20181107085937.log      rs.log                                
auto.20190110173057.log           detectads.log                     rsvsync.log                          
auto.log                          empty_dustbin.20171127024444.log  webif_auto/                          
auto_old.log                      empty_dustbin.20181107085937.log  webif_autoq/                          
chaseget.20181103134201.log       empty_dustbin.log                 wlan.log                              
chaseget.20181212175711.log       exfat.build/                                                            
chaseget.log                      nugget.log
                                                              
HDRFOX3# rm recmon.20180913114341.log                                                                    
HDRFOX3# ls
                                                                                              
activity.log                      chaseget.log                      exfat.build/                          
auto.20181218235709.log           crash.log                         nugget.log                            
auto.20181230173153.log           dafail.log                        recmon.20181230173153.log            
auto.20190106153953.log           detectads.20180808023829.log      recmon.log                            
auto.20190110173057.log           detectads.20181107085937.log      rs.log                                
auto.log                          detectads.log                     rsvsync.log                          
auto_old.log                      empty_dustbin.20171127024444.log  webif_auto/                          
chaseget.20181103134201.log       empty_dustbin.20181107085937.log  webif_autoq/                          
chaseget.20181212175711.log       empty_dustbin.log                 wlan.log
                              
HDRFOX3#
Notes:
  1. I have inserted extra blank lines in the above terminal session to clarify.

  2. "cd" = Change Directory; "ls" = LiSt contents of directory; "rm" = ReMove.

  3. Numbered logs are historical records from when the log file exceeds the user-defined size. The number to keep is also user-defined: in WebIF >> Settings

    98D37009-5EA2-4F1E-8FC3-0696698295EE.jpeg

    (I don't know why my listings show more than two rotations for my auto.log, but after a reboot they've gone!)

  4. If using a PC rather than a tablet, the <tab> key auto-completes - so typing (for example, from the above listing) "au<tab>2019011<tab>" automatically identifies file auto.20190110173057.log without having to type characters that are not needed to distinguish one file from another.

  5. To remove all historical records for a particular log use "rm <log>.*.log".

  6. To remove all historical records use "rm *.*.log".

  7. To find a file when you don't know where it is located: "cd /mod", then "find -iname <filename>". Command "find" is recursive (ie it searches the entire directory tree below the current working directory), so do not use it from the root directory or it will spend ages searching all your media folders and any mounts you have to remote servers (eg another HDR-FOX you have linked through network-shares-automount).

    The output from "find" can be used as direct input into "rm" - so, for example: "find -iname nugget.log" produces "./tmp/nugget.log", and "rm ./tmp/nugget.log" removes it ("." implies the current directory, in this case "mod", and nugget.log was found in the subdirectory "tmp").
Alternatively, with samba and/or betaftpd installed, you can use the GUI point-and-click directory navigation and file management available from almost any modern OS file manager or FTP client to do the same kinds of thing as you would on the local hard drive. My Win7 file manager, for example (bearing in mind I use Directory Opus instead of the built-in Windows file manager) can access the HDR-FOX HDD as a NAS because samba (SMB support) is installed, and also via FTP (once logged in) with betaftpd installed. MacOS requires nfsutils (NFS support) for NAS access, Linux OSes can use SMB or NFS.
 
Last edited:
Are they listed under WebIF >> Diagnostics >> View Log Files? If so, just click the X.
This doesn't remove them it just empties them which may be all that is required.
There seems to me little point in clearing a rotation file (previous log history), they will just be left as ghosts. The X should be a deletion for these, which I suspect is what has tripped the OP up - empty rotation files. However, they should then auto-delete when new rotations come along, according to the retention count in the settings... but as I found, that doesn't always work (until I rebooted - with a proper shutdown and startup, not just a crash-power-cycle).
 
It would be nice if there were a delete by age option in the settings to automatically delete any logs over n days old.
You are unlikely to ever need to investigate a problem that occurred more than a week ago.
Some low activity logs rotate very slowly, the op has recmon logs from 2016, whilst others might switch daily.
 
There seems to me little point in clearing a rotation file (previous log history), they will just be left as ghosts. The X should be a deletion for these, which I suspect is what has tripped the OP up - empty rotation files.
You are right, as ever, BH.

It was the Clear operation that prompted this thread.

I was also unclear as to where these files resided.

I wouldn't have looked in tmp for files that are over two years old!

Thanks for the fulsome instructions which I will follow in due course.
 
...
The output from "find" can be used as direct input into "rm" - so, for example: "find -iname nugget.log" produces "./tmp/nugget.log", and "rm ./tmp/nugget.log" removes it ("." implies the current directory, in this case "mod", and nugget.log was found in the subdirectory "tmp").
...
Not to forget the magical incantation for running a command on each found file: find from-dir selection-options -exec command '{}' \;.

In this syntax,
  • selection-options might be something like -name filename (fixed filename, case-sensitive) or -iname 'filename-pattern' (match using shell patterns *,?,[chars], case-insensitive, the '' are required to force the pattern to be parsed by find instead of the shell);
  • command could be something like rm -i (delete with confirm);
  • the '{}' is how find's -exec option knows where to put the found pathname (again the '' are required to force the {} to be parsed by find instead of the shell);
  • the \; marks the end of find's -exec (the \ is required to force the ; to be parsed by find instead of the shell, could equally be ';' ).
So for example:
Code:
# find . -iname '*.tmp' -exec rm -i '{}' \;
If you want a file-by-file confirmation prompt when running find ... -exec command ... with a command that doesn't prompt, you can use find from-dir selection-options -print0 | xargs -0 -p -n 1 command, as in:
Code:
# find . -iname '*.tmp' -print0 | xargs -0 -p -n 1 rm
There is a fancier version of the find command in the GNU findutils package with a -ok option that adds a prompt to -exec but that version hasn't made it to the CF repo. As above, the Busybox find can be adapted to most purposes using other tools in the environment.
 
Back
Top