Beispiel #1
0
        public LogCommand(SeqConnectionFactory connectionFactory)
        {
            _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

            Options.Add(
                "m=|message=",
                "A message to associate with the event (the default is to send no message); https://messagetemplates.org syntax is supported",
                v => _message = v);

            Options.Add(
                "l=|level=",
                "The level or severity of the event (the default is `Information`)",
                v => _level = v);

            Options.Add(
                "t=|timestamp=",
                "The event timestamp as ISO-8601 (the current UTC timestamp will be used by default)",
                v => _timestamp = v);

            Options.Add(
                "x=|exception=",
                "Additional exception or error information to send, if any",
                v => _exception = v);

            _properties = Enable <PropertiesFeature>();
            _connection = Enable <ConnectionFeature>();
        }
Beispiel #2
0
        public IngestCommand(SeqConnectionFactory connectionFactory)
        {
            _connectionFactory          = connectionFactory;
            _fileInputFeature           = Enable(new FileInputFeature("File(s) to ingest", supportsWildcard: true));
            _invalidDataHandlingFeature = Enable <InvalidDataHandlingFeature>();
            _properties = Enable <PropertiesFeature>();

            Options.Add("x=|extract=",
                        "An extraction pattern to apply to plain-text logs (ignored when `--json` is specified)",
                        v => _pattern = string.IsNullOrWhiteSpace(v) ? DefaultPattern : v.Trim());

            Options.Add("json",
                        "Read the events as JSON (the default assumes plain text)",
                        v => _json = true);

            Options.Add("f=|filter=",
                        "Filter expression to select a subset of events",
                        v => _filter = string.IsNullOrWhiteSpace(v) ? null : v.Trim());

            Options.Add(
                "m=|message=",
                "A message to associate with the ingested events; https://messagetemplates.org syntax is supported",
                v => _message = string.IsNullOrWhiteSpace(v) ? null : v.Trim());

            Options.Add("l=|level=",
                        "The level or severity to associate with the ingested events; this will override any " +
                        "level information present in the events themselves",
                        v => _level = string.IsNullOrWhiteSpace(v) ? null : v.Trim());

            _sendFailureHandlingFeature = Enable <SendFailureHandlingFeature>();
            _connection = Enable <ConnectionFeature>();
            _batchSize  = Enable <BatchSizeFeature>();
        }
Beispiel #3
0
        public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config)
        {
            _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

            Options.Add(
                "t=|title=",
                "A title for the API key",
                t => _title = ArgumentString.Normalize(t));

            Options.Add(
                "token=",
                "A pre-allocated API key token; by default, a new token will be generated and written to `STDOUT`",
                t => _token = ArgumentString.Normalize(t));

            _properties = Enable <PropertiesFeature>();

            Options.Add(
                "filter=",
                "A filter to apply to incoming events",
                f => _filter = ArgumentString.Normalize(f));

            Options.Add(
                "minimum-level=",
                "The minimum event level/severity to accept; the default is to accept all events",
                v => _level = ArgumentString.Normalize(v));

            Options.Add(
                "use-server-timestamps",
                "Discard client-supplied timestamps and use server clock values",
                _ => _useServerTimestamps = true);

            _connection = Enable <ConnectionFeature>();
            _output     = Enable(new OutputFormatFeature(config.Output));
        }
Beispiel #4
0
        public ImportCommand(SeqConnectionFactory connectionFactory)
        {
            _connectionFactory = connectionFactory;

            Options.Add(
                "i=|input=",
                "The directory from which to read the set of `.template` files; the default is `.`",
                i => _inputDir = ArgumentString.Normalize(i));

            Options.Add(
                "state=",
                "The path of a file which will persist a mapping of template names to the ids of the created " +
                "entities on the target server, avoiding duplicates when multiple imports are performed; by default, " +
                "`import.state` in the input directory will be used",
                s => _stateFile = ArgumentString.Normalize(s));

            Options.Add(
                "merge",
                "For templates with no entries in the `.state` file, first check for existing entities with matching names or titles; " +
                "does not support merging of retention policies",
                _ => _merge = true);

            _args       = Enable(new PropertiesFeature("g", "arg", "Template arguments, e.g. `-g ownerId=user-314159`"));
            _connection = Enable <ConnectionFeature>();
        }
Beispiel #5
0
        public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config)
        {
            _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));

            Options.Add(
                "t=|title=",
                "A title for the API key",
                t => _title = ArgumentString.Normalize(t));

            Options.Add(
                "token=",
                "A pre-allocated API key token; by default, a new token will be generated and written to `STDOUT`",
                t => _token = ArgumentString.Normalize(t));

            _properties = Enable <PropertiesFeature>();

            Options.Add(
                "filter=",
                "A filter to apply to incoming events",
                f => _filter = ArgumentString.Normalize(f));

            Options.Add(
                "minimum-level=",
                "The minimum event level/severity to accept; the default is to accept all events",
                v => _level = ArgumentString.Normalize(v));

            Options.Add(
                "use-server-timestamps",
                "Discard client-supplied timestamps and use server clock values",
                _ => _useServerTimestamps = true);

            Options.Add(
                "permissions=",
                "A comma-separated list of permissions to delegate to the API key; valid permissions are `Ingest` (default), `Read`, `Write`, `Project` and `System`",
                v => _permissions = ArgumentString.NormalizeList(v));

            Options.Add(
                "connect-username="******"A username to connect with, useful primarily when setting up the first API key",
                v => _connectUsername = ArgumentString.Normalize(v));

            Options.Add(
                "connect-password="******"When `connect-username` is specified, a corresponding password",
                v => _connectPassword = ArgumentString.Normalize(v));

            Options.Add(
                "connect-password-stdin",
                "When `connect-username` is specified, read the corresponding password from `STDIN`",
                _ => _connectPasswordStdin = true);

            _connection = Enable <ConnectionFeature>();
            _output     = Enable(new OutputFormatFeature(config.Output));
        }
Beispiel #6
0
        public IngestCommand(SeqConnectionFactory connectionFactory)
        {
            _connectionFactory          = connectionFactory;
            _fileInputFeature           = Enable <FileInputFeature>();
            _invalidDataHandlingFeature = Enable <InvalidDataHandlingFeature>();
            _properties = Enable <PropertiesFeature>();

            Options.Add("f=|filter=",
                        "Filter expression to select a subset of events",
                        v => _filter = string.IsNullOrWhiteSpace(v) ? null : v.Trim());

            _connection = Enable <ConnectionFeature>();
        }
Beispiel #7
0
        public IngestCommand(SeqConnectionFactory connectionFactory)
        {
            _connectionFactory          = connectionFactory;
            _fileInputFeature           = Enable <FileInputFeature>();
            _invalidDataHandlingFeature = Enable <InvalidDataHandlingFeature>();
            _properties = Enable <PropertiesFeature>();

            Options.Add("x=|extract=",
                        "An extraction pattern to apply to plain-text logs (ignored when `--json` is specified)",
                        v => _pattern = string.IsNullOrWhiteSpace(v) ? DefaultPattern : v.Trim());

            Options.Add("json",
                        "Read the events as JSON (the default assumes plain text)",
                        v => _json = true);

            Options.Add("f=|filter=",
                        "Filter expression to select a subset of events",
                        v => _filter = string.IsNullOrWhiteSpace(v) ? null : v.Trim());

            _sendFailureHandlingFeature = Enable <SendFailureHandlingFeature>();
            _connection = Enable <ConnectionFeature>();
        }