File tree 2 files changed +11
-6
lines changed
services/log-parser/src/providers/coralogix
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ static_resources:
24
24
route :
25
25
cluster : api_service
26
26
prefix_rewrite : " /"
27
- timeout : 90s
27
+ timeout : 180s
28
28
- match :
29
29
prefix : " /slackbot/"
30
30
route :
Original file line number Diff line number Diff line change @@ -90,18 +90,21 @@ def process_template_group(group):
90
90
return df
91
91
92
92
df_enriched_clusters = df .groupby ("EventTemplate" ).apply (process_template_group )
93
- df_enriched_clusters = df_enriched_clusters .reset_index ().drop (
94
- columns = ["level_1" , "Content" ]
95
- )
93
+ df_enriched_clusters = df_enriched_clusters .reset_index ()
96
94
df_enriched_clusters ["percentage" ] = (
97
95
df_enriched_clusters ["occurrences" ] / len (df ) * 100
98
96
)
99
97
df_enriched_clusters = df_enriched_clusters .sort_values (
100
98
"occurrences" , ascending = False
101
99
)
100
+ try :
101
+ df_enriched_clusters = df_enriched_clusters .drop (columns = ["level_1" , "Content" ])
102
+ except Exception as e :
103
+ print ("Error: " , e )
102
104
103
- # Remove log groups with only one occurrence
104
- df_enriched_clusters = df_enriched_clusters [df_enriched_clusters ["occurrences" ] > 1 ]
105
+ # Get top 10 clusters by occurrences
106
+ # TODO: we can use the elbow method here to find the optimal number of clusters
107
+ df_enriched_clusters = df_enriched_clusters .head (10 )
105
108
106
109
records = df_enriched_clusters .to_dict (orient = "records" )
107
110
for record in records :
@@ -132,6 +135,8 @@ def parse_raw_logs(logs: str):
132
135
# Maybe we should use that in the future.
133
136
if warning and not pd .isna (warning ):
134
137
continue
138
+ if type (batch ) != dict :
139
+ continue
135
140
136
141
for result in batch ["results" ]:
137
142
logs .append (result )
You can’t perform that action at this time.
0 commit comments