Skip to content

logs-hook

A robust, secure, and configurable logging system for Kodachi OS

Version: 9.0.1 | Size: 1.4MB | Author: Warith Al Maawali

License: Proprietary | Website: https://digi77.com


File Information

Property Value
Binary Name logs-hook
Version 9.0.1
Build Date 2026-05-19T08:52:43.190761484Z
Rust Version 1.88.0
File Size 1.4MB
JSON Data View Raw JSON

SHA256 Checksum

906ed5f40ff81f69dea7856a1dad1a8892cd81c0cc27023a93798e0c4e5a3156

Features

Feature Description
Feature Centralized logging system
Feature Log rotation with configurable limits
Feature Secure log wiping
Feature Multiple log levels support
Feature JSON output format
Feature Embedded configuration system

Security Features

Feature Description
Authentication Not implemented in this crate (online-auth is a separate binary)
Encryption Not implemented in this crate (log files are stored as plain text)
Inputvalidation Sanitizes script names and messages
Ratelimiting Not implemented in this crate (handled externally if required)

System Requirements

Requirement Value
OS Linux (Debian-based)
Privileges root/sudo for system logs
Dependencies tokio runtime, filesystem access

Global Options

Flag Description
-h, --help Print help information
-v, --version Print version information
-n, --info Display detailed information
-e, --examples Show usage examples
--json Output in JSON format
--json-pretty Pretty-print JSON output
--json-filter <FIELDS> Filter JSON output fields (parsed globally; not applied by logs-hook)
--verbose Enable verbose output (parsed globally; not applied by logs-hook)
--quiet Suppress non-essential output (parsed globally; not applied by logs-hook)
--no-color Disable colored output
-t, --timeout <SECS> Set timeout (parsed globally; not applied by logs-hook)
--retry <COUNT> Retry attempts (parsed globally; not applied by logs-hook)
-d, --work-dir <PATH> Working directory (defaults to auto-detected base directory)
-o, --output-format <FORMAT> Force output format (default: text)
--config <FILE> Configuration file path (parsed globally; logs-hook uses embedded config only)
--fields <FIELD_LIST> Select specific fields to include in output (parsed globally; not applied by logs-hook)
--limit <NUMBER> Limit number of results returned (parsed globally; not applied by logs-hook)
--offset <NUMBER> Skip first N results for pagination (parsed globally; not applied by logs-hook)

Commands

Logging Commands

log

Log a message

Usage:

logs-hook log --script <SCRIPT> --level <LEVEL> <MESSAGE>

Options: - --script, -s <SCRIPT>: Script name for the log entry - --level, -l <LEVEL>: Log level (info, warn, error, debug, fatal)

Examples:

logs-hook log --script 'my-script' --level info 'Script started'
logs-hook log -s 'backup' -l warn 'Low disk space'
logs-hook log --script 'app' --level error 'Connection failed' --json

Maintenance Commands

maintenance rotate

Rotate a specific log file (--file is required)

Usage:

logs-hook maintenance rotate --file <FILE>

Options: - --file, -f <FILE>: Log file to rotate (required; rotate-all is not supported)

Examples:

logs-hook maintenance rotate --file /path/to/log.txt
logs-hook maintenance rotate --file /path/to/log.txt --json

maintenance wipe

Wipe log files (--all, --file, or --confirm is required)

Usage:

logs-hook maintenance wipe (--all | --file <FILE> | --confirm)

Options: - --all, -a: Wipe all logs - --file, -f <FILE>: Specific log file to wipe - --confirm: Explicitly confirm wipe using the default policy (required when neither --all nor --file is given)

Examples:

logs-hook maintenance wipe --all
logs-hook maintenance wipe --file /path/to/log.txt
logs-hook maintenance wipe --all --json
logs-hook maintenance wipe --confirm

Operational Scenarios

Scenario-oriented workflows generated from the binary's built-in -e --json examples.

Scenario 1: Basic Usage

Common logging operations

Step 1: Log an info message

sudo logs-hook log --script 'my-script' --level info 'Script started'
Expected Output: Message logged successfully

Step 2: Log a warning with short flags

sudo logs-hook log -s 'backup' -l warn 'Low disk space'
Expected Output: Message logged successfully

Step 3: Log with JSON output

sudo logs-hook --json log --script 'app' --level error 'Failed'
Expected Output: JSON response with envelope

Step 4: Log a debug message

sudo logs-hook log --script 'app' --level debug 'Verbose trace'
Expected Output: Message logged successfully

Step 5: Log a fatal message

sudo logs-hook log --script 'app' --level fatal 'Unrecoverable failure'
Expected Output: Message logged successfully

Note

Fatal level is the highest severity; reserve for unrecoverable conditions

Scenario 2: Maintenance Operations

Log rotation and cleanup

Step 1: Rotate a specific log file (--file is required)

sudo logs-hook maintenance rotate --file /path/to/log.txt
Expected Output: Log rotation completed for the specified file

Note

--file is required; rotate-all is not supported

Step 2: Wipe all logs

sudo logs-hook maintenance wipe --all
Expected Output: All logs wiped successfully

Note

Use with caution

Step 3: Wipe specific log file

sudo logs-hook maintenance wipe --file /path/to/log.txt
Expected Output: Specified log file wiped successfully

Note

File must exist and be writable

Scenario 3: Advanced Usage

Complex operations and configurations

Step 1: Custom timeout for long operations

sudo logs-hook --timeout 60 log --script 'slow-task' --level info 'Starting'
Expected Output: Message logged successfully

Step 2: Pretty JSON output

sudo logs-hook --json-pretty log -s 'test' -l info 'Test'
Expected Output: Pretty-printed JSON response

Scenario 4: JSON Output

Working with JSON formatted output

Step 1: Version in JSON format

sudo logs-hook -v --json
Expected Output: JSON envelope with version data

Step 2: Program info in JSON format

sudo logs-hook -n --json
Expected Output: JSON envelope with program details

Step 3: Log with JSON output

sudo logs-hook --json log --script 'test' --level info 'message'
Expected Output: JSON response with status and metadata

Step 4: Rotate a specific log file with JSON output

sudo logs-hook maintenance rotate --file /path/to/log.txt --json
Expected Output: JSON response with rotation results

Note

--file is required

Step 5: Wipe all logs with JSON output

sudo logs-hook maintenance wipe --all --json
Expected Output: JSON response with wipe results

Note

Returns structured JSON with operation status

Scenario 5: Troubleshooting

Debug and error handling

Step 1: Enable verbose output

sudo logs-hook --verbose log --script 'debug' --level debug 'Debug info'
Expected Output: Detailed debug information

Note

Use for debugging issues

Step 2: Test with custom working directory

sudo logs-hook --work-dir /custom/path log --script 'debug' --level info 'Custom directory test'
Expected Output: Message logged to custom path

Note

Useful for debugging path issues

Environment Variables

Variable Description Default Values
RUST_LOG Set logging level info error
NO_COLOR Disable all colored output when set unset 1
KODACHI_BASE_DIR Base directory for logs auto-detected /path/to/base/dir
LOGS_HOOK_WORK_DIR Working directory for logging operations current directory /path/to/work/dir

Exit Codes

Code Description
0 Success
1 General error
2 Invalid arguments
3 Permission denied
4 Network error
5 File not found