File tree Expand file tree Collapse file tree 4 files changed +19
-2
lines changed
testdata/unit/clusterer/rules Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 77* add ` replacer ` processor to replace substrings in fields using a syntax similar to the ` dissector `
88
99### Improvements
10+
11+ * ensured that "_ test.json" files are not loaded as rules
12+
1013### Bugfix
1114
1215- Fixed logging error in _ revoke_callback() by adding error handling
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ def rule_definitions(self) -> List[Dict]:
197197 raise TypeError (f"Expected a string, got { type (self .source )} " )
198198 if self .source .endswith (".yaml" ) or self .source .endswith (".yml" ):
199199 rule_definitions = GetterFactory .from_string (self .source ).get_yaml ()
200- elif self .source .endswith (".json" ):
200+ elif self .source .endswith (".json" ) and not self . source . endswith ( "_test.json" ) :
201201 rule_definitions = GetterFactory .from_string (self .source ).get_json ()
202202 if not isinstance (rule_definitions , list ):
203203 rule_definitions = [rule_definitions ]
Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "filter" : " message" ,
4+ "clusterer" : {
5+ "source_fields" : [" message" ],
6+ "pattern" : " test (signature) test" ,
7+ "repl" : " <+>\\ 1</+>"
8+ },
9+ "description" : " insert a description text"
10+ }
11+ ]
Original file line number Diff line number Diff line change 2424 ProcessingCriticalError ,
2525)
2626from logprep .processor .base .rule import Rule
27+ from logprep .util .defaults import RULE_FILE_EXTENSIONS
2728from tests .unit .component .base import BaseComponentTestCase
2829
2930yaml = YAML (typ = "safe" , pure = True )
@@ -59,7 +60,9 @@ def set_rules(rules_dirs):
5960 rules = []
6061 for rules_dir in rules_dirs :
6162 rule_paths = [
62- p for p in Path (rules_dir ).glob ("**/*" ) if p .suffix in [".yml" , ".json" , "yaml" ]
63+ path
64+ for path in Path (rules_dir ).glob ("**/*" )
65+ if path .suffix in RULE_FILE_EXTENSIONS and not path .name .endswith ("_test.json" )
6366 ]
6467 for rule_path in rule_paths :
6568 loaded_rules = []
You can’t perform that action at this time.
0 commit comments