Tase

March 14, 2026 ยท View on GitHub

GitHub Actions Workflow Status GitHub Actions Workflow Status Coverage Status

drawing

Warning

Tase is well-tested on limited environments but not battle-tested fully.

Tase

Table of Contents

What is Tase?

Tase is a lightweight log management system written in Zig. It consists of a daemon running on a master server and lightweight agents deployed across multiple servers. With a single config.yaml, Tase allows centralized control over log file management, including deletion, rotation, and truncation.

Features

  1. Master-Agent Architecture: The master server manages configurations and schedules, while agents execute log management tasks.
  2. YAML-Based Configuration: The master server reads a config.yaml file to determine agent behavior and scheduling.
  3. Cron-based Scheduling: The application uses cron-based scheduling to execute the log management tasks at predefined intervals.
  4. Delete Logs: The application can delete log files that are older than a specified number of days or exceed a certain size.
  5. Rotate Logs: The application can rotate log files, optionally compressing the archived files using the GZip algorithm. It can also delete archived logs older than a specified number of days or size same as delete action.
  6. Truncate Logs: The application can truncate log files that are older than a specified number of days or exceed a certain size.

Installation

Tase is written in Zig, and to build and install it, follow these steps:

# Clone the repository
git clone https://github.com/Gnyblast/tase.git
cd tase

# Build the application
zig build

# Run the master daemon
zig-out/bin/tase -m master -c /path/to/config.yml

# Run the agent daemon on other servers that can communicate with master server
zig-out/bin/tase --agent --secret <a-generated-secret-that-matches-to-config> --port 7423 --master-host localhost --master-port 7423

CLI Arguments

ArgumentTypeDescriptionDefaultRequired
--log-dirstringDirectory for tase self logs/var/log/taseNo
--log-levelstringLogging level (debug, info, warn, error)infoNo
--masterboolFor server type master-Either --master or --agent required
--agentboolFor server type agent-Either --master or --agent required
--configstringabsolute path for configuration file/etc/tase/app.yamlNo
--secretstringAgents only - Secret for master/agent communication (JWT secret)-Yes - Only for --agent
--hoststringAgent Server host address (Only for agents)127.0.0.1No
--portstringAgent Server port (Only for agents)7423No
--server-typestringAgent Server type, only tcp atm (Only for agents)tcpNo
--master-hoststringHost address of the master for agent to connect (Only for agents)-Yes
--mastger-portstringPort address of the master for agent to connect (Only for agents)-Yes
--helpboolPrint help menu-No

Configuration Reference

Configuration File Structure

The application uses a YAML configuration file with the following main sections:

1. Configs (configs)

Each config defines a log management task with the following properties:

PropertyTypeDescriptionDefaultRequired
app_namestringName of the application-Yes
logs_dirstringDirectory containing log files-Yes
log_files_regexpstringRegular expression to match log files. Always use single quotes ' because of Library Limitations-Yes
cron_expressionstringCron schedule for the log management task-Yes
run_agent_namesstring[]List of agents to run this task ("local" is a reserved word to run against master server itself)-Yes
actionobjectLog management strategy details-Yes

2. Action Strategies

The action object supports three strategies:

Truncate Strategy
PropertyTypeDescriptionDefaultRequired
strategystringMust be "truncate"-Yes
truncate_settings.fromstringTruncate from top or bottom ("top" or "bottom")-Yes
truncate_settings.linesintTruncate by lines (it's mutually exclusive with "size")-Either "lines" or "size"
truncate_settings.sizeintTruncate by size in MB (it's mutually exclusive with "lines")-Either "lines" or "size"
truncate_settings.actionstringKeep or Delete matching truncate_settings ("delete" or "keep")-Yes
if.conditionstringCondition type ("days" or "size" in MB)-Yes
if.operatorstringComparison operator ("gt", "lt", "eq")-Yes
if.operandnumberThreshold value-Yes
Rotate Strategy
PropertyTypeDescriptionDefaultRequired
strategystringMust be "rotate"-Yes
rotate_archives_dirstringDirectory for archiving rotated filessame directory with log fileNo
if.conditionstringCondition type ("days" or "size" in MB)-Yes
if.operatorstringComparison operator ("gt", "lt", "eq")-Yes
if.operandnumberThreshold value-Yes
keep_archive.conditionstringCondition type ("days" or "size" in MB)-Yes if keep_archive is defined
keep_archive.operatorstringComparison operator ("gt", "lt", "eq")-Yes if keep_archive is defined
keep_archive.operandnumberThreshold value-Yes if keep_archive is defined
compressstringCompression algorithm ("gzip")-No
compression_levelnumberCompression level (4-9)4No
Delete Strategy
PropertyTypeDescriptionDefaultRequired
strategystringMust be "delete"-Yes
if.conditionstringCondition type ("days" or "size" in MB)-Yes
if.operatorstringComparison operator ("gt", "lt", "eq")-Yes
if.operandnumberThreshold value-Yes

3. Agents Configuration

PropertyTypeDescriptionDefaultRequired
namestringAgent name ("local" is reserved cannot be used)-Yes
hostnamestringAgent hostname-Yes
portnumberAgent port-Yes
secretstringAuthentication secret-Yes

4. Server Configuration

PropertyTypeDescriptionDefaultRequired
hoststringServer hostname"127.0.0.1"No
portnumberServer port7423No
typestringServer type"tcp"No
time_zonestringServer time zone"UTC"No

Example Configuration

server:
  host: "127.0.0.1"
  port: 7423
  time_zone: "UTC"

agents:
  - name: agent_1
    hostname: "192.xxx.xxx.xxx"
    port: 7423
    secret: "your-secret-key"

configs:
  - app_name: "rotate_logs"
    logs_dir: "/var/log/myapp"
    log_files_regexp: 'test\.log'
    cron_expression: "0 0 * * *"
    run_agent_names:
      - agent_1
    action:
      strategy: rotate
      if:
        condition: days
        operator: "gt"
        operand: 7
      compression_type: gzip
      compression_level: 5

  - app_name: "delete_logs"
    logs_dir: "/var/log/myapp2"
    log_files_regexp: 'test\.log'
    cron_expression: "30 08 * * 7"
    run_agent_names:
      - agent_1
      - local
    action:
      strategy: delete
      if:
        condition: size
        operator: "gt"
        operand: 20

  - app_name: "truncate_by_lines_delete_top"
    logs_dir: "/var/log/myapp3"
    log_files_regexp: 'test\.log'
    cron_expression: "30 09 * * 1"
    run_agent_names:
      - agent_1
    action:
      strategy: truncate
      if:
        condition: days
        operator: "gt"
        operand: 2
      truncate_settings:
        action: "delete"
        from: "top"
        lines: 1000

For more example please see: config

Contributing

Contributions are welcome! Feel free to submit issues and pull requests on GitHub.

Please read Contiribution guide

Roadmap

Version 1.0.0

  • Create a builder for different CPU architectures and OS and implement a released inside
  • TLS upgrade for TCP

Version 2.0.0

  1. Log file monitoring
  2. Parse and process monitored log files
  3. Save processed log files to a database for future consumption by a UI application

License

This project is licensed under the MIT License.

Author

Developed by Gnyblast.