Monitor Logging
Configure how Monitor logs security events, threat detections, and operational information. Multiple output destinations, configurable log levels, and cloud reporting for centralized forensic logging.
Overview
Monitor generates log events for every security-relevant action: protection module initialization, threat detections, response actions taken, cloud sync status, and internal errors. You control what gets logged, at what level, and where the output goes.
Logging can be configured from three sources:
- Cloud Dashboard: Toggle logging settings in the Advanced Configuration panel of the Workflow tab
- JSON file: Define logging fields in your configuration file
- Configuration API: Set logging options programmatically in code
Log Levels
Monitor supports four log levels, from most to least verbose:
| Level | Enum Value | Description | When to Use |
|---|---|---|---|
| Debug | BHMLogLevelDebug | Detailed diagnostic information including internal state | Development and active troubleshooting only |
| Info | BHMLogLevelInfo | General operational events: module loaded, config synced, incident reported | Default for production |
| Warning | BHMLogLevelWarning | Potential issues that do not prevent operation | Staging environments, early detection of misconfigurations |
| Error | BHMLogLevelError | Errors that affect functionality but do not stop Monitor | Production minimum recommended level |
Set the minimum level to control which events are recorded. For example, setting the level to Warning records Warning and Error events, but ignores Debug and Info.
Configuration
JSON Configuration
{
"apiToken": "${BYTEHIDE_TOKEN}",
"logLevel": "info",
"enableConsoleLogs": true,
"enableFileLogs": false
}{
"apiToken": "${BYTEHIDE_TOKEN}",
"logLevel": "info",
"enableConsoleLogs": true,
"enableFileLogs": false
}| Field | Type | Default | Description |
|---|---|---|---|
logLevel | string | "info" | "debug", "info", "warning", "error" |
enableConsoleLogs | boolean | true | Enable console logging (NSLog / os_log output) |
enableFileLogs | boolean | false | Enable file logging to disk |
Code-Based Configuration (Swift)
import ByteHideMonitor
BHMMonitor.configure { config in
config.logLevel(.info)
// Protections...
config.enableAllProtections(.log, intervalMs: 5000)
}import ByteHideMonitor
BHMMonitor.configure { config in
config.logLevel(.info)
// Protections...
config.enableAllProtections(.log, intervalMs: 5000)
}Code-Based Configuration (Objective-C)
#import <ByteHideMonitor/ByteHideMonitor.h>
[BHMMonitor configure:^(BHMMonitorConfiguration *config) {
[config logLevel:BHMLogLevelInfo];
// Protections...
[config enableAllProtections:BHMActionTypeLog intervalMs:5000];
}];#import <ByteHideMonitor/ByteHideMonitor.h>
[BHMMonitor configure:^(BHMMonitorConfiguration *config) {
[config logLevel:BHMLogLevelInfo];
// Protections...
[config enableAllProtections:BHMActionTypeLog intervalMs:5000];
}];Output Destinations
Console Output
Outputs Monitor events to the system console via NSLog / os_log. Useful during development in Xcode and visible in the Console app.
Console logging is enabled by default. To disable it in JSON:
{
"enableConsoleLogs": false
}{
"enableConsoleLogs": false
}File Logging
Writes Monitor events to a log file on disk. The file path can be configured via the logFilePath property in code.
{
"enableFileLogs": true
}{
"enableFileLogs": true
}Cloud Dashboard Configuration
You can configure logging settings from the Advanced Configuration panel in the Workflow tab of the Cloud Dashboard:
| Setting | Description |
|---|---|
| Logging | Master toggle to enable or disable all logging |
| Minimum Level | Select the minimum log level (Debug, Info, Warning, Error) |
| Console Output | Toggle stdout output |
| Debug Logging | Toggle verbose diagnostic output (not for production) |
Changes made in the Cloud Dashboard apply immediately to all running instances without redeployment.
Log Output Format
Monitor log entries include:
- Timestamp: When the event occurred
- Level: Log level (Debug, Info, Warning, Error)
- Module: Which protection module generated the event
- Message: Description of the event
- Threat Details: For detection events, includes threat type, confidence score, and action taken
Example console output:
[2025-01-15 10:23:45.123] [INFO] Monitor initialized successfully
[2025-01-15 10:23:45.456] [INFO] Protection modules loaded: 6 active
[2025-01-15 10:24:12.789] [WARN] JailbreakDetection detected - Action: CLOSE - Confidence: 0.95
[2025-01-15 10:24:12.790] [INFO] Incident reported to ByteHide Cloud[2025-01-15 10:23:45.123] [INFO] Monitor initialized successfully
[2025-01-15 10:23:45.456] [INFO] Protection modules loaded: 6 active
[2025-01-15 10:24:12.789] [WARN] JailbreakDetection detected - Action: CLOSE - Confidence: 0.95
[2025-01-15 10:24:12.790] [INFO] Incident reported to ByteHide CloudBest Practices
- Set the minimum level to Info in production for a balance between visibility and log volume
- Enable console logging during development for real-time Xcode output
- Enable file logging for on-premise or offline deployments where cloud logging is not available
- Keep debug logging disabled in production. Enable it temporarily when troubleshooting, then disable it again
- Review Cloud Panel incidents regularly to identify threat patterns and false positives
Next Steps
Cloud Configuration
Configure logging from the Cloud Dashboard
JSON Configuration
Full JSON schema reference including logging options
Troubleshooting
Common issues and debugging steps