Skip to content

[FR] Support logs import & export #348

@yqs112358

Description

@yqs112358

Is your feature request related to a problem?

On those large Mincraft servers, the size of DB ledger.sqlite rapidly grows (about 1GB in just 3-5 days), even with objectBlacklist.

Perhaps they could set autoPurgeDays = xxx in the config file to limit the number of days the logs are stored, thus to limit the size of DB. But that's not good enough: What can I do when they need to look up logs from several months or even years ago?

I think a better solution would be to support logs import & export, so admins can effectively control the size of ledger.sqlite by periodically exporting and purging the old logs, without losing any of the past records.

Describe the solution you'd like.

  1. Adds the ledger export command, which supports selectors similar to those used in inspect to select a range of logs to export. The export format can be .sqlite or .sql or .csv.

  2. Add ledger import command to import previously exported log data back.

Describe alternatives you've considered.

Add API to support importing search results in LedgerApi, so we can develop an extension to realize this feature instead.

Agreements

  • I have searched for and ensured there isn't already an open issue regarding this.
  • I have ensured the feature I'm requesting isn't already in the latest supported mod version.

Other

It is not feasible to operate the database of a running ledger mod directly using an external SQLite CLI. After testing, when using an external SQLite CLI to export data and execute VACUUM, it will conflict with the running ledger mod, causing the database into some problems or even corruption.

Therefore, Ledger's own Export function is still very necessary to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions