Documentation
¶
Index ¶
- type MtailServer
- func (m *MtailServer) Close()
- func (m *MtailServer) InitLoader() error
- func (m *MtailServer) OneShot(logfile string, print bool) (count int64, err error)
- func (m *MtailServer) Run()
- func (m *MtailServer) RunOneShot()
- func (m *MtailServer) Serve()
- func (m *MtailServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *MtailServer) StartTailing() error
- func (m *MtailServer) WaitForShutdown()
- func (m *MtailServer) WriteMetrics(w io.Writer) error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MtailServer ¶
type MtailServer struct {
// contains filtered or unexported fields
}
MtailServer contains the state of the main program object.
func New ¶
func New(o Options) (*MtailServer, error)
New creates an MtailServer from the supplied Options.
func (*MtailServer) Close ¶
func (m *MtailServer) Close()
Close handles the graceful shutdown of this mtail instance, ensuring that it only occurs once.
func (*MtailServer) InitLoader ¶
func (m *MtailServer) InitLoader() error
InitLoader constructs a new program loader and performs the inital load of program files in the program directory.
func (*MtailServer) OneShot ¶
func (m *MtailServer) OneShot(logfile string, print bool) (count int64, err error)
OneShot reads the contents of a log file into the lines channel from start to finish, terminating the program at the end.
func (*MtailServer) Run ¶
func (m *MtailServer) Run()
Run starts MtailServer in the configuration supplied in Options at creation.
func (*MtailServer) RunOneShot ¶
func (m *MtailServer) RunOneShot()
RunOneShot performs the work of the one_shot commandline flag; after compiling programs mtail will read all of the log files in full, once, dump the metric results at the end, and then exit.
func (*MtailServer) Serve ¶
func (m *MtailServer) Serve()
Serve begins the long-running mode of mtail, in which it watches the log files for changes and sends any new lines found into the lines channel for pick up by the virtual machines. It will continue to do so until it is signalled to exit.
func (*MtailServer) ServeHTTP ¶
func (m *MtailServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*MtailServer) StartTailing ¶
func (m *MtailServer) StartTailing() error
StartTailing constructs a new Tailer and commences sending log lines into the lines channel.
func (*MtailServer) WaitForShutdown ¶
func (m *MtailServer) WaitForShutdown()
WaitForShutdown handles shutdown requests from the system or the UI.
func (*MtailServer) WriteMetrics ¶
func (m *MtailServer) WriteMetrics(w io.Writer) error
WriteMetrics dumps the current state of the metrics store in JSON format to the io.Writer.
type Options ¶
type Options struct { Progs string LogPathPatterns []string LogFds []int BindAddress string OneShot bool OneShotMetrics bool CompileOnly bool DumpAst bool DumpAstTypes bool DumpBytecode bool SyslogUseCurrentYear bool OverrideLocation *time.Location OmitMetricSource bool OmitProgLabel bool BuildInfo string Store *metrics.Store W watcher.Watcher // Not required, will use watcher.LogWatcher if zero. FS afero.Fs // Not required, will use afero.OsFs if zero. }
Options contains all the parameters necessary for constructing a new MtailServer.