forked from ruflin/filebeat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
43 lines (31 loc) · 1.03 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
filebeat "github.com/elastic/filebeat/beat"
"github.com/elastic/libbeat/beat"
)
var Version = "1.0.0-beta4"
var Name = "filebeat"
var GlobalBeat *beat.Beat
// The basic model of execution:
// - prospector: finds files in paths/globs to harvest, starts harvesters
// - harvester: reads a file, sends events to the spooler
// - spooler: buffers events until ready to flush to the publisher
// - publisher: writes to the network, notifies registrar
// - registrar: records positions of files read
// Finally, prospector uses the registrar information, on restart, to
// determine where in each file to restart a harvester.
func main() {
// Create Beater object
fb := &filebeat.Filebeat{}
// Initi beat objectefile
b := beat.NewBeat(Name, Version, fb)
// Additional command line args are used to overwrite config options
b.CommandLineSetup()
// Loads base config
b.LoadConfig()
// Configures beat
fb.Config(b)
// Run beat. This calls first beater.Setup,
// then beater.Run and beater.Cleanup in the end
b.Run()
}