flags

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDatabasePath = "/etc/pihole/pihole-FTL.db"
View Source
const DefaultDuration = 24 * time.Hour
View Source
const TimestampLayout = "2006-01-02T15:04:05Z"

Variables

View Source
var Destination = &cli.StringFlag{
	Name:     "dest",
	Aliases:  []string{"d"},
	EnvVars:  []string{"PYLON_EXPORT_DEST"},
	Usage:    "Export query logs to `DEST`",
	Required: true,
	Action: func(ctx *cli.Context, value string) error {
		if _, ok := validDestinations[value]; !ok {
			return errors.New("unknown destination: " + value)
		}
		return nil
	},
}
View Source
var EndTime = &cli.TimestampFlag{
	Name:        "end",
	Layout:      TimestampLayout,
	DefaultText: "now",
	Usage:       "Stop reading logs at `TIME`",
}
View Source
var Format = &cli.StringFlag{
	Name:  "format",
	Value: "json",
	Usage: "Write data to standard output in `FORMAT`",
	Action: func(context *cli.Context, s string) error {
		if _, ok := formats[s]; !ok {
			return errors.New("unknown format: " + s)
		}
		return nil
	},
}
View Source
var InfluxDb2Bucket = &cli.StringFlag{
	Name:     "influxdb2-bucket",
	EnvVars:  []string{"INFLUXDB2_BUCKET"},
	FilePath: "/etc/pylon/influxdb2/bucket",
	Usage:    "InfluxDB v2 bucket name",
	Category: "InfluxDB v2",
}
View Source
var InfluxDb2DestinationName = "influxdb2"
View Source
var InfluxDb2Org = &cli.StringFlag{
	Name:     "influxdb2-org",
	EnvVars:  []string{"INFLUXDB2_ORG"},
	FilePath: "/etc/pylon/influxdb2/org",
	Usage:    "InfluxDB v2 organization name",
	Category: "InfluxDB v2",
}
View Source
var InfluxDb2Token = &cli.StringFlag{
	Name:     "influxdb2-token",
	EnvVars:  []string{"INFLUXDB2_TOKEN"},
	FilePath: "/etc/pylon/influxdb2/token",
	Usage:    "InfluxDB v2 authentication token",
	Category: "InfluxDB v2",
}
View Source
var InfluxDb2Url = &cli.StringFlag{
	Name:     "influxdb2-url",
	EnvVars:  []string{"INFLUXDB2_URL"},
	FilePath: "/etc/pylon/influxdb2/url",
	Usage:    "InfluxDB v2 API endpoint URL",
	Category: "InfluxDB v2",
}
View Source
var Quiet = &cli.BoolFlag{
	Name:    "quiet",
	Aliases: []string{"q"},
	Value:   false,
	Usage:   "Stop all logging except errors; overrides --verbose",
}
View Source
var StartTime = &cli.TimestampFlag{
	Name:        "start",
	Layout:      TimestampLayout,
	DefaultText: "end - 24h",
	Usage:       "Start reading logs from `TIME`",
}
View Source
var Verbose = &cli.BoolFlag{
	Name:    "verbose",
	Aliases: []string{"v"},
	Value:   false,
	Usage:   "Verbose output; can use multiple times like -vv to increase verbosity",
}
View Source
var WriteState = &cli.StringFlag{
	Name:    "write-state",
	Aliases: []string{"w"},
	Usage:   "When set, writes the start time of the next export cycle to `FILE`",
}

Functions

func ConfigureGlobalLogger

func ConfigureGlobalLogger(ctx *cli.Context)

func GetDatabasePath

func GetDatabasePath(ctx *cli.Context) string

func GetDestination

func GetDestination(ctx *cli.Context) string

func GetFormat

func GetFormat(ctx *cli.Context) func(p pipe.Pipeline, input <-chan ftl.QueryRecord) <-chan string

func GetInterval

func GetInterval(ctx *cli.Context) (time.Time, time.Time)

func GetLogLevel

func GetLogLevel(ctx *cli.Context) zerolog.Level

func GetWriteStateLocation

func GetWriteStateLocation(argv *cli.Context) string

Types

type InfluxDb2Config

type InfluxDb2Config struct {
	Url        string
	Token      string
	OrgName    string
	BucketName string
	BatchSize  uint
}

func GetInfluxDb2Config

func GetInfluxDb2Config(ctx *cli.Context) (*InfluxDb2Config, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL