介紹
Logs can be saved in routers RAM, disk, file, sent by email or even sent to remote syslog server
memory log
/log print
log 的 filter - where
where 之後可以接 message, time, topics
i.e.
# Facility independent topics
/log print without-paging where topics~".warning"
# Topics & Facility
/log print without-paging where topics~"interface.warning"
Notes
"~" binary operator that matches value against POSIX extended regular expression
Logging to file
Rules (什麼行什麼 Action) -> Action (設定 log 在那裡)
files format: log.0.txt (active file) and log.1.txt (old one) # disk-file-name=log
Log Rule
action (name; Default: memory)
prefix (string; Default: ) prefix added at the beginning of log messages
topics
- account #
- firewall # Firewall log messages generated when action=log is set in firewall rule
- system # Generic system messages
- ....
- critical
- debug
- error
- info
- packet
- raw
- warning
List log action
/system logging action print
0 * name="memory" target=memory memory-lines=1 memory-stop-on-full=no 1 * name="disk" target=disk disk-file-name="log" disk-lines-per-file=1000 disk-file-count=2 disk-stop-on-full=no 3 * name="remote" target=remote remote=0.0.0.0 remote-port=514 src-address=0.0.0.0 bsd-syslog=no syslog-time-format=bsd-syslog syslog-facility=daemon syslog-severity=auto
Add new log action
# Target: disk, echo, email, memory, remote; Default: memory
/system logging action add name=file target=disk disk-file-name=log
Make everything log using this new action
/system logging action=LogAll
How to clear log / history
clear log
/system logging action
set 0 memory-lines=1
set 0 memory-lines=1000
clear cli history
/console clear-history