Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Missing Event History After Deleting Old Cronicle Logs #863

Open
2 tasks done
resalesonline opened this issue Feb 11, 2025 · 1 comment
Open
2 tasks done
Labels

Comments

@resalesonline
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

After attempting to delete old Cronicle job logs following the instructions in post #304, the Event History tab in the Cronicle web UI displayed unexpected behavior.

Cleanup Process Used:

/opt/cronicle/bin/control.sh stop

find /opt/cronicle/data/logs/ -type f -name "*.json" -mtime +30 -exec ls -lh {} +
or
find /opt/cronicle/data/logs/ -type d -mtime +30 -exec rm -rf {} +

/opt/cronicle/bin/control.sh start

The cleanup successfully removed logs, but an issue appeared in the Event History:

  • First tabs displayed jobs normally, but when changing to certain tab, it showed "No events found." as is there no logs for that job
  • The UI still reports 2,000 jobs, but given that this task runs daily, there should be only around 30 jobs instead.
  • The last job on the working tab was from January 18, meaning that if logs were deleted correctly, there should be job entries at least until January 11 (30 days before February 11, when the cleanup was performed).

So I have this questions:

  • Is this method of deleting old logs incorrect?
  • Is there a database conflict where job metadata still exists but logs are missing?
  • Or could this be a bug in Cronicle?

Would appreciate clarification on whether this issue is expected or if a different cleanup approach is recommended.

Operating System

Ubuntu 22.04.5 LTS

Node.js Version

v12.22.9

Cronicle Version

0.9.23

Server Setup

Single Server

Storage Setup

Local Filesystem

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jhuckaby
Copy link
Owner

Oh dear. Yeah, so, those commands from #304 are extremely brute force, and only used as a last resort. It's akin to going into a SQL database and deleting random index files. It's incredibly dangerous and not recommended, except in very rare cases where there is no other option.

Cronicle uses the filesystem as a database (sort of like git does), so there are many different JSON records that act as indexes, tables, etc. Also, it caches them in memory, so if you make any FS changes while Cronicle is running, it will become horribly corrupted.

At this point I have no idea what state the Cronicle FS "database" is in, so I'd recommend you do an export, total wipe of the data dir, then re-import. The export contains everything except job history. Instructions here:

https://github.com/jhuckaby/Cronicle/blob/master/docs/CommandLine.md#data-import-and-export

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants