Logs Miner¶
ExceptionLineAfterMaxTime
¶
Bases: Exception
Raised when a log line has a time after the specified maximum time.
Source code in src/gool/logs_miner.py
14 15 16 17 | |
LogsMiner
¶
Source code in src/gool/logs_miner.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
__init__(drain3_cfg_file, similarity_threshold, tree_depth, *, filter_regexp=None, time_pattern_regexp=None, time_format=None, time_min=None, time_max=None, unordered_time=False)
¶
Initialize the LogsMiner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
drain3_cfg_file
|
Path
|
Path to drain3 cfg file. |
required |
similarity_threshold
|
float
|
parameter between 0 and 1 to characterize proximity of lines inside a cluster. |
required |
tree_depth
|
int
|
size max of the drain3 tree. |
required |
filter_regexp
|
Pattern[str] | None
|
Regex pattern to filter log lines. |
None
|
time_pattern_regexp
|
Pattern[str] | None
|
Regex pattern to extract time from log lines. |
None
|
time_format
|
str | None
|
The format of the time extracted from log lines. |
None
|
time_min
|
datetime | None
|
Minimum time for log lines to be processed. |
None
|
time_max
|
datetime | None
|
Maximum time for log lines to be processed. |
None
|
unordered_time
|
bool
|
If True, log lines with time after time_max will not raise an exception and will be processed. |
False
|
Source code in src/gool/logs_miner.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
add_log_lines_to_miner(line_generator)
¶
Add log lines from a generator to the template miner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line_generator
|
Generator
|
A generator yielding log lines. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The number of lines added and cluster sizes counter. |
Source code in src/gool/logs_miner.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
diff_baseline(baseline_miner, miner)
staticmethod
¶
Diff the clusters of the miner with the baseline miner and print the differences.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
baseline_miner
|
TemplateMiner
|
The baseline template miner. |
required |
miner
|
TemplateMiner
|
The template miner to compare with the baseline. |
required |
Returns: tuple[set[str], set[str], set[str]]: A tuple containing three sets: - missing_from_baseline: Clusters present in the baseline but missing in the miner. - added_from_baseline: Clusters present in the miner but missing in the baseline. - common: Clusters present in both the baseline and the miner.
Source code in src/gool/logs_miner.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
get_cluster_data()
¶
Get the clusters templates and their sizes
Returns:
| Type | Description |
|---|---|
list[ClusterResult]
|
list[ClusterResult]: all the clusters template |
Source code in src/gool/logs_miner.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
get_total_nb_lines_clusters()
¶
Get the total number of lines in all clusters.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The total number of lines in all clusters. |
Source code in src/gool/logs_miner.py
127 128 129 130 131 132 133 134 | |
create_drain3_cfg(cfg_file, similarity_threshold, tree_depth)
¶
Create a default configuration for the drain3 template miner.
Returns:
| Name | Type | Description |
|---|---|---|
TemplateMinerConfig |
Any
|
A configuration object for the drain3 template miner. |
Source code in src/gool/logs_miner.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |