Insights CLI reference
The insights command lets you execute BadgerQL queries against your
Honeybadger Insights data.
Query Insights data
Section titled “Query Insights data”hb insights query --project-id 12345 --query "fields @ts, @preview | sort @ts"With timezone
Section titled “With timezone”hb insights query --project-id 12345 \ --query "fields @ts, @preview | sort @ts" \ --timezone "America/New_York"With timestamp filter
Section titled “With timestamp filter”hb insights query --project-id 12345 \ --query "fields @ts, @preview | sort @ts" \ --ts "2024-01-15T00:00:00Z"Output as JSON
Section titled “Output as JSON”hb insights query --project-id 12345 \ --query "fields @ts, @preview" \ --output jsonRequired flags:
--project-id— Project ID-q, --query— BadgerQL query to execute
Optional flags:
--ts— Timestamp in RFC3339 format--timezone— Timezone for results (e.g.,America/New_York)-o, --output— Output format:tableorjson(default:table)
Example queries
Section titled “Example queries”Recent errors
Section titled “Recent errors”hb insights query --project-id 12345 \ --query "filter @type = 'error' | fields @ts, error.class, error.message | sort @ts desc | limit 10"Count by error class
Section titled “Count by error class”hb insights query --project-id 12345 \ --query "filter @type = 'error' | stats count() by error.class"Host metrics
Section titled “Host metrics”hb insights query --project-id 12345 \ --query "filter @type = 'metric' | fields @ts, cpu.usage, memory.used | sort @ts desc"See the Insights documentation and BadgerQL reference for more query examples.