Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Log Archive Tool

CLI tool to archive a log directory into a timestamped tar.gz file.

Project reference: https://roadmap.sh/projects/log-archive-tool

Usage

Make the script executable:

chmod +x log-archive

Run the tool with a log directory:

./log-archive /var/log

What it does

  • Accepts a log directory as a command-line argument.
  • Compresses the directory into logs_archive_YYYYMMDD_HHMMSS.tar.gz.
  • Creates an archives/ directory in the current working directory if it does not exist.
  • Appends each archive event to archives/archive_history.log with the date and time.

Example output

archives/logs_archive_20240816_100648.tar.gz

Scheduling

You can schedule the script with cron. Example that runs every day at 2 AM:

0 2 * * * /path/to/log-archive /var/log

About

Simple tool to archive logs from the CLI with the date and time.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages