Skip to content

[BUG] [v0.0.7] cortex logs --level accepts arbitrary strings and matches log content instead of validating log levels #53518

@andrirevo

Description

@andrirevo

Project

cortex

Description

The cortex logs --level option is expected to filter logs by predefined severity levels (e.g., error, warn, info). However, the command accepts arbitrary string values and appears to match them against the raw log line text instead of validating them as structured log levels.

For example, passing a non-standard value like rr still returns results because it matches substrings within log messages (e.g., [ERROR]), rather than being rejected as an invalid level.

This behavior is inconsistent with typical CLI expectations where enumerated flags should only accept defined values.

Error Message

N/A

Debug Logs

N/A

System Information

OS: Windows 11
Cortex CLI version: v0.0.7

Screenshots

https://github.com/springoliver/bounty_challenge_report_image/blob/main/49117.mp4

Steps to Reproduce

  1. Open terminal with cortex installed
  2. Run:
    cortex logs --level error
    → Observe normal filtered output
  3. Run:
    cortex logs --level rr
  4. Compare results

Expected Behavior

  • --level should accept only valid log levels (e.g., error, warn, info)
  • Invalid values should return an error or validation message

Actual Behavior

  • Arbitrary strings are accepted
  • Filtering is applied using substring matching on log lines
  • Invalid values produce misleading results

Additional Context

The current behavior suggests that the filter is applied as a raw string match rather than a structured level comparison, which can lead to unintended matches and incorrect debugging conclusions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingideIssues related to IDEvalidValid issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions