plugin/log: support multi nameScope (#2420)

This commit is contained in:
ckcd 2019-01-08 15:40:50 +08:00 committed by Miek Gieben
parent 53d1afbaf2
commit 418edd2a2f
3 changed files with 69 additions and 25 deletions

View file

@ -55,6 +55,35 @@ func TestLogParse(t *testing.T) {
Format: "{when}",
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org example.net`, false, []Rule{{
NameScope: "example.org.",
Format: DefaultLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
}, {
NameScope: "example.net.",
Format: DefaultLogFormat,
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org example.net {host}`, false, []Rule{{
NameScope: "example.org.",
Format: "{host}",
Class: map[response.Class]struct{}{response.All: struct{}{}},
}, {
NameScope: "example.net.",
Format: "{host}",
Class: map[response.Class]struct{}{response.All: struct{}{}},
}}},
{`log example.org example.net {when} {
class denial
}`, false, []Rule{{
NameScope: "example.org.",
Format: "{when}",
Class: map[response.Class]struct{}{response.Denial: struct{}{}},
}, {
NameScope: "example.net.",
Format: "{when}",
Class: map[response.Class]struct{}{response.Denial: struct{}{}},
}}},
{`log example.org {
class all