Skip to main content

Get log

Retrieves connection log data (when in-memory logging is enabled)

Function GetLog(Val Connection, Val AsString = False, Val EventCount = 100) Export

ParameterCLI optionTypeRequiredDescription
Connection-ArbitraryAddIn object with open connection
AsString-BooleanTrue > returns log as a single string, False > as an array
EventCount-NumberNumber of recent events to retrieve. 0 > no limits
Returns

String, Map Of KeyAndValue - Log as a string or a map with the full execution result

Caution

NOCLI: this method is not available in CLI version

1C:Enterprise/OneScript code example
LogFile = GetTempFileName("txt");
LoggingSettings = OPI_RCON.GetLoggingSettings(True, 100, LogFile);

URL = "127.0.0.1:25565";
Password = "12We...";
WriteTimeout = 20;
ReadTimeout = 20;

ConnectionParams = OPI_RCON.FormConnectionParameters(URL, Password, ReadTimeout, WriteTimeout);
Connection = OPI_RCON.CreateConnection(ConnectionParams, LoggingSettings);

If Not OPI_RCON.IsConnector(Connection) Then
Raise OPI_Tools.JSONString(Connection);
EndIf;

Command = "list";
Result = OPI_RCON.ExecuteCommand(Command, Connection);

Result = OPI_RCON.GetLog(Connection);
Result
{
"logs": [
"[2026-05-26 13:58:23.647] Connecting to RCON server 127.0.0.1:25575",
"[2026-05-26 13:58:23.658] Connected to RCON server"
],
"result": true,
"returned": 2,
"total": 2
}