Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This page describes using the Lenses CLI.
Lenses offers a powerful CLI (command-line tool) built-in Go that utilizes the REST and WebSocket APIs of Lenses to communicate with Apache Kafka. It provides a straightforward way to perform common data engineering and site reliability engineering tasks.
To use the CLI you must first configure the workspace:
And fill in the details:
The configuration will be stored in ~/.lenses/config.yml
The —output flag, controls the format of the output.
The value of output can be Table, YAML or JSON. By default, the results of a command are printed as a table.
Additionally, when using the –output flag with JSON, two more optional flags are available: –pretty and –query. These flags can be passed to all commands that fetch and return JSON-formatted results.
—pretty - Enable the pretty format for JSON output of commands (default false).
—query - A jmespath query expression. This allows for querying the JSON output of commands. For more details view the JMESPATH documentation.
To use the CLI with a service account for CI/CD you need to pass these options:
This page describes commands to update various metadata associated with datasets in Lenses via the CLI.
To set a dataset description, use:
It is also possible to remove the dataset description by supplying the --remove-description
flag.
To set one or multiple dataset tags, use:
Notice that the --tags
parameter is required and should contain a non-empty, space separated list of tags (a tag max length is 255 characters). To delete all the tags associated to a dataset, you can use the remove-tags
subcommand:
This page describes the commands to manage Kafka topics via the Lenses CLI.
The optional names flag wil display only the names of the topics. If you use the –unwrap flag, each topic name will be displayed on a new line as text:
Update from a file:
Example file:
Update from a file:
Example file:
Update from a file:
Example file:
This page describes the commands to manage Lenses Alerts via the CLI.
Copy
Copy
Command line flags are ignored when loading from files.
The value of the `--alert` flag is the Alert ID that the alert setting belongs to whereas the value of the `--condition` flag is the UUID of the condition to delete.
This page describes managing alert channels in Lenses via the CLI.
This page describes how to query data in Lenses via the CLI.
The CLI allows you to browse and subscribe to topic data with SQL. Please refer to the Lenses SQL documentation for more details.
Use these flags to control the data that’s returned:
keys print message keys
keys-only print the keys only, not the value of the message
meta print the message metadata, partition number and offsets
stats print query statistics as the last message
Browse data via the query command, optionally validate and output stats:
Live continuous queries update according to the query and never stop until terminated:
The interactive shell allows you to have an interactive experience and issue Lenses SQL queries from the command line.
To start the interactive shell, issue the following command:
The available options are the following:
keys print message keys
keys-only print the keys only, not the value of the message
meta print the message metadata, partition number and offsets
stats print query statistics as the last message
pretty pretty print the JSON output
live-stream run as a continuous query
!options prints the current options
Options are set using the ! prefix
Queries are executed by ;
Multiline queries are possible but not available in the history inside the shell. After a restart, the multiline queries are concatenated into one line and can be selected.
Query history is stored in .lenses/history in the home directory of the user.
This page describes the commands to manage audit channels in Lenses via the CLI.
When creating audit channels, one of the existing predefined channel templates needs to be used.
Such a command lists all available audit channel templates:
To get all the details, use JSON format:
Create a new audit channel using a YAML file:
Save the file as audit_chann.yml and execute it like this:Copy
This page describes command to manage data policies in Lenses via the CLI.
This page describes the commands to manage connections in Lenses via the CLI.
Consider using the provision for managing dynamic connections.
This page describes the commands to manage Service Accounts in Lenses via the CLI.
This page describes the commands to manage schemas in Lenses via the CLI.
View the current schemas registered:
The --unwrap flag is optional, prints only the names separated by new line
Schemas can be filtered by name:
Schemas versions can be viewed filtered by name:
Schema compatibility levels can be viewed and filtered by name:
Delete all versions of a schema by name:
Delete a specific version of a schema:
Change the compatibility level of a schema:
Register a new schema for a name/subject by the command line or file:
Register by file:
schema.yaml:
This page describes the commands to manage Groups in Lenses via the CLI.
This page describes the commands for mamaging Kafka quotas in Lenses via the CLI.
From a file.
File example:
From a file.
Example file.
If empty then all properties will be passed on automatically and the client quota will be removed entirely.
This page describes the commands to manage SQL Processors in Lenses via the CLI.
The CLI can create, modify, pause, restart and remove Lenses SQL Processors.
View all processors registered. Optionally filter by name, cluster and namespace.
For IN_PROC you only need the name, for KUBERNETES all three. Creating an IN_PROC processor will start it automatically. This is not the case for Kubernetes deployments, a start command (see below) is required once created.
--id
(the processor id, optional)
--name
(optional)
--cluster-name
(should be passed if KUBERNETES
)
--namespace
(should be passed if KUBERNETES
)
--runners
(number of times to deploy while in KUBERNETES
)
From a file:
For IN_PROC
you only need the name, for KUBERNETES
all three:
For IN_PROC
you only need the name, for KUBERNETES
all three:
Update a processor from the command line flags or files. Only for KUBERNETES
:
From a file.
Delete a processor by name, cluster and namespace. For IN_PROC
you only need the name, and for KUBERNETES
all 3 (name, cluster, namespace).
Available only for KUBERNETES
.
This page describes the commands for managing Kafka consumers in Lenses via the CLI.
Commands for updating consumer groups offsets.
Flags --group
and --topic
are mandatory and specify the consumer group ID and topic name respectively.
To affect all topics use the —all-topics flag.
Flag | Description |
---|
update-single-partition accepts only one --topic flag while update-multiple-partitions may accept multiple.
| Set the Consumer Group ID |
| Set the topic name |
| Select implicitly all the topics |
| The topic to reset offsets for |
| Set the partition ID |
| Reset partition offset to earliest offset |
| Reset partition offset to latest offset |
| Reset the partition offset to the provided value |
This page describes the commands to manage Connectors in Lenses via the CLI.
The CLI can create, modify, pause, restart and remove Apache Kafka Connect connectors.
Kafka Connect cluster permissions will be applied to the operation.
List the currently deployed connectors, optionally filter by name, cluster and namespace:
The --names
flag displays only the names of the connectors. When used with --unwrap
, it will print each connector name on a separate line in the output.
From a file:
Example file: