# Queries

Queries are the primary way of interacting with your data in Baselime.

# Queries in the Console

You can run queries in the Baselime console by navigating to your service and clicking on the New Query button. This will bring up the Visual Query Editor. You can edit the query visually, but also switch to the embedded code editor to write your query using the Observability Reference Language (ORL).

To execute a query, simply click the Run Query button. The query results will be displayed in visually and in a table below the editor.


# Queries in the CLI

You can also run queries using the Baselime CLI. To do so, use the baselime query command.

Use the baselime query without any flags to enter interactive mode where you can specify all the arguments of your query interactively.

terminal
baselime query

You can also run saved queries using the CLI, either in interactive mode or by passing the arguments as flags

terminal
baselime query --service my-service --id my-query

You can also save your query results to a file. Use the --format to print the results of the query in JSON, and pipe them to a file.

terminal
baselime query --format json > results.json

For more advanced usage of the baselime query command, please refer to the CLI reference.