github.com/nsqio/nsq@v1.3.0/apps/nsq_to_file/options.go (about)

     1  package main
     2  
     3  import "time"
     4  
     5  type Options struct {
     6  	Topics               []string      `flag:"topic"`
     7  	TopicPattern         string        `flag:"topic-pattern"`
     8  	TopicRefreshInterval time.Duration `flag:"topic-refresh"`
     9  	Channel              string        `flag:"channel"`
    10  
    11  	NSQDTCPAddrs             []string      `flag:"nsqd-tcp-address"`
    12  	NSQLookupdHTTPAddrs      []string      `flag:"lookupd-http-address"`
    13  	ConsumerOpts             []string      `flag:"consumer-opt"`
    14  	MaxInFlight              int           `flag:"max-in-flight"`
    15  	HTTPClientConnectTimeout time.Duration `flag:"http-client-connect-timeout"`
    16  	HTTPClientRequestTimeout time.Duration `flag:"http-client-request-timeout"`
    17  
    18  	LogPrefix      string        `flag:"log-prefix"`
    19  	LogLevel       string        `flag:"log-level"`
    20  	OutputDir      string        `flag:"output-dir"`
    21  	WorkDir        string        `flag:"work-dir"`
    22  	DatetimeFormat string        `flag:"datetime-format"`
    23  	FilenameFormat string        `flag:"filename-format"`
    24  	HostIdentifier string        `flag:"host-identifier"`
    25  	GZIPLevel      int           `flag:"gzip-level"`
    26  	GZIP           bool          `flag:"gzip"`
    27  	SkipEmptyFiles bool          `flag:"skip-empty-files"`
    28  	RotateSize     int64         `flag:"rotate-size"`
    29  	RotateInterval time.Duration `flag:"rotate-interval"`
    30  	SyncInterval   time.Duration `flag:"sync-interval"`
    31  }
    32  
    33  func NewOptions() *Options {
    34  	return &Options{
    35  		LogPrefix:                "[nsq_to_file] ",
    36  		LogLevel:                 "info",
    37  		Channel:                  "nsq_to_file",
    38  		MaxInFlight:              200,
    39  		OutputDir:                "/tmp",
    40  		DatetimeFormat:           "%Y-%m-%d_%H",
    41  		FilenameFormat:           "<TOPIC>.<HOST><REV>.<DATETIME>.log",
    42  		GZIPLevel:                6,
    43  		TopicRefreshInterval:     time.Minute,
    44  		SyncInterval:             30 * time.Second,
    45  		HTTPClientConnectTimeout: 2 * time.Second,
    46  		HTTPClientRequestTimeout: 5 * time.Second,
    47  	}
    48  }