In log i want write a string like "PC1 is down".
I don't understand how to use "action" and "rule" of logging system to obtain a file only dedicated to netwatch message.
I don't understand how to log only netwatch log because script can write only on 4 topics.. "debug, error, info and warning".. so, how can i create a rule to filter only netwatch message ?
try smth like this:
create new action in logging (type - disk, file count 1, file name - any name you want)
create new rule (topics: script, warning action: your new action, prefix - any you want )
in netwach in down action add command (or add to the script what you run on "down"event this line: /log warning "PC is down at $[/system clock get time]" )
after that add to the scheduler script to send e-mail with file (file will have name you had written in "action" + .0.txt)
to send file you can use smth like:
/tool e-mail send to=
yourmail@gmail.com subject="Netwach lof file" file="netwachlog.0.txt"
to clear log file after sending just delete file
/file remove netwachlog.0.txt
also you can add logging for "up" event