MCP Commands - Logging & Security

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Logging & Security - Logging and access control >

MCP Commands - Logging & Security

MCP.SetRetentionTime - Set Retention Time

PreviousTopNext


MiniRobot Language (MRL) - MCP Logging & Security Commands

 

MCP.SetRetentionTime

Configure Log File Retention Period

 

Purpose

 

The MCP.SetRetentionTime command sets the number of days that log files are retained before being automatically deleted. This helps manage disk space usage and implement data retention policies.

 

Setting an appropriate retention period ensures that sufficient log history is available for troubleshooting while preventing log files from consuming excessive disk space.

 

Syntax

 

MCP.SetRetentionTime|$$DAYS

 

Parameters

 

$$DAYS - The retention period in days. Use 0 to disable automatic cleanup (retain indefinitely).

 

Return Value

 

OK - Retention time was set successfully

ERROR - Invalid parameter (negative value or non-numeric)

 

Examples

 

' Example 1: Retain logs for 1 week

MCP.SetRetentionTime|7

 

' Example 2: Retain logs for 30 days

MCP.SetRetentionTime|30

 

' Example 3: Retain logs for 3 months (90 days)

MCP.SetRetentionTime|90

 

' Example 4: Disable automatic cleanup (keep all logs)

MCP.SetRetentionTime|0

 

Remarks

 

The retention setting takes effect immediately. Any existing log files older than the specified number of days may be deleted during the next cleanup cycle.

 

Log cleanup typically occurs during server startup or at scheduled intervals. The cleanup process removes log files based on their modification date, not creation date.

 

Setting retention to 0 disables automatic cleanup entirely. This is useful for debugging or compliance scenarios where all logs must be preserved.

 

Error Conditions

 

The command will fail with a parameter error if:

• The days parameter is missing

• A negative value is specified

• A non-numeric value is specified

• Too many parameters are provided

 

See also:

 

MCP.GetRetentionTime - Get Retention Time

MCP.SetLogToFile - Set File Logging

MCP.SetLogLevel - Set Logging Level