Mezmo CLI
Caution
This application is still considered "beta". Its interfaces and/or its stability is subject to change in breaking ways
A powerful command-line interface for interacting with the Mezmo observability platform.
Manage logs, views, configurations, and leverage AI-powered assistance directly from your terminal.
Features
- Log Management: Search, tail, and analyze logs in real-time
- View Management: Create, edit, delete, and manage log views
- AI-Powered Assistant: Ask questions and get intelligent assistance
- Resource Management: Manage various Mezmo platform resources via YAML/JSON definitions
- Account Management: View and manage account information, including enterprise child accounts
- Configuration Management: Customize CLI behavior and settings
- Shell Completions: Auto-completion support for enhanced productivity
Available Commands
| Command |
Description |
mzm ask |
Interact with the Mezmo AI assistant |
mzm completions |
Generate shell completion scripts |
mzm config |
Manage CLI configuration |
mzm create |
Create resources from definitions |
mzm delete |
Delete resources |
mzm edit |
Edit existing resources |
mzm get |
Retrieve and display resources |
mzm log |
Interact with log data |
mzm set |
Set the active value of a resource, such as the active account |
mzm upgrade |
Upgrade the CLI to the latest version |
mzm version |
Display version information |
Subcommands
Log Commands
mzm log search - Search through historical logs with pagination
mzm log tail - Stream logs in real-time
Get Commands
mzm get account [id] - Display account information. The active account is marked in the ACTIVE column
- For enterprise access keys, the active account is the selected account
- For all other access keys, the active account is the account the access key belongs to
mzm get category [id | name] - List or get specific categories
mzm get conversation [id] - List AI conversations or get a specific one
mzm get view [id | name] - List or get specific views
Set Commands
mzm set account [id | name] - Select the active account of an enterprise by id or company name. Names do not need to be exact, and you choose when more than one account matches. Without an argument, choose from all of the accounts of the enterprise. Enterprise access keys only
Config Commands
mzm config get <key> - Display configuration values
mzm config set <key> <value> - Set configuration values
Create Commands
mzm create -f <file> - Create resources from a file
mzm create category - Create a category from a template
mzm create view - Create a view from a template
Edit Commands
mzm edit category [id | name] - Edit a category resource
mzm edit view [id | name] - Edit a view resource
Delete Commands
mzm delete -f <file> - Delete resources from a file
mzm delete category <id...> - Delete one or more categories
mzm delete conversation <id...> - Delete one or more conversations
mzm delete view <id...> - Delete one or more views
Prerequisites
- Mezmo Account: Active account with API access
Environment Variables
The Mezmo CLI uses the following environment variables:
| Variable |
Required |
Description |
Default |
MZM_ACCESS_KEY |
Yes |
Authentication key for accessing the Mezmo platform API. This is required for all API operations. |
None |
MZM_ACCOUNT_ID |
No |
Account to run commands as. Enterprise access keys only. Overrides the account selected with mzm set account, and is overridden by --account |
None |
EDITOR |
No |
Specifies the text editor to use when editing resources with mzm edit command |
vi (Unix/Linux/macOS) or notepad.exe (Windows) |
Note: The CLI also respects standard system environment variables like HOME for determining configuration file locations.
System Access Requirements
The Mezmo CLI requires the following system permissions and access:
File System Access
| Operation |
Location |
Purpose |
| Read/Write |
~/.config/mezmo/mzm.cfg |
Store CLI configuration and local data |
| Read/Write/Delete |
System temp directory |
Temporary files for editing operations |
| Read |
User-specified paths |
Reading resource definition files |
| Create Directory |
~/.config/mezmo/ |
Initial configuration setup |
Network Access
The CLI requires HTTPS access to the following Mezmo API endpoints:
- API Host:
https://api.mezmo.com (configurable)
- View management operations (GET, POST, PUT, DELETE)
- Account information retrieval
- AI assistant interactions
- Stream Host:
https://tail.mezmo.com (configurable)
- Real-time log streaming via WebSocket
- Log search and retrieval
Process Permissions
- Subprocess Spawning: Required for launching external text editors (
$EDITOR)
- Standard I/O: Access to stdin, stdout, and stderr for command interaction
Security Considerations
- All API communications require authentication via
MZM_ACCESS_KEY
- The CLI uses Token Bearer authentication for API requests
- Network timeouts: 3 seconds for standard API calls, 10 minutes for AI operations
- No elevated system privileges (sudo/admin) required for normal operation
Installation
Option 1: Download Pre-compiled Binary (Recommended)
Download the appropriate binary for your platform from the releases page:
# macOS (Apple Silicon)
curl -LO https://github.com/mezmo/cli/releases/latest/download/mzm-darwin-aarch64
chmod +x mzm-darwin-aarch64
sudo mv mzm-darwin-aarch64 /usr/local/bin/mzm
# macOS (Intel)
curl -LO https://github.com/mezmo/cli/releases/latest/download/mzm-darwin-x86_64
chmod +x mzm-darwin-x86_64
sudo mv mzm-darwin-x86_64 /usr/local/bin/mzm
# Linux (x86_64)
curl -LO https://github.com/mezmo/cli/releases/latest/download/mzm-linux-x86_64
chmod +x mzm-linux-x86_64
sudo mv mzm-linux-x86_64 /usr/local/bin/mzm
# Linux (ARM64)
curl -LO https://github.com/mezmo/cli/releases/latest/download/mzm-linux-aarch64
chmod +x mzm-linux-aarch64
sudo mv mzm-linux-aarch64 /usr/local/bin/mzm
# Windows
# Download mzm-windows-x86_64.exe and add to PATH
Option 2: Build from Source
# Clone the repository
git clone https://github.com/mezmo/cli.git
cd cli
# Install Deno if not already installed
curl -fsSL https://deno.land/install.sh | sh
# Compile the CLI for your platform
deno task compile:local
# Move binary to PATH
sudo mv mzm /usr/local/bin/
Option 3: Run with Deno (Development)
# Clone the repository
git clone https://github.com/mezmo/cli.git
cd cli
# Run directly with Deno
deno task local <command> [options]
Configuration
Initial Setup
Set up Authentication:
The Mezmo CLI requires a Mezmo platform access key to authenticate API requests. You must set the MZM_ACCESS_KEY environment variable with your access key.
# Set the access key for your current session
export MZM_ACCESS_KEY="your-access-key-here"
Getting an Access Key:
- It is recommended to use a Personal Access Key for better security and control
- Visit the Mezmo documentation on IAM Service Keys for detailed instructions on creating and managing access keys
- Personal Access Keys can be created and managed through your Mezmo User Preferences
Enterprise Access Keys
Enterprise service access keys (prefixed with ste_) are not bound to a single account.
They provide access to every account under an enterprise. When one is used, commands are run on behalf
of the active account, sent to the API with the x-delegate-account-id header.
export MZM_ACCESS_KEY="ste_your-enterprise-key"
# list the child accounts of the enterprise
mzm get account
# select the active account by id
mzm set account b35eda6673
# or by company name. Names do not need to be exact, and when more than one
# account matches you will be prompted to choose
mzm set account "Acme Inc."
mzm set account "acme icn"
# or choose from all of the accounts of the enterprise
mzm set account
# all other commands now run as the active account
mzm get view
# run a single command as a different account
mzm get view --account 1234567890
mzm get view --account $(mzm get account "Acme Inc." -q)
MZM_ACCOUNT_ID=1234567890 mzm log search "level:error"
The active account is resolved in this order. The first one set is used:
--account <id>: the current command only
MZM_ACCOUNT_ID: every command run with it set
mzm set account: saved, used when neither of the above is set
--account and MZM_ACCOUNT_ID never change the account saved with mzm set account.
If there is no active account, commands fail and suggest how to choose one.
In scripts and CI, set MZM_ACCOUNT_ID or pass --account.
Switching accounts is reserved for enterprise access keys. With any other access key, the active account is the account
the key belongs to. mzm set account, --account, and MZM_ACCOUNT_ID are rejected.
Shell Completions
Enable auto-completion for your shell:
# Bash
source <(mzm completions bash)
# Zsh
source <(mzm completions zsh)
# Fish
source (mzm completions fish | psub)
Usage
Getting Help
All commands and sub commands support the -h / --help flag for outputing
detailed instruction and examples for that specific command
# display help text for the main command
mzm
# display help for the log command
mzm log --help
# display help text for the log search command
mzm log search --help
Working with Logs
Search Logs
# Basic search
mzm log search "error"
# Search with time range
mzm log search "database connection" --from "1h ago" --to "now"
# Search with filters
mzm log search "error" --app myapp --level error
# Export results
mzm log search "critical" --format json > results.json
Stream Logs in Real-time
# Tail all logs
mzm log tail
# Tail with filters
mzm log tail --app production --level warn --leve error
# Tail specific hosts
mzm log tail --host server1 --host server2
# Tail with custom query
mzm log tail "status:500"
Managing Views
Views are sets of predefined search queries and filters that help you better interact
with your data. They are an essential part of leveraging the mezmo platform. As such, we have
tried to make it exceptionally easy to manage and use them.
List Views
# List all views
mzm get view
# Get specific view details
mzm get view <view-id>
# Output as JSON
mzm get view --output json
Create Views