Hi
I write regularly (5min interval) some information to a file
which I use externally in a webpage by parsing the content.
I want to overwrite the old file everytime and don't like to
use log rotation because of disk space consumption.
I use the following code:
******** log.bro **********
# writes a summary of the currently seen hosts
# and its states to the file "current_states.log"
# do this regularly all Xmins (log_interval)
event print_current_states_file() {
# opens the file "current_states.log"
local current_states_file = open("current_states.log");
# write file header
print "...";
...
# close the file "current_states.log"
close(current_states_file);
# do it again in Xmins
schedule log_interval {print_current_states_file()};
}
event bro_init() {
# start log
schedule log_interval {print_current_states_file()};
}