Run(b *beat.Beat) error { ticker := time.NewTicker(bt.period) for { select { case <-bt.done: return nil case <-ticker.C: } list := listWindows(win.HWND(0)) for _, w := range list { if bt.onlyNotEmpty && w.name == "" { continue } if bt.onlyVisible && !w.visible { continue } event := common.MapStr{ "@timestamp": common.Time(time.Now()), "type": b.Name, "windowname": w.name, "windowcategory": w.nameCategory, "windowclass": w.class, } b.Events.PublishEvent(event) } } } beater/winappbeat.go