detectmatelibrary 0.3.1__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/PKG-INFO +6 -5
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/README.md +5 -4
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/detectmatelibrary.egg-info/PKG-INFO +6 -5
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/detectmatelibrary.egg-info/SOURCES.txt +2 -57
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/detectmatelibrary.egg-info/top_level.txt +0 -1
- detectmatelibrary-0.3.2/src/detectmatelibrary/alert_aggregation/basic_concat.py +29 -0
- detectmatelibrary-0.3.2/src/detectmatelibrary/common/alert_aggregator.py +99 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/core.py +52 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/metadata.py +1 -1
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/util.py +14 -12
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/__init__.py +3 -1
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_persistency.py +25 -13
- detectmatelibrary-0.3.2/src/detectmatelibrary/utils/persistency/persistency_saver.py +365 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary_tools/workspace/create_workspace.py +3 -4
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common/test_config.py +0 -192
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common/test_config_roundtrip.py +0 -379
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common/test_core.py +0 -524
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common/test_core_detector.py +0 -196
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common/test_core_parser.py +0 -165
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common/test_extract_timestamp.py +0 -52
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common/test_fit_logic.py +0 -62
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common/test_persist_config.py +0 -145
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/dummy_detector.py +0 -43
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_bigram_frequency_detector.py +0 -596
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_charset_detector.py +0 -422
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_mismatch_warnings.py +0 -218
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_new_event_detector.py +0 -250
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_new_value_combo_detector.py +0 -578
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_new_value_detector.py +0 -312
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_persist_integration.py +0 -132
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_random_detector.py +0 -72
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_rule_detector.py +0 -179
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors/test_value_range_detector.py +0 -427
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_helper/test_from_to.py +0 -497
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_others/test_logging.py +0 -84
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_parsers/__init__.py +0 -0
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_parsers/dummy_parser.py +0 -33
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_parsers/test_json_parser.py +0 -211
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_parsers/test_logbatcher_parser.py +0 -82
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_parsers/test_template_matcher.py +0 -241
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_parsers/test_tree_macther.py +0 -47
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_persistency/__init__.py +0 -0
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_persistency/test_stability_tracker.py +0 -132
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_pipelines/__init__.py +0 -0
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_pipelines/test_bad_players.py +0 -70
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_pipelines/test_basic_pipelines.py +0 -117
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_pipelines/test_configuration_engine.py +0 -88
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_pipelines/test_dummy_methods.py +0 -76
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_schemas/__init__.py +0 -0
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_schemas/test_default_values.py +0 -61
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_schemas/test_ops.py +0 -170
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_schemas/test_schema_class.py +0 -165
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/__init__.py +0 -0
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_aux.py +0 -25
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_data_buffer.py +0 -83
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_data_normalizer.py +0 -9
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_events_seen.py +0 -66
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_log_format_utils.py +0 -45
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_persistency.py +0 -486
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_persistency_dump_load.py +0 -190
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_persistency_saver.py +0 -278
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_utils/test_stability_tracking.py +0 -554
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_workspace/__init__.py +0 -0
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_workspace/test_create_workspace.py +0 -206
- detectmatelibrary-0.3.1/detectmatelibrary_tests/test_workspace/test_utils.py +0 -21
- detectmatelibrary-0.3.1/src/detectmatelibrary/common/__init__.py +0 -0
- detectmatelibrary-0.3.1/src/detectmatelibrary/parsers/__init__.py +0 -0
- detectmatelibrary-0.3.1/src/detectmatelibrary/utils/persistency/persistency_saver.py +0 -215
- detectmatelibrary-0.3.1/src/detectmatelibrary_tools/__init__.py +0 -0
- detectmatelibrary-0.3.1/src/detectmatelibrary_tools/workspace/__init__.py +0 -0
- detectmatelibrary-0.3.1/src/detectmatelibrary_tools/workspace/templates/__init__.py +0 -0
- detectmatelibrary-0.3.1/src/detectmatelibrary_tools/workspace/templates/test_templates/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/LICENSE.md +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/detectmatelibrary.egg-info/dependency_links.txt +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/detectmatelibrary.egg-info/entry_points.txt +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/detectmatelibrary.egg-info/requires.txt +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/pyproject.toml +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/setup.cfg +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/__init__.py +0 -0
- {detectmatelibrary-0.3.1/detectmatelibrary_tests → detectmatelibrary-0.3.2/src/detectmatelibrary/common}/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/_config/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/_config/_compile.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/_config/_formats.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/_core_op/_fit_logic.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/_core_op/_schema_pipeline.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/parser.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/common/persist.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/constants.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/bigram_frequency_detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/charset_detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/new_event_detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/new_value_combo_detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/new_value_detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/random_detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/rule_detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/detectors/value_range_detector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/helper/from_to.py +0 -0
- {detectmatelibrary-0.3.1/detectmatelibrary_tests/test_common → detectmatelibrary-0.3.2/src/detectmatelibrary/parsers}/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/drain.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/json_parser.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/additional_cluster.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/cluster.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/matching.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/parser.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/parsing_base.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/parsing_cache.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/postprocess.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/sample.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/engine/vars.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/logbatcher/parser.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/template_matcher/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/template_matcher/_matcher_op.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/template_matcher/_parser.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/parsers/tree_matcher.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/schemas/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/schemas/_classes.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/schemas/_op.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/schemas/schemas_pb2.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/aux.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/data_buffer.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/data_normalizer.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/id_generator.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/key_extractor.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/log_format_utils.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/base.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/dataframes/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/dataframes/chunked_event_dataframe.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/dataframes/event_dataframe.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/trackers/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/trackers/base/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/trackers/base/event_tracker.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/trackers/base/multi_tracker.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/trackers/base/single_tracker.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/trackers/stability/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/trackers/stability/stability_classifier.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/event_data_structures/trackers/stability/stability_tracker.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/persistency/rle_list.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/preview_helpers.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary/utils/time_format_handler.py +0 -0
- {detectmatelibrary-0.3.1/detectmatelibrary_tests/test_detectors → detectmatelibrary-0.3.2/src/detectmatelibrary_tools}/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary_tools/logging.py +0 -0
- {detectmatelibrary-0.3.1/detectmatelibrary_tests/test_folder → detectmatelibrary-0.3.2/src/detectmatelibrary_tools/workspace}/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary_tools/workspace/templates/CustomDetector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary_tools/workspace/templates/CustomParser.py +0 -0
- {detectmatelibrary-0.3.1/detectmatelibrary_tests/test_helper → detectmatelibrary-0.3.2/src/detectmatelibrary_tools/workspace/templates}/__init__.py +0 -0
- {detectmatelibrary-0.3.1/detectmatelibrary_tests/test_others → detectmatelibrary-0.3.2/src/detectmatelibrary_tools/workspace/templates/test_templates}/__init__.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary_tools/workspace/templates/test_templates/test_CustomDetector.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary_tools/workspace/templates/test_templates/test_CustomParser.py +0 -0
- {detectmatelibrary-0.3.1 → detectmatelibrary-0.3.2}/src/detectmatelibrary_tools/workspace/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: detectmatelibrary
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: DetectMate Library for log processing components
|
|
5
5
|
Author: André García Gómez, Viktor Beck, Thorina Boenke, Wolfgang Hotwagner, Anna Erdi, Ernst Leierzopf
|
|
6
6
|
License-Expression: EUPL-1.2
|
|
@@ -37,13 +37,14 @@ Main library to run the different components in DetectMate.
|
|
|
37
37
|
|
|
38
38
|
The library contains the next components:
|
|
39
39
|
|
|
40
|
-
* **Parsers**: parse the logs
|
|
40
|
+
* **Parsers**: parse the logs received from the reader.
|
|
41
41
|
* **Detectors**: return alerts if anomalies are detected.
|
|
42
|
+
* **Alert Aggregation**: aggregate the alerts produced by the detectors.
|
|
42
43
|
* **Schemas**: standard data classes use in DetectMate.
|
|
43
44
|
```
|
|
44
|
-
+--------+ +-----------+
|
|
45
|
-
| Parser | --> | Detector |
|
|
46
|
-
+--------+ +-----------+
|
|
45
|
+
+--------+ +-----------+ +-------------------+
|
|
46
|
+
| Parser | --> | Detector | -> | Alert Aggregation |
|
|
47
|
+
+--------+ +-----------+ +-------------------+
|
|
47
48
|
```
|
|
48
49
|
## Developer setup:
|
|
49
50
|
|
|
@@ -6,13 +6,14 @@ Main library to run the different components in DetectMate.
|
|
|
6
6
|
|
|
7
7
|
The library contains the next components:
|
|
8
8
|
|
|
9
|
-
* **Parsers**: parse the logs
|
|
9
|
+
* **Parsers**: parse the logs received from the reader.
|
|
10
10
|
* **Detectors**: return alerts if anomalies are detected.
|
|
11
|
+
* **Alert Aggregation**: aggregate the alerts produced by the detectors.
|
|
11
12
|
* **Schemas**: standard data classes use in DetectMate.
|
|
12
13
|
```
|
|
13
|
-
+--------+ +-----------+
|
|
14
|
-
| Parser | --> | Detector |
|
|
15
|
-
+--------+ +-----------+
|
|
14
|
+
+--------+ +-----------+ +-------------------+
|
|
15
|
+
| Parser | --> | Detector | -> | Alert Aggregation |
|
|
16
|
+
+--------+ +-----------+ +-------------------+
|
|
16
17
|
```
|
|
17
18
|
## Developer setup:
|
|
18
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: detectmatelibrary
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: DetectMate Library for log processing components
|
|
5
5
|
Author: André García Gómez, Viktor Beck, Thorina Boenke, Wolfgang Hotwagner, Anna Erdi, Ernst Leierzopf
|
|
6
6
|
License-Expression: EUPL-1.2
|
|
@@ -37,13 +37,14 @@ Main library to run the different components in DetectMate.
|
|
|
37
37
|
|
|
38
38
|
The library contains the next components:
|
|
39
39
|
|
|
40
|
-
* **Parsers**: parse the logs
|
|
40
|
+
* **Parsers**: parse the logs received from the reader.
|
|
41
41
|
* **Detectors**: return alerts if anomalies are detected.
|
|
42
|
+
* **Alert Aggregation**: aggregate the alerts produced by the detectors.
|
|
42
43
|
* **Schemas**: standard data classes use in DetectMate.
|
|
43
44
|
```
|
|
44
|
-
+--------+ +-----------+
|
|
45
|
-
| Parser | --> | Detector |
|
|
46
|
-
+--------+ +-----------+
|
|
45
|
+
+--------+ +-----------+ +-------------------+
|
|
46
|
+
| Parser | --> | Detector | -> | Alert Aggregation |
|
|
47
|
+
+--------+ +-----------+ +-------------------+
|
|
47
48
|
```
|
|
48
49
|
## Developer setup:
|
|
49
50
|
|
|
@@ -7,67 +7,12 @@ detectmatelibrary.egg-info/dependency_links.txt
|
|
|
7
7
|
detectmatelibrary.egg-info/entry_points.txt
|
|
8
8
|
detectmatelibrary.egg-info/requires.txt
|
|
9
9
|
detectmatelibrary.egg-info/top_level.txt
|
|
10
|
-
detectmatelibrary_tests/__init__.py
|
|
11
|
-
detectmatelibrary_tests/test_common/__init__.py
|
|
12
|
-
detectmatelibrary_tests/test_common/test_config.py
|
|
13
|
-
detectmatelibrary_tests/test_common/test_config_roundtrip.py
|
|
14
|
-
detectmatelibrary_tests/test_common/test_core.py
|
|
15
|
-
detectmatelibrary_tests/test_common/test_core_detector.py
|
|
16
|
-
detectmatelibrary_tests/test_common/test_core_parser.py
|
|
17
|
-
detectmatelibrary_tests/test_common/test_extract_timestamp.py
|
|
18
|
-
detectmatelibrary_tests/test_common/test_fit_logic.py
|
|
19
|
-
detectmatelibrary_tests/test_common/test_persist_config.py
|
|
20
|
-
detectmatelibrary_tests/test_detectors/__init__.py
|
|
21
|
-
detectmatelibrary_tests/test_detectors/dummy_detector.py
|
|
22
|
-
detectmatelibrary_tests/test_detectors/test_bigram_frequency_detector.py
|
|
23
|
-
detectmatelibrary_tests/test_detectors/test_charset_detector.py
|
|
24
|
-
detectmatelibrary_tests/test_detectors/test_mismatch_warnings.py
|
|
25
|
-
detectmatelibrary_tests/test_detectors/test_new_event_detector.py
|
|
26
|
-
detectmatelibrary_tests/test_detectors/test_new_value_combo_detector.py
|
|
27
|
-
detectmatelibrary_tests/test_detectors/test_new_value_detector.py
|
|
28
|
-
detectmatelibrary_tests/test_detectors/test_persist_integration.py
|
|
29
|
-
detectmatelibrary_tests/test_detectors/test_random_detector.py
|
|
30
|
-
detectmatelibrary_tests/test_detectors/test_rule_detector.py
|
|
31
|
-
detectmatelibrary_tests/test_detectors/test_value_range_detector.py
|
|
32
|
-
detectmatelibrary_tests/test_folder/__init__.py
|
|
33
|
-
detectmatelibrary_tests/test_helper/__init__.py
|
|
34
|
-
detectmatelibrary_tests/test_helper/test_from_to.py
|
|
35
|
-
detectmatelibrary_tests/test_others/__init__.py
|
|
36
|
-
detectmatelibrary_tests/test_others/test_logging.py
|
|
37
|
-
detectmatelibrary_tests/test_parsers/__init__.py
|
|
38
|
-
detectmatelibrary_tests/test_parsers/dummy_parser.py
|
|
39
|
-
detectmatelibrary_tests/test_parsers/test_json_parser.py
|
|
40
|
-
detectmatelibrary_tests/test_parsers/test_logbatcher_parser.py
|
|
41
|
-
detectmatelibrary_tests/test_parsers/test_template_matcher.py
|
|
42
|
-
detectmatelibrary_tests/test_parsers/test_tree_macther.py
|
|
43
|
-
detectmatelibrary_tests/test_persistency/__init__.py
|
|
44
|
-
detectmatelibrary_tests/test_persistency/test_stability_tracker.py
|
|
45
|
-
detectmatelibrary_tests/test_pipelines/__init__.py
|
|
46
|
-
detectmatelibrary_tests/test_pipelines/test_bad_players.py
|
|
47
|
-
detectmatelibrary_tests/test_pipelines/test_basic_pipelines.py
|
|
48
|
-
detectmatelibrary_tests/test_pipelines/test_configuration_engine.py
|
|
49
|
-
detectmatelibrary_tests/test_pipelines/test_dummy_methods.py
|
|
50
|
-
detectmatelibrary_tests/test_schemas/__init__.py
|
|
51
|
-
detectmatelibrary_tests/test_schemas/test_default_values.py
|
|
52
|
-
detectmatelibrary_tests/test_schemas/test_ops.py
|
|
53
|
-
detectmatelibrary_tests/test_schemas/test_schema_class.py
|
|
54
|
-
detectmatelibrary_tests/test_utils/__init__.py
|
|
55
|
-
detectmatelibrary_tests/test_utils/test_aux.py
|
|
56
|
-
detectmatelibrary_tests/test_utils/test_data_buffer.py
|
|
57
|
-
detectmatelibrary_tests/test_utils/test_data_normalizer.py
|
|
58
|
-
detectmatelibrary_tests/test_utils/test_events_seen.py
|
|
59
|
-
detectmatelibrary_tests/test_utils/test_log_format_utils.py
|
|
60
|
-
detectmatelibrary_tests/test_utils/test_persistency.py
|
|
61
|
-
detectmatelibrary_tests/test_utils/test_persistency_dump_load.py
|
|
62
|
-
detectmatelibrary_tests/test_utils/test_persistency_saver.py
|
|
63
|
-
detectmatelibrary_tests/test_utils/test_stability_tracking.py
|
|
64
|
-
detectmatelibrary_tests/test_workspace/__init__.py
|
|
65
|
-
detectmatelibrary_tests/test_workspace/test_create_workspace.py
|
|
66
|
-
detectmatelibrary_tests/test_workspace/test_utils.py
|
|
67
10
|
src/detectmatelibrary/__init__.py
|
|
68
11
|
src/detectmatelibrary/constants.py
|
|
69
12
|
src/detectmatelibrary/metadata.py
|
|
13
|
+
src/detectmatelibrary/alert_aggregation/basic_concat.py
|
|
70
14
|
src/detectmatelibrary/common/__init__.py
|
|
15
|
+
src/detectmatelibrary/common/alert_aggregator.py
|
|
71
16
|
src/detectmatelibrary/common/core.py
|
|
72
17
|
src/detectmatelibrary/common/detector.py
|
|
73
18
|
src/detectmatelibrary/common/parser.py
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from detectmatelibrary.common.alert_aggregator import (
|
|
2
|
+
CoreAlertAggregatorConfig, CoreAlertAggregator
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
from detectmatelibrary.schemas import DetectorSchema, OutputSchema
|
|
6
|
+
|
|
7
|
+
from typing import Any, Optional
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BasicConcatAggregationConfig(CoreAlertAggregatorConfig):
|
|
11
|
+
method_type: str = "basic_concat_aggregator"
|
|
12
|
+
buffer_size: int = 3
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BasicConcatAggregation(CoreAlertAggregator):
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
name: str = "BasicConcatAggregator",
|
|
19
|
+
config: Optional[BasicConcatAggregationConfig | dict[str, Any]] = BasicConcatAggregationConfig(),
|
|
20
|
+
) -> None:
|
|
21
|
+
if isinstance(config, dict):
|
|
22
|
+
config = BasicConcatAggregationConfig.from_dict(config, name)
|
|
23
|
+
|
|
24
|
+
buffer_size: int = config.buffer_size # type: ignore
|
|
25
|
+
super().__init__(name=name, buffer_size=buffer_size, config=config)
|
|
26
|
+
|
|
27
|
+
def aggregate_alerts(self, input_: list[DetectorSchema], output_: OutputSchema) -> bool: # type: ignore
|
|
28
|
+
output_["description"] = "Basic aggregation by alert concatenation"
|
|
29
|
+
return True
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
|
|
2
|
+
from detectmatelibrary.common.core import CoreComponent, CoreConfig
|
|
3
|
+
|
|
4
|
+
from detectmatelibrary.utils.data_buffer import ArgsBuffer, BufferMode
|
|
5
|
+
from detectmatelibrary.utils.aux import get_timestamp
|
|
6
|
+
|
|
7
|
+
from detectmatelibrary.schemas import DetectorSchema, OutputSchema
|
|
8
|
+
|
|
9
|
+
from typing import Any, Optional
|
|
10
|
+
from typing_extensions import override
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _extract_field(
|
|
14
|
+
input_: list[DetectorSchema] | DetectorSchema, field: str
|
|
15
|
+
) -> list[str]:
|
|
16
|
+
if not isinstance(input_, list):
|
|
17
|
+
input_ = [input_]
|
|
18
|
+
|
|
19
|
+
return [str(i[field]) for i in input_]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _extract_list_field(input_: list[DetectorSchema] | DetectorSchema, field: str) -> list[str]:
|
|
23
|
+
if not isinstance(input_, list):
|
|
24
|
+
input_ = [input_]
|
|
25
|
+
|
|
26
|
+
final = []
|
|
27
|
+
for i in input_:
|
|
28
|
+
final.extend(i[field])
|
|
29
|
+
|
|
30
|
+
return final
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class CoreAlertAggregatorConfig(CoreConfig):
|
|
34
|
+
component_type: str = "alert_aggregators"
|
|
35
|
+
method_type: str = "core_alert_aggregator"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CoreAlertAggregator(CoreComponent):
|
|
39
|
+
def __init__(
|
|
40
|
+
self,
|
|
41
|
+
name: str = "CoreAlertAggregator",
|
|
42
|
+
buffer_mode: BufferMode = BufferMode.WINDOW,
|
|
43
|
+
buffer_size: Optional[int] = 1,
|
|
44
|
+
config: Optional[CoreAlertAggregatorConfig | dict[str, Any]] = CoreAlertAggregatorConfig(),
|
|
45
|
+
) -> None:
|
|
46
|
+
if isinstance(config, dict):
|
|
47
|
+
config = CoreAlertAggregatorConfig.from_dict(config, name)
|
|
48
|
+
|
|
49
|
+
super().__init__(
|
|
50
|
+
name=name,
|
|
51
|
+
type_=config.method_type, # type: ignore
|
|
52
|
+
config=config, # type: ignore
|
|
53
|
+
args_buffer=ArgsBuffer(mode=buffer_mode, size=buffer_size),
|
|
54
|
+
input_schema=DetectorSchema,
|
|
55
|
+
output_schema=OutputSchema,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
@override
|
|
59
|
+
def run(
|
|
60
|
+
self, input_: list[DetectorSchema] | DetectorSchema, output_: OutputSchema # type: ignore
|
|
61
|
+
) -> bool:
|
|
62
|
+
|
|
63
|
+
output_["detectorIDs"] = _extract_field(input_, "detectorID")
|
|
64
|
+
output_["detectorTypes"] = _extract_field(input_, "detectorType")
|
|
65
|
+
output_["alertIDs"] = _extract_field(input_, "alertID")
|
|
66
|
+
output_["logIDs"] = _extract_list_field(input_, "logIDs")
|
|
67
|
+
output_["extractedTimestamps"] = _extract_list_field(input_, "extractedTimestamps")
|
|
68
|
+
|
|
69
|
+
if (alert := self.aggregate_alerts(input_=input_, output_=output_)):
|
|
70
|
+
output_["outputTimestamp"] = get_timestamp()
|
|
71
|
+
|
|
72
|
+
return alert
|
|
73
|
+
|
|
74
|
+
def aggregate_alerts(
|
|
75
|
+
self,
|
|
76
|
+
input_: list[DetectorSchema] | DetectorSchema,
|
|
77
|
+
output_: OutputSchema,
|
|
78
|
+
) -> bool:
|
|
79
|
+
return True
|
|
80
|
+
|
|
81
|
+
@override
|
|
82
|
+
def train(
|
|
83
|
+
self, input_: DetectorSchema | list[DetectorSchema] # type: ignore
|
|
84
|
+
) -> None:
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
@override
|
|
88
|
+
def configure(
|
|
89
|
+
self, input_: DetectorSchema | list[DetectorSchema] # type: ignore
|
|
90
|
+
) -> None:
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
@override
|
|
94
|
+
def set_configuration(self) -> None:
|
|
95
|
+
pass
|
|
96
|
+
|
|
97
|
+
@override
|
|
98
|
+
def post_train(self) -> None:
|
|
99
|
+
pass
|
|
@@ -128,6 +128,58 @@ class CoreComponent(Component):
|
|
|
128
128
|
)
|
|
129
129
|
self.buffer_train = TrainBuffer()
|
|
130
130
|
|
|
131
|
+
def export_state(
|
|
132
|
+
self,
|
|
133
|
+
path: str | None = None,
|
|
134
|
+
storage_options: dict[str, Any] | None = None,
|
|
135
|
+
) -> bytes | None:
|
|
136
|
+
"""Save this component's EventPersistency state.
|
|
137
|
+
|
|
138
|
+
When path is None, returns the state as bytes (zip archive).
|
|
139
|
+
When path is given, writes to that fsspec URI and returns None.
|
|
140
|
+
Returns None if no persistency is configured. Thread-safe when a
|
|
141
|
+
PersistencySaver is running: acquires the saver lock before saving
|
|
142
|
+
(guards against the background save timer and concurrent ingest).
|
|
143
|
+
"""
|
|
144
|
+
# ponytail: local import keeps common.core free of a persistency
|
|
145
|
+
# package import at module load (see _Stoppable).
|
|
146
|
+
from detectmatelibrary.utils import persistency
|
|
147
|
+
|
|
148
|
+
ep = getattr(self, "persistency", None)
|
|
149
|
+
if ep is None:
|
|
150
|
+
logger.debug(f"{self.name}: no persistency configured, nothing to export")
|
|
151
|
+
return None
|
|
152
|
+
saver = getattr(self, "saver", None)
|
|
153
|
+
if saver is not None:
|
|
154
|
+
with saver.locked():
|
|
155
|
+
return persistency.save(ep, path, storage_options)
|
|
156
|
+
return persistency.save(ep, path, storage_options)
|
|
157
|
+
|
|
158
|
+
def import_state(
|
|
159
|
+
self,
|
|
160
|
+
path: str | bytes,
|
|
161
|
+
storage_options: dict[str, Any] | None = None,
|
|
162
|
+
) -> None:
|
|
163
|
+
"""Restore this component's EventPersistency state.
|
|
164
|
+
|
|
165
|
+
path may be an fsspec URI string or bytes returned by
|
|
166
|
+
export_state(). No-op if no persistency is configured. Thread-safe
|
|
167
|
+
when a PersistencySaver is running: acquires the saver lock before
|
|
168
|
+
loading (guards against the background save timer).
|
|
169
|
+
"""
|
|
170
|
+
from detectmatelibrary.utils import persistency
|
|
171
|
+
|
|
172
|
+
ep = getattr(self, "persistency", None)
|
|
173
|
+
if ep is None:
|
|
174
|
+
logger.debug(f"{self.name}: no persistency configured, nothing to import")
|
|
175
|
+
return
|
|
176
|
+
saver = getattr(self, "saver", None)
|
|
177
|
+
if saver is not None:
|
|
178
|
+
with saver.locked():
|
|
179
|
+
persistency.load(ep, path, storage_options)
|
|
180
|
+
else:
|
|
181
|
+
persistency.load(ep, path, storage_options)
|
|
182
|
+
|
|
131
183
|
def update_state(self, state: StatesL) -> None:
|
|
132
184
|
self.fitlogic.update_state(state)
|
|
133
185
|
|
|
@@ -7,6 +7,6 @@ __deprecated__ = False
|
|
|
7
7
|
__website__ = "https://aecid.ait.ac.at"
|
|
8
8
|
__license__ = "EUPL-1.2"
|
|
9
9
|
__status__ = "Development"
|
|
10
|
-
__version__ = "0.3.
|
|
10
|
+
__version__ = "0.3.2"
|
|
11
11
|
__all__ = ['__authors__', '__contact__', '__copyright__', '__date__', '__deprecated__', '__website__',
|
|
12
12
|
'__license__', '__status__', '__version__']
|
|
@@ -49,12 +49,13 @@ def count_prompt_tokens(prompt: str, model_name: str) -> int:
|
|
|
49
49
|
Count the number of tokens in the prompt
|
|
50
50
|
Models supported: gpt-4o-mini, gpt-3.5-turbo
|
|
51
51
|
"""
|
|
52
|
-
|
|
53
|
-
encoder = tiktoken.encoding_for_model(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
try:
|
|
53
|
+
encoder = tiktoken.encoding_for_model(model_name)
|
|
54
|
+
except KeyError:
|
|
55
|
+
# ponytail: token count is estimate-only bookkeeping; use the modern
|
|
56
|
+
# OpenAI encoding for models tiktoken doesn't know rather than raising
|
|
57
|
+
# (raising here silently discards a successful LLM answer upstream).
|
|
58
|
+
encoder = tiktoken.get_encoding("o200k_base")
|
|
58
59
|
|
|
59
60
|
# 计算编码后的token数
|
|
60
61
|
prompt_tokens = encoder.encode(prompt)
|
|
@@ -66,12 +67,13 @@ def count_message_tokens(messages: List[Dict[str, str]], model_name: str = "gpt-
|
|
|
66
67
|
Count the number of tokens in the messages
|
|
67
68
|
Models supported: gpt-4o-mini, gpt-3.5-turbo
|
|
68
69
|
"""
|
|
69
|
-
|
|
70
|
-
encoder = tiktoken.encoding_for_model(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
try:
|
|
71
|
+
encoder = tiktoken.encoding_for_model(model_name)
|
|
72
|
+
except KeyError:
|
|
73
|
+
# ponytail: token count is estimate-only bookkeeping; use the modern
|
|
74
|
+
# OpenAI encoding for models tiktoken doesn't know rather than raising
|
|
75
|
+
# (raising here silently discards a successful LLM answer upstream).
|
|
76
|
+
encoder = tiktoken.get_encoding("o200k_base")
|
|
75
77
|
|
|
76
78
|
token_count = 0
|
|
77
79
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .event_persistency import EventPersistency
|
|
2
|
-
from .persistency_saver import PersistencySaver, PersistencySaverConfig, PersistencyLoadError
|
|
2
|
+
from .persistency_saver import PersistencySaver, PersistencySaverConfig, PersistencyLoadError, save, load
|
|
3
3
|
from .event_data_structures.base import EventDataStructure
|
|
4
4
|
from .event_data_structures.dataframes.event_dataframe import EventDataFrame
|
|
5
5
|
from .event_data_structures.dataframes.chunked_event_dataframe import ChunkedEventDataFrame
|
|
@@ -14,4 +14,6 @@ __all__ = [
|
|
|
14
14
|
"EventDataFrame",
|
|
15
15
|
"ChunkedEventDataFrame",
|
|
16
16
|
"EventStabilityTracker",
|
|
17
|
+
"save",
|
|
18
|
+
"load",
|
|
17
19
|
]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import threading
|
|
1
2
|
from typing import Any, Callable, Dict, List, Optional, Type
|
|
2
3
|
|
|
3
4
|
from .event_data_structures.base import EventDataStructure
|
|
@@ -33,6 +34,10 @@ class EventPersistency:
|
|
|
33
34
|
self.event_templates: Dict[int | str, str] = {}
|
|
34
35
|
self._events_since_save: int = 0
|
|
35
36
|
self._on_ingest_callbacks: list[Callable[[], None]] = []
|
|
37
|
+
# ponytail: RLock shared with PersistencySaver so ingest/save/load are
|
|
38
|
+
# mutually exclusive. On-ingest callbacks fire outside this lock, so
|
|
39
|
+
# re-entrancy is no longer required — kept as RLock (harmless, safer).
|
|
40
|
+
self._lock = threading.RLock()
|
|
36
41
|
|
|
37
42
|
def ingest_event(
|
|
38
43
|
self,
|
|
@@ -42,22 +47,29 @@ class EventPersistency:
|
|
|
42
47
|
named_variables: Dict[str, Any] = {}
|
|
43
48
|
) -> None:
|
|
44
49
|
"""Ingest event data into the appropriate EventData store."""
|
|
45
|
-
self.
|
|
50
|
+
with self._lock:
|
|
51
|
+
self._events_since_save += 1
|
|
52
|
+
self.events_seen.add(event_id)
|
|
53
|
+
if variables or named_variables:
|
|
54
|
+
self.event_templates[event_id] = event_template
|
|
55
|
+
all_variables = self.get_all_variables(variables, named_variables)
|
|
56
|
+
|
|
57
|
+
data_structure = self.events_data.get(event_id)
|
|
58
|
+
if data_structure is None:
|
|
59
|
+
data_structure = self.event_data_class(**self.event_data_kwargs)
|
|
60
|
+
self.events_data[event_id] = data_structure
|
|
61
|
+
|
|
62
|
+
data = data_structure.to_data(all_variables)
|
|
63
|
+
data_structure.add_data(data)
|
|
64
|
+
# ponytail: fire callbacks outside the lock so a count-triggered save
|
|
65
|
+
# doesn't hold the ingest lock across serialize + file I/O.
|
|
46
66
|
for _cb in self._on_ingest_callbacks:
|
|
47
67
|
_cb()
|
|
48
|
-
self.events_seen.add(event_id)
|
|
49
|
-
if not variables and not named_variables:
|
|
50
|
-
return
|
|
51
|
-
self.event_templates[event_id] = event_template
|
|
52
|
-
all_variables = self.get_all_variables(variables, named_variables)
|
|
53
68
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
data = data_structure.to_data(all_variables)
|
|
60
|
-
data_structure.add_data(data)
|
|
69
|
+
@property
|
|
70
|
+
def events_since_save(self) -> int:
|
|
71
|
+
"""Number of events ingested since the last successful save."""
|
|
72
|
+
return self._events_since_save
|
|
61
73
|
|
|
62
74
|
def reset_events_since_save(self) -> None:
|
|
63
75
|
"""Reset the events-since-save counter after a successful save."""
|