Commit 2ae1a49
committed
Add git dfprog/++host/::filter stop-processing block prefix
Inspired by OpenBSD syslogd, introduce a double-prefix syntax for block
headers that stops rule evaluation once a matching rule fires,
preventing a message from being logged twice.
!!prog -- like !prog but stops on match
++host -- like +host but stops on match
::filter -- like :filter but stops on match (sysklogd extension)
Use !*, +*, or :* as usual to reset and resume normal evaluation for
subsequent blocks.
The STOP_FLAG (0x040) is set on all filed entries created within a
double-prefix block. The logmsg() dispatch loop breaks out of the
SIMPLEQ_FOREACH as soon as it processes a rule carrying that flag,
so no further rules see the message.
Example -- route nftables firewall logs exclusively to their own file:
::msg, contains, "[nftables"
kern.* -/var/log/nftables.log
:*
*.warn;authpriv.none -/var/log/syslog
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>1 parent da40146 commit 2ae1a49
3 files changed
Lines changed: 104 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| |||
176 | 179 | | |
177 | 180 | | |
178 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
179 | 192 | | |
180 | 193 | | |
181 | 194 | | |
| |||
197 | 210 | | |
198 | 211 | | |
199 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
200 | 223 | | |
201 | 224 | | |
202 | 225 | | |
203 | 226 | | |
204 | 227 | | |
205 | 228 | | |
206 | 229 | | |
207 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
208 | 241 | | |
209 | 242 | | |
210 | 243 | | |
| |||
844 | 877 | | |
845 | 878 | | |
846 | 879 | | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
847 | 911 | | |
848 | 912 | | |
849 | 913 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2526 | 2526 | | |
2527 | 2527 | | |
2528 | 2528 | | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
2529 | 2532 | | |
2530 | 2533 | | |
2531 | 2534 | | |
| |||
4146 | 4149 | | |
4147 | 4150 | | |
4148 | 4151 | | |
4149 | | - | |
| 4152 | + | |
4150 | 4153 | | |
4151 | | - | |
| 4154 | + | |
4152 | 4155 | | |
4153 | 4156 | | |
4154 | 4157 | | |
| |||
4891 | 4894 | | |
4892 | 4895 | | |
4893 | 4896 | | |
| 4897 | + | |
4894 | 4898 | | |
4895 | 4899 | | |
4896 | 4900 | | |
| |||
4923 | 4927 | | |
4924 | 4928 | | |
4925 | 4929 | | |
| 4930 | + | |
| 4931 | + | |
| 4932 | + | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
4926 | 4938 | | |
4927 | 4939 | | |
4928 | 4940 | | |
4929 | 4941 | | |
4930 | 4942 | | |
| 4943 | + | |
4931 | 4944 | | |
4932 | 4945 | | |
4933 | 4946 | | |
| |||
4949 | 4962 | | |
4950 | 4963 | | |
4951 | 4964 | | |
| 4965 | + | |
| 4966 | + | |
| 4967 | + | |
| 4968 | + | |
| 4969 | + | |
| 4970 | + | |
| 4971 | + | |
| 4972 | + | |
| 4973 | + | |
4952 | 4974 | | |
4953 | 4975 | | |
4954 | 4976 | | |
4955 | 4977 | | |
4956 | 4978 | | |
| 4979 | + | |
4957 | 4980 | | |
4958 | 4981 | | |
4959 | 4982 | | |
| |||
4968 | 4991 | | |
4969 | 4992 | | |
4970 | 4993 | | |
| 4994 | + | |
| 4995 | + | |
| 4996 | + | |
| 4997 | + | |
| 4998 | + | |
| 4999 | + | |
| 5000 | + | |
| 5001 | + | |
| 5002 | + | |
4971 | 5003 | | |
4972 | 5004 | | |
4973 | 5005 | | |
4974 | 5006 | | |
| 5007 | + | |
4975 | 5008 | | |
4976 | 5009 | | |
4977 | 5010 | | |
| |||
5034 | 5067 | | |
5035 | 5068 | | |
5036 | 5069 | | |
| 5070 | + | |
| 5071 | + | |
| 5072 | + | |
5037 | 5073 | | |
5038 | 5074 | | |
5039 | 5075 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
0 commit comments