Skip to content

Commit 847b690

Browse files
committed
readd loganalytics
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent 209f64e commit 847b690

File tree

5 files changed

+266
-166
lines changed

5 files changed

+266
-166
lines changed

auditor/auditor.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -183,26 +183,26 @@ func (auditor *AzureAuditor) Run() {
183183
}
184184
}
185185

186-
// if cronspecIsValid(auditor.Opts.Cronjobs.LogAnalytics) && auditor.config.LogAnalytics.IsEnabled() {
187-
// for key, queryConfig := range auditor.config.LogAnalytics.Queries {
188-
// queryName := key
189-
// logAnalyticsConfig := queryConfig
190-
// auditor.addCronjob(
191-
// fmt.Sprintf(ReportLogAnalytics, queryName),
192-
// auditor.Opts.Cronjobs.LogAnalytics,
193-
// func(ctx context.Context, logger *log.Entry) {
194-
// auditor.config.LogAnalytics.Queries[queryName].Reset()
195-
// },
196-
// func(ctx context.Context, logger *log.Entry, report *AzureAuditorReport, callback chan<- func()) {
197-
// contextLogger := log.WithField("configQueryName", queryName)
198-
// auditor.auditLogAnalytics(ctx, contextLogger, queryName, logAnalyticsConfig, report, callback)
199-
// },
200-
// func(ctx context.Context, logger *log.Entry) {
201-
// auditor.prometheus.logAnalytics[queryName].Reset()
202-
// },
203-
// )
204-
// }
205-
// }
186+
if cronspecIsValid(auditor.Opts.Cronjobs.LogAnalytics) && auditor.config.LogAnalytics.IsEnabled() {
187+
for key, queryConfig := range auditor.config.LogAnalytics.Queries {
188+
queryName := key
189+
logAnalyticsConfig := queryConfig
190+
auditor.addCronjob(
191+
fmt.Sprintf(ReportLogAnalytics, queryName),
192+
auditor.Opts.Cronjobs.LogAnalytics,
193+
func(ctx context.Context, logger *log.Entry) {
194+
auditor.config.LogAnalytics.Queries[queryName].Reset()
195+
},
196+
func(ctx context.Context, logger *log.Entry, report *AzureAuditorReport, callback chan<- func()) {
197+
contextLogger := log.WithField("configQueryName", queryName)
198+
auditor.auditLogAnalytics(ctx, contextLogger, queryName, logAnalyticsConfig, report, callback)
199+
},
200+
func(ctx context.Context, logger *log.Entry) {
201+
auditor.prometheus.logAnalytics[queryName].Reset()
202+
},
203+
)
204+
}
205+
}
206206

207207
// check if cron jobs are active
208208
cronjobEntries := auditor.cron.Entries()

0 commit comments

Comments
 (0)