Community discussions

MikroTik App
 
611
newbie
Topic Author
Posts: 47
Joined: Wed Oct 17, 2018 10:12 am

Logging Actions to an USB disk are lost after reboot

Sun Nov 03, 2019 12:37 pm

All logging actions with destination pointing to an USB disk are lost after reboot on latest beta (6.46beta59):

/system logging export pre-reboot:
# nov/03/2019 11:43:17 by RouterOS 6.46beta59
# software id = [redacted]
#
# model = RouterBOARD 3011UiAS
# serial number = [redacted]
/system logging action
set 0 memory-lines=4096
add disk-file-count=4096 disk-file-name=/usb/logs/system/system-log \
    disk-lines-per-file=4096 name=logDisk target=disk
add disk-file-count=4096 disk-file-name=/usb/dude/logs/dude-log \
    disk-lines-per-file=4096 name=logDude target=disk
add disk-file-count=4096 disk-file-name=/usb/dude/syslog/syslog \
    disk-lines-per-file=4096 name=logDudeSyslog target=disk
add disk-file-count=4096 disk-file-name=/usb/logs/fw/fw-log \
    disk-lines-per-file=4096 name=logDiskFW target=disk
add disk-file-count=4096 disk-file-name=/usb/logs/dns/dns-log \
    disk-lines-per-file=4096 name=logDiskDNS target=disk
add disk-file-count=4096 disk-file-name=/usb/logs/caps/caps-log \
    disk-lines-per-file=4096 name=logDiskCAPs target=disk
/system logging
set 0 topics=info,!firewall,!caps
add action=logDiskFW topics=firewall
add action=logDisk topics=error
add action=logDisk topics=info
add action=logDisk topics=warning
add action=logDiskDNS topics=dns,!packet
add action=logDisk topics=critical
add action=logDudeSyslog topics=dude,event
add action=logDude topics=dude,!event
add action=logDiskFW topics=upnp
add action=logDiskCAPs topics=caps

/system logging export post-reboot:
# [cut]
/system logging action
set 0 memory-lines=4096
/system logging
set 0 topics=info,!firewall,!caps
add topics=firewall
add topics=error
add topics=info
add topics=warning
add topics=dns,!packet
add topics=critical
add topics=dude,event
add topics=dude,!event
add topics=upnp
add topics=caps

Printout shows missing links to now non-existent logging actions:
/system logging print          
Flags: X - disabled, I - invalid, * - default 
 #    TOPICS                                                                       ACTION                                                                       PREFIX    
 0  * info                                                                         memory                                                                                 
      !firewall                                                                   
      !caps                                                                       
 1  * error                                                                        memory                                                                                 
 2  * warning                                                                      memory                                                                                 
 3  * critical                                                                     echo                                                                                   
 4 I  firewall                                                                     *7                                                                                     
 5 I  error                                                                        *4                                                                                     
 6 I  info                                                                         *4                                                                                     
 7 I  warning                                                                      *4                                                                                     
 8 I  dns                                                                          *8                                                                                     
      !packet                                                                     
 9 I  critical                                                                     *4                                                                                     
10 I  dude                                                                         *6                                                                                     
      event                                                                       
11 I  dude                                                                         *5                                                                                     
      !event                                                                      
12 I  upnp                                                                         *7                                                                                     
13 I  caps                                                                         *9                                                                                     

The disk is an old 180Gb Intel i520 SSD in USB 2.0 enclosure, renamed to "usb" for clarity.
/disk print 
 # NAME                                           LABEL                                         TYPE    DISK                                               FREE       SIZE
 0 usb                                            i520-180G                                     ext3    External                                       166.3GiB   167.7GiB

The Dude has no problem working with its base on the disk.

I haven't experienced such problem with the same configuration several months ago, when I've used a 64Gb USB 3.0 stick for the same purposes, with the latest beta ROS releases at the time.
Since that time the stick has failed, and I've switched to a real drive, ROS was updated to fresh betas several times.

I could restore actions after reboot with a startup schedule as a temporary workaround:
/system scheduler add name=sched-restore-logging-actions on-event="delay 10; /system script run scr-restore-logging-actions" policy= read,write start-time=startup

The schedule launches this script:
:if ([/system logging action print count-only where name=logDisk]=0) do={/system logging action add disk-file-count=4096 disk-file-name=/usb/logs/system/system-log disk-lines-per-file=4096 name=logDisk target=disk}
:if ([/system logging action print count-only where name=logDiskFW]=0) do={/system logging action add disk-file-count=4096 disk-file-name=/usb/logs/fw/fw-log disk-lines-per-file=4096 name=logDiskFW target=disk}
:if ([/system logging action print count-only where name=logDiskDNS]=0) do={/system logging action add disk-file-count=4096 disk-file-name=/usb/logs/dns/dns-log disk-lines-per-file=4096 name=logDiskDNS target=disk}
:if ([/system logging action print count-only where name=logDiskCAPs]=0) do={/system logging action add disk-file-count=4096 disk-file-name=/usb/logs/caps/caps-log disk-lines-per-file=4096 name=logDiskCAPs target=disk}
:if ([/system logging action print count-only where name=logDude]=0) do={/system logging action add disk-file-count=4096 disk-file-name=/usb/dude/logs/dude-log disk-lines-per-file=4096 name=logDude target=disk}
:if ([/system logging action print count-only where name=logDudeSyslog]=0) do={/system logging action add disk-file-count=4096 disk-file-name=/usb/dude/syslog/syslog disk-lines-per-file=4096 name=logDudeSyslog target=disk}
/system logging set [find topics="critical" and default=no] action=logDisk 
/system logging set [find topics="error" and default=no] action=logDisk  
/system logging set [find topics="warning" and default=no] action=logDisk  
/system logging set [find topics="info" and default=no] action=logDisk        
/system logging set [find topics="caps"] action=logDiskCAPs
/system logging set [find topics="dns;!packet"] action=logDiskDNS
/system logging set [find topics="firewall"] action=logDiskFW
/system logging set [find topics="upnp"] action=logDiskFW
/system logging set [find topics="dude;!event"] action=logDude
/system logging set [find topics="dude;event"] action=logDudeSyslog

Looks like the problem is a delay needed for disk startup - I've noticed that "delay 5" in the schedule is insufficient and results in "script error: failure: bad disk file name".

Note that just importing a file with a bunch of "/system logging action add" in the proper order (as I've first tried as a fast-and-dirty fix) doesn't work - sometimes it's OK, but most times the actions are getting mixed up.

Suggestions are welcome.
 
vskoric
just joined
Posts: 2
Joined: Fri Dec 13, 2019 5:06 pm

Re: Logging Actions to an USB disk are lost after reboot

Fri Dec 13, 2019 5:18 pm

HI,

I have identical problem on my RB since upgrade to 6.46, though I have the logging action pointing to SD card ext3 FS
I have tried mounting card under different directory, and recreating rules and actions but no luck
Looks like a bug

model: RouterBOARD M33G
firmware-type: mt7621L
factory-firmware: 3.41
current-firmware: 6.46
upgrade-firmware: 6.46
/system logging> print
Flags: X - disabled, I - invalid, * - default
 #    TOPICS                                              ACTION                                             PREFIX
 0  * info                                                memory
      !firewall
 1 I* error                                               *C
 2  * warning                                             memory
 3  * critical                                            echo
 4 I  info                                                *D
      !firewall
 5 I  warning                                             *C
 6 I  critical                                            *C
 7 I  firewall                                            *F
 8    critical                                            mail
 9    error                                               mail
      !ipsec
10    upnp                                                memory
 
vskoric
just joined
Posts: 2
Joined: Fri Dec 13, 2019 5:06 pm

Re: Logging Actions to an USB disk are lost after reboot

Sat Dec 21, 2019 3:58 pm

looks like issue has been fixed in 6.46.1

Who is online

Users browsing this forum: flintham12, TomSvitana and 69 guests