Skip to content

Logs Hook

🛡️ File Information

Property Value
Binary Name logs-hook
Version 9.0.1
File Size 2.7MB
Author Warith Al Maawali
License Proprietary
Category Infrastructure & Management
Description A robust, secure, and configurable logging system for Kodachi OS
JSON Data View Raw JSON

SHA256 Checksum

734596f2bf771724162e81185e97a5cfb294f13ac37ba3a47830c59b3c19a5c1

🛡️ Key Features

Centralized Logging

Feature Description
Unified System All Kodachi services log to one location
Consistent Format Standardized timestamps and severity levels
Automatic Rotation Prevents logs from filling disk space
Secure Wiping Removes sensitive data from old logs

Why Logs Hook is Essential

Benefit Description
System Health Track service operations and errors
Security Auditing Maintain audit trail of system events
Disk Management Automatic rotation prevents space issues
Privacy Protection Secure deletion of sensitive log data

🛡️ ⚡ TL;DR - Essential Commands

# Log a message
logs-hook log "System check completed" --level info

# Rotate log files
sudo logs-hook maintenance rotate

# Wipe old logs securely
sudo logs-hook maintenance wipe

# View recent logs
logs-hook view --tail 50

🛡️ Understanding Centralized Logging

How Logs Hook Works

All Kodachi services send their logs through Logs Hook for centralized management:

# Basic logging
logs-hook log "Starting VPN connection" --level info
logs-hook log "Authentication failed" --level error
logs-hook log "Debug: Connection details" --level debug

Log Levels:

Level Description
ERROR Critical issues requiring attention
WARN Warnings about potential problems
INFO General informational messages
DEBUG Detailed debugging information
TRACE Very detailed trace information

Log Location and Structure

Logs are stored in dashboard/hooks/logs/:

# View log directory structure
ls -la dashboard/hooks/logs/

# Exact log file paths and samples:
dashboard/hooks/logs/ip-fetch-log.log              # IP fetch operations
dashboard/hooks/logs/dns-switch-log.log            # DNS switching events
dashboard/hooks/logs/health-control-log.log        # System health checks
dashboard/hooks/logs/routing-switch-log.log        # VPN/proxy connections
dashboard/hooks/logs/tor-switch-log.log            # Tor operations
dashboard/hooks/logs/online-auth-log.log           # Authentication events
dashboard/hooks/logs/permission-guard-log.log      # Permission corrections
dashboard/hooks/logs/integrity-check-log.log       # Integrity verification

Sample Log Entries:

2025-01-15 14:23:17 [INFO] ip-fetch: Successfully fetched IP from Kodachi Cloud
2025-01-15 14:23:18 [ERROR] dns-switch: Failed to connect to DNS server 8.8.8.8
2025-01-15 14:23:19 [WARN] health-control: Network connectivity degraded
2025-01-15 14:23:20 [DEBUG] routing-switch: Connecting to WireGuard server

Log Rotation

Prevent logs from consuming disk space:

# Rotate logs (archives current, starts fresh)
sudo logs-hook maintenance rotate

# Rotate with JSON output for automation
sudo logs-hook maintenance rotate --json

# What happens:
# 1. Current logs → compressed archives (.gz files)
# 2. New empty log files created
# 3. Old archives deleted after retention period (default: 7 days)

Secure Log Wiping

Remove sensitive information from logs:

# Wipe all old rotated logs
sudo logs-hook maintenance wipe --all

# Note: This removes old rotated log archives
# Current active logs are preserved
# Data is securely overwritten before deletion

Logging from Applications

Services use Logs Hook for consistent logging:

# Application logging (script name required)
sudo logs-hook log --script 'my-service' --level info 'Service started'

# Short form with -s and -l
sudo logs-hook log -s 'routing-switch' -l info 'Connection established'

# With JSON output
sudo logs-hook --json log -s 'app' -l error 'Connection failed'

Working with Logs

# Logs are stored in dashboard/hooks/logs/
ls -la dashboard/hooks/logs/

# View logs directly (each service has its own file)
tail -f dashboard/hooks/logs/ip-fetch-log.log
tail -f dashboard/hooks/logs/dns-switch-log.log

# Note: Direct log viewing is preferred over logs-hook view commands

Log Management Best Practices

# Regular maintenance workflow
sudo logs-hook maintenance rotate      # Rotate logs first
sudo logs-hook maintenance wipe --all  # Clean old archives

# Check logs-hook is working
sudo logs-hook -v --json              # Version info
sudo logs-hook -n --json              # Detailed info

JSON Output Options

# All logs-hook commands support JSON output
sudo logs-hook --json log -s 'test' -l info 'Test message'

# Pretty-printed JSON for readability
sudo logs-hook --json-pretty log -s 'app' -l warn 'Warning'

# Parse JSON output with jq filters
sudo logs-hook -v --json | jq '.version'
sudo logs-hook maintenance rotate --json | jq '.rotated_files[]'
sudo logs-hook -n --json | jq '.service_info.memory_usage'

# Filter log operations
tail -f dashboard/hooks/logs/ip-fetch-log.log | jq 'select(.level == "ERROR")'  # Error logs only
grep "ERROR" dashboard/hooks/logs/*.log | jq -R 'split(":") | {file: .[0], message: .[1:]}'

🛡️ Advanced Commands

For advanced users who need access to all available commands and options, please refer to the auto-generated command reference which includes:

Feature Description
Rotation Schedules Custom rotation schedules
Compression Log compression options
Remote Logging Remote logging configuration
Filtering Advanced filtering and queries
Metrics Performance metrics logging
JSON Formatting JSON output formatting
CLI Reference All command-line flags and parameters

🛡️ Security Notes

Important Security Practices:

Practice Description
Data Wiping Regularly wipe old logs containing sensitive data
Size Monitoring Monitor log sizes to prevent disk exhaustion
Error Review Review error logs for security issues
Log Levels Use appropriate log levels (avoid DEBUG in production)
Permissions Ensure log directory permissions are restrictive

🛡️ Performance

Metric Value
Write Speed ~10,000 messages/second
Memory Usage ~10MB active, < 2MB idle
CPU Usage < 1% during normal logging
Rotation Time < 2 seconds for 1GB logs
Default Retention 7 days for archived logs, unlimited for active logs

Retention Configuration

Log Type Retention Size Limit Action
Active Logs Unlimited 100MB/file Auto-rotate when full
Archived Logs 7 days 10GB total Auto-delete oldest
Error Logs 30 days 50MB total Priority retention
Debug Logs 3 days 1GB total Quick deletion

🛡️ Support

Resource Link
Website digi77.com
Anonymity Verifier kodachi.cloud
Discord Support discord.gg/KEFErEx
GitHub github.com/WMAL

Back to top