After the update to amtm with the entware update check, I decided to proceed with the syslog-ng update. All went smooth, and I used the above "template" filter after testing the "time-reap" one.Another way that looks like it would work is to specify something like the default message format in the skynet config file:This might be a better way for scribe to change the included filter as it would be backwards compatible to 3.19, etc. Anyway, try both.Code:destination d_skynet { file("/opt/var/log/skynet-0.log", template("${DATE} ${HOST} ${MSGHDR}${MESSAGE}\n") ); };
Setting a global time_reap(60) (i.e. in /opt/etc/syslog-ng.conf) is backwards compatible though, which is the route I'm taking, it removes the possibility that something else in the future may mysteriously not work with syslog-ng. I think that has the effect of simply reverting to the pre-3.23 behaviour.After the update to amtm with the entware update check, I decided to proceed with the syslog-ng update. All went smooth, and I used the above "template" filter after testing the "time-reap" one. Both worked, but the fact that the "template" one is backward compatible might make it the better choice. Maybe it will stay compatible into the future too, who knows?
hrmmmmmm. Setting time_reap(60) as a global variable doesn't provide the expected behaviour. It still stops logging at the hour mark. I guess the next thing is to try changing to (2) like @elorimer did, but that doesn't make sense, it should work the way it did before.Setting a global time_reap(60) (i.e. in /opt/etc/syslog-ng.conf) is backwards compatible though, which is the route I'm taking, it removes the possibility that something else in the future may mysteriously not work with syslog-ng. I think that has the effect of simply reverting to the pre-3.23 behaviour.
I see why One Identity sells support for this thing, they don't seem too concerned about breaking expected behaviour. This change was very poorly documented IMHO. I would have never discovered it given the limited amount of time I have to devote to this. Many thanks to @elorimer for figuring this out.
I had the same thing with the "template" filter stopped on the hour.hrmmmmmm. Setting time_reap(60) as a global variable doesn't provide the expected behaviour. It still stops logging at the hour mark. I guess the next thing is to try changing to (2) like @elorimer did, but that doesn't make sense, it should work the way it did before.
destination d_skynet {
file("/opt/var/log/skynet-0.log", template("${DATE} ${HOST} ${MSGHDR}${MESSAGE}\n") );
destination d_skynet {
file("/opt/var/log/skynet-0.log", time-reap(2));
};
syslog-ng -Fevd
Nov 2 21:00:03 RT-AC86U-4608 Skynet: [#] 127741 IPs (+0) -- 27216 Ranges Banned (+0) || 7707 Inbound -- 21 Outbound Connections Blocked! [save] [3s]
Nov 2 21:00:07 RT-AC86U-4608 kernel: [BLOCKED - INBOUND].........
Nov 2 21:00:20 RT-AC86U-4608 kernel: [BLOCKED - INBOUND].........
I quite agree with you about the poor documentation of this "new functionality". I also thought the reason for the change was poorly understood. If one is to have a file destination at all, then the change completely breaks the prior behavior if there is any other process that addresses the file. It appears our scenario is an edge case. From https://github.com/syslog-ng/syslog-ng/pull/2798:hrmmmmmm. Setting time_reap(60) as a global variable doesn't provide the expected behaviour. It still stops logging at the hour mark. I guess the next thing is to try changing to (2) like @elorimer did, but that doesn't make sense, it should work the way it did before.
The PR also introduces a new functionality: If the pipe() or file() destination's filepath does not have a template, the time-reap() is not inherited from the global options, but is disabled, by default. The user can override this by explicitly setting time-reap() to non-zero at that destination.
Oh FFS, yes, you're correct that it never drops to the 3rd class - that explains why it didn't work when I made it global. I'm sure glad you have time to hunt this crap down, because I don't. This isn't the first time either, there was something between 3.17 and 3.19 that made me require 3.19 or higher going forward.I quite agree with you about the poor documentation of this "new functionality". I also thought the reason for the change was poorly understood. If one is to have a file destination at all, then the change completely breaks the prior behavior if there is any other process that addresses the file. It appears our scenario is an edge case. From https://github.com/syslog-ng/syslog-ng/pull/2798:Code:The PR also introduces a new functionality: If the pipe() or file() destination's filepath does not have a template, the time-reap() is not inherited from the global options, but is disabled, by default. The user can override this by explicitly setting time-reap() to non-zero at that destination.
I think the global time-reap() option doesn't apply, because we fall into the second class of writing to a file without a template, and the file is held open indefinitely. We never drop to the third class of applying the global option.
Also, it is time-reap, not time_reap.
I think time-reap(60) may be too long for skynet, which writes often, and so is likely to want to log to the file within a minute before doing its hourly purge.
Agree, I'm just a proponent of changing as little as possible. There's got to be some balance between ensuring the file gets closed periodically and not excessively closing and re-opening the file. On very slow thumb drives it might make a measurable difference, maybe.I took the 2 second parameter from the example in that github pull without any thought, and I agree that it would have been 60 before and must have worked, but wouldn't work when changed to forever. I suspect that for the volume of messages we are dealing with here there is not much of a performance advantage in leaving the file open in the first place.
If my specific message template didn't work, I'm not sure a similar global message template will work, although I came across that as an example; there is already a default message template. In a few places the templating here for pipe() and file() is described as a filepath template, which might include a file name template if one is, for example, writing separate files for separate sources or hosts.I'm thinking about creating a global template to ensure it doesn't
I have no doubt there will be another Crazy Ivan. Maybe they'll go port instead of starboard in the bottom of the hour.If my specific message template didn't work, I'm not sure a similar global message template will work, although I came across that as an example; there is already a default message template. In a few places the templating here for pipe() and file() is described as a filepath template, which might include a file name template if one is, for example, writing separate files for separate sources or hosts.
So perhaps it is best just to do the time reap fix and watch out for these guys to do another crazy ivan in the future.
Destination definition, not filter. I'm very literal, Jonesie.I'll leave the time_reap(60) in the skynet filter
# this MUST BE the file configured in Skynet as the syslog.log location
# DO NOT use /tmp/syslog.log or /opt/var/log/messages here!
destination d_skynet {
# file("/opt/var/log/skynet-0.log");
file("/opt/var/log/skynet-0.log", time-reap(60));
};
# logs everything from Skynet to /opt/var/log/skynet-0.log
filter f_skynet {
program("Skynet") or
message("BLOCKED -") or
message("DROP IN=");
};
# final flag stops processing of messages matching the f_skynet filter
log {
source(src);
filter(f_skynet);
destination(d_skynet);
flags(final);
};
#eof
Change time-reap(60) to time-reap(2) and it should work.i have tried to modify the destination definition with the time-reap(60) but so far nothing comes up
/opt/etc/syslog-ng.d/skynet
destination d_skynet {
file("/opt/var/log/skynet-0.log", time-reap(2));
};
destination d_skynet {
file("/opt/var/log/skynet-0.log");
};
I'm not sure syslog-ng allows comments inside of definitions. Try taking out the "# file("/opt/var/log/skynet-0.log");" line. Long shot, but I'm not sure what else to try. Also, Skynet will clear skynet-0 every hour, but it should repopulate after that.hello
i havent been able to get this to work. skynet-0.log is empty.
i have tried to modify the destination definition with the time-reap(60) but so far nothing comes up
/opt/etc/syslog-ng.d/skynet
Code:# this MUST BE the file configured in Skynet as the syslog.log location # DO NOT use /tmp/syslog.log or /opt/var/log/messages here! destination d_skynet { # file("/opt/var/log/skynet-0.log"); file("/opt/var/log/skynet-0.log", time-reap(60)); }; # logs everything from Skynet to /opt/var/log/skynet-0.log filter f_skynet { program("Skynet") or message("BLOCKED -") or message("DROP IN="); }; # final flag stops processing of messages matching the f_skynet filter log { source(src); filter(f_skynet); destination(d_skynet); flags(final); }; #eof
by deleting the time-reap and leaving the skynet file as is, it will start showing data on skynet log again but it will erase after some time
hi
it doesnt work either. just changed it and executed scribe restart
skynet-0.log goes back to a blank file
if i use the regular expression
Code:destination d_skynet { file("/opt/var/log/skynet-0.log"); };
skynet-0.log will populate for some time but returns to blank after
# this MUST BE the file configured in Skynet as the syslog.log location
# DO NOT use /tmp/syslog.log or /opt/var/log/messages here!
destination d_skynet {
file("/opt/var/log/skynet-0.log", time-reap(2));
};
# logs everything from Skynet to /opt/var/log/skynet-0.log
filter f_skynet {
program("Skynet") or
message("BLOCKED -") or
message("DROP IN=");
};
# final flag stops processing of messages matching the f_skynet filter
log {
source(src);
filter(f_skynet);
destination(d_skynet);
flags(final);
};
#eof
I think it may be that commenting out lines might work--there are examples of this in the syslog-ng conf files--but one must be careful of this for another reason: @Jack Yaz 's uiScribe script.destination d_skynet {
# file("/opt/var/log/skynet-0.log");
file("/opt/var/log/skynet-0.log", time-reap(60));
};
destination d_skynet { file("/opt/var/log/skynet-0.log", time-reap(60)); };
Thanks. It’s been working since 8 hours.Code:# this MUST BE the file configured in Skynet as the syslog.log location # DO NOT use /tmp/syslog.log or /opt/var/log/messages here! destination d_skynet { file("/opt/var/log/skynet-0.log", time-reap(2)); }; # logs everything from Skynet to /opt/var/log/skynet-0.log filter f_skynet { program("Skynet") or message("BLOCKED -") or message("DROP IN="); }; # final flag stops processing of messages matching the f_skynet filter log { source(src); filter(f_skynet); destination(d_skynet); flags(final); }; #eof
Just copy this and replace your whole file with it, dont do anything different like adding commented stuff where you should not...
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!