script - send message to log in color

Just a tip

If you have a script that is sending messages to the log - and you want it to stand out so that it is easier to find when looking at your logs - then try something like this:

BLACK
log info “blah blah this log is in black”

BLUE
log warning “blah blah this log is in blue”

RED
log error “blah blah this log is in red”


below is a sample (I pasted this in from the winbox new-terminal window)":

[admin@PB-12-7] > log info “blah blah this log is in black”
[admin@PB-12-7] > log warning “blah blah this log is in blue”
[admin@PB-12-7] > log error “blah blah this log is in red”

In my logs - I have three new lines, one in black, one in blue and one in red.

blah blah this log is in black
blah blah this log is in blue
blah blah this log is in red

That is a creative use of the log types! However, keep in mind the different rules for different log types. Some of those are written to disk and some just to memory. You don’t want to fill up your disk log with junk just because you like the color red, for example.

it is possible to reconfigure /system log action, so that logs are logged as required :slight_smile:

re: That is a creative use of the log types! However, keep in mind the different rules for different log types. Some of those are written to disk and some just to memory. You don’t want to fill up your disk log with junk just because you like the color red, for example.


You are correct about writing to disk and filling up the disk with log files. I simply do a write to memory for my logs to avoid filling up and disk space.

System → Logging → Rules tab:
critical echo
error memory
info memory
warning memory

If you make everything go to memory, you will lose logs after a reboot and you won’t be able to see what was happening before a reboot.

What do you think about log and colors? For me it will be very helpful, reading logs will be easier.