Skip to content

AlertList and AuditLogList do not return exact total for -C flag (LM API limitation) #51

Description

@rdmarsh

Summary

AlertList and AuditLogList return a negative sentinel value in the total field instead of an exact count. elm's -C/--total flag reads this field directly, so elm AlertList -C previously printed a confusing negative number (e.g. -51).

Behaviour

$ elm AlertList -C
-51

$ elm DeviceList -C
1558

The LM API returns total: -(n_returned + 1) when it cannot compute an exact count. With default size 50, AlertList returns total: -51.

Root cause

This is an LM API behaviour: the total field in /alert/alerts responses is a negative sentinel, not a real count. DeviceList and most other endpoints return real positive totals.

Fix (v1.8.1)

elm now detects negative totals and shows a lower bound with a warning:

$ elm AlertList -C
Warning: total records unknown, there is data you are not seeing.
>50

Workaround for a real count (accurate when total ≤ 1000): elm AlertList -c -s0

Affected endpoints

Confirmed: AlertList, AuditLogList. Tested all 59 *List endpoints — all others return exact totals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream-bugBug in an upstream dependency (LM API, etc.) — should be raised with vendor

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions