Skip to content

logs-hook

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

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

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


File Information

Property Value
Binary Name logs-hook
Version 9.0.1
Build Date 2025-09-23T19:20:02.659679871Z
Rust Version 1.88.0
File Size 2.7MB
JSON Data View Raw JSON

SHA256 Checksum

734596f2bf771724162e81185e97a5cfb294f13ac37ba3a47830c59b3c19a5c1

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 Integrates with online-auth service
Encryption Supports encrypted log storage
Inputvalidation Sanitizes script names and messages
Ratelimiting Built-in protection against log spam

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
--verbose Enable verbose output
--quiet Suppress non-essential output
--no-color Disable colored output
-t, --timeout <SECS> Set timeout (default: 30)
--retry <COUNT> Retry attempts (default: 3)
-d, --work-dir <PATH> Working directory (defaults to auto-detected base directory)
-o, --output-format <FORMAT> Force output format (default: text)
--config <FILE> Use custom configuration file
--fields <FIELD_LIST> Select specific fields to include in output
--limit <NUMBER> Limit number of results returned
--offset <NUMBER> Skip first N results (for pagination)

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 log files

Usage:

logs-hook maintenance rotate [OPTIONS]

Options: - --file, -f <FILE>: Specific log file to rotate

Examples:

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

maintenance wipe

Wipe log files

Usage:

logs-hook maintenance wipe [OPTIONS]

Options: - --all, -a: Wipe all logs - --file, -f <FILE>: Specific log file to wipe

Examples:

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

Examples

Basic Usage

Common logging operations

Log an info message

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

Log a warning with short flags

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

Log with JSON output

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

Maintenance Operations

Log rotation and cleanup

Rotate all log files

sudo logs-hook maintenance rotate
Expected Output: Log rotation completed for all files

Wipe all logs

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

Note

Use with caution

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

Advanced Usage

Complex operations and configurations

Custom timeout for long operations

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

Pretty JSON output

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

JSON Output

Working with JSON formatted output

Version in JSON format

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

Program info in JSON format

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

Log with JSON output

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

Rotate logs with JSON output

sudo logs-hook maintenance rotate --json
Expected Output: JSON response with rotation results

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

Troubleshooting

Debug and error handling

Enable verbose output

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

Note

Use for debugging issues

Enable Rust debug logging

sudo RUST_LOG=debug ./logs-hook log --script 'app' --level error 'Error occurred'
Expected Output: Detailed internal debug output

Note

Shows internal library operations

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

Back to top