Where Are TencentDB Agent Memory Logs Located? Configuration and File Paths Explained
TencentDB Agent Memory writes all log entries to a proxy.log file inside the directory specified by the filePath property in the logging configuration, defaulting to ./logs unless explicitly overridden.
TencentDB Agent Memory implements a unified logging façade within its MemoryProxy component to centralize diagnostic output. Understanding the exact file paths and configuration options is essential for debugging agent behavior, monitoring system health, and managing log retention. This guide examines the source implementation in the TencentCloud/TencentDB-Agent-Memory repository to pinpoint where logs are stored and how to customize their locations.
Core Logging Architecture in TencentDB Agent Memory
The logging system centers on MemoryProxy/src/report/log.ts, which exports the initLogger function and the primary logging API. When the application starts, initLogger receives a LogConfig object that determines whether logs are written to the filesystem and where they are stored.
The Log Configuration Interface
The configuration contract is defined in MemoryProxy/src/report/types.ts. The LogConfig interface includes the critical filePath property that specifies the target directory:
config.filePath: The absolute or relative directory path where log files are written.config.rotate: An object containingmaxSizeBytesandbackupLimitto control file rotation.
If filePath is provided, the logger creates a FileLogger instance that persists entries to disk.
The FileLogger Implementation
Inside MemoryProxy/src/report/log.ts, the initialization logic instantiates the file writer when a path is configured:
// MemoryProxy/src/report/log.ts
if (config.filePath) {
fileLogger = new FileLogger({
dir: config.filePath,
filename: "proxy.log",
rotateSizeBytes: config.rotate.maxSizeBytes,
rotateBackupLimit: config.rotate.backupLimit,
});
}
This code confirms that all TencentDB Agent Memory logs are written to proxy.log within the configured directory, with automatic rotation based on size and backup count limits.
Default Log File Location
When no explicit configuration is provided, the system relies on default settings typically defined in MemoryProxy/src/config/default.json (or equivalent configuration files in the repository). The standard default sets filePath to "./logs", resulting in logs being written to:
./logs/proxy.log
The repository structure ensures this path is relative to the execution context of the MemoryProxy process, making it predictable for containerized and local deployments alike.
Configuring Custom Log Paths
Developers can override the default location by passing a custom LogConfig object to initLogger during application bootstrap:
// Initialize logger with custom path
import { initLogger } from "./report/log.js";
const logConfig = {
level: "info",
filePath: "/var/log/memory-agent", // Custom directory
rotate: {
maxSizeBytes: 10_000_000, // 10 MB rotation size
backupLimit: 5 // Keep 5 backup files
},
backend: "console",
};
initLogger(logConfig);
After initialization, all subsequent log calls write to /var/log/memory-agent/proxy.log:
import { log } from "./report/log.js";
log.info("agent_started", { version: "1.0.0" });
log.error("connection_failed", { host: "db.example.com" }, error);
Reading and Monitoring Log Files
Because the logger produces standard text files with rotation support, you can use standard Unix utilities to monitor output in real time:
# Follow logs in real-time
tail -f ./logs/proxy.log
# Search for specific error patterns
grep "ERROR" ./logs/proxy.log | head -20
# Check disk usage of rotated logs
ls -lh ./logs/proxy.log*
The rotation mechanism automatically creates backup files (e.g., proxy.log.1, proxy.log.2) when the active file exceeds rotateSizeBytes, preserving exactly backupLimit historical files before deletion.
Summary
- Log Location: All logs are written to
<config.filePath>/proxy.logas implemented inMemoryProxy/src/report/log.ts. - Default Path: Without configuration, logs default to
./logs/proxy.logbased on standard repository settings. - Configuration: Modify the
filePathproperty in theLogConfiginterface (defined inMemoryProxy/src/report/types.ts) to change the storage directory. - Rotation: The
FileLoggerclass handles automatic rotation usingrotateSizeBytesandrotateBackupLimitparameters to manage disk space. - Monitoring: Standard tools like
tail,grep, andlswork directly on the log files since they are plain text with JSON-structured entries.
Frequently Asked Questions
What is the default log filename in TencentDB Agent Memory?
The default filename is proxy.log. This is hardcoded in the FileLogger instantiation within MemoryProxy/src/report/log.ts, where the filename parameter is explicitly set to "proxy.log" regardless of the configured directory path.
How do I change where TencentDB Agent Memory logs are stored?
Modify the filePath property in the LogConfig object passed to initLogger(). This property accepts any valid filesystem path, absolute or relative. For example, setting filePath: "/var/log/tencentdb" directs all output to /var/log/tencentdb/proxy.log.
Does TencentDB Agent Memory support automatic log rotation?
Yes. The FileLogger class in MemoryProxy/src/report/log.ts implements rotation based on the rotate configuration object. Set rotate.maxSizeBytes to define the maximum file size before rotation (e.g., 10_000_000 for 10 MB) and rotate.backupLimit to specify how many archived log files to retain.
Where is the log configuration defined in the source code?
The configuration interface is defined in MemoryProxy/src/report/types.ts, while the implementation logic resides in MemoryProxy/src/report/log.ts. The default values are typically loaded from JSON configuration files in MemoryProxy/src/config/, where the filePath is commonly set to "./logs".
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →