Project
cortex
Description
The normal cortex logs view only treats .log and .txt files as logs, but cortex logs --clear deletes every old file in the logs directory with no extension filtering at all. This means sidecar files or unrelated artifacts stored there can be removed even though the command is documented as clearing old log files.
Error Message
Debug Logs
System Information
OS: Windows 10
RAM: 16 GB
CPU: Intel(R) Core(TM) i7-1165G7 @ 2.8GHz(8 CPUs), ~2.8GH
Screenshots
https://github.com/prinws-11/SN_100_MEDIA_Evidence/blob/main/image5.png
Steps to Reproduce
- Place an old non-log file in the Cortex logs directory, such as
notes.json or snapshot.bin.
- Make sure its modified time is older than the selected retention window.
- Run
cortex logs --clear.
- Inspect the logs directory afterward.
Expected Behavior
cortex logs --clear should only delete old log files, consistent with the main command’s .log / .txt filtering and the help text.
Actual Behavior
The clear path deletes any old file in the logs directory, regardless of whether it is actually a log file.
Additional Context
src/cortex-cli/src/logs_cmd.rs:41
- Help text says
Clear old log files.
src/cortex-cli/src/logs_cmd.rs:116-121
- The normal log-file discovery path only includes files whose names end with
.log or .txt.
src/cortex-cli/src/logs_cmd.rs:316-336
run_clear() iterates every file in logs_dir and deletes it if modified < cutoff_time, with no extension filter.
Project
cortex
Description
The normal
cortex logsview only treats.logand.txtfiles as logs, butcortex logs --cleardeletes every old file in the logs directory with no extension filtering at all. This means sidecar files or unrelated artifacts stored there can be removed even though the command is documented as clearing old log files.Error Message
Debug Logs
System Information
OS: Windows 10 RAM: 16 GB CPU: Intel(R) Core(TM) i7-1165G7 @ 2.8GHz(8 CPUs), ~2.8GHScreenshots
https://github.com/prinws-11/SN_100_MEDIA_Evidence/blob/main/image5.png
Steps to Reproduce
notes.jsonorsnapshot.bin.cortex logs --clear.Expected Behavior
cortex logs --clearshould only delete old log files, consistent with the main command’s.log/.txtfiltering and the help text.Actual Behavior
The clear path deletes any old file in the logs directory, regardless of whether it is actually a log file.
Additional Context
src/cortex-cli/src/logs_cmd.rs:41
Clear old log files.src/cortex-cli/src/logs_cmd.rs:116-121
.logor.txt.src/cortex-cli/src/logs_cmd.rs:316-336
run_clear()iterates every file inlogs_dirand deletes it ifmodified < cutoff_time, with no extension filter.