For having logging rotation with time Stamp I followed the “https://docs.couchbase.com/sync-gateway/2.1/logging.html” link.
I set log file path as below in my sync function configuration file:
{
…
“logging”: {
“default”: {
“logFilePath”: C:\Program Files\Couchbase\Sync Gateway\var\log\sync_gateway\sglogfile.log,
“logKeys”: ["*"],
“rotation”: {
“maxsize”: 1,
“maxage”: 30,
“maxbackups”: 2,
“localtime”: true
}
}
},
"databases": {
…
}
…
}
it creates 3 different files for error, info and warning. I have 3 questions:
1- first of all, sometimes the logs are not rotated and they all are saved in 1 logfile, for example I set to be rotated if they became 1MB , and the size will increase up to 100MB.
2- If the sizing works, it does not the exact thing I need, I had the second test and I set the maxsize to 1, but it rotates log files in files of 10MB not 1MB.
3- I do not want to have log in default folder: C:\Program Files\Couchbase\Sync Gateway\var\lib\couchbase\logs\sync_gateway_error.txt,
as it fills do much disk space and the OS is installed there, it maks it critical.
this file log does not have rotation, and I can not do anything with it. for example I have a total 50MB of files in logFilePath I specified, but I again have
50MB of log files in default folder.
Hey, this style of config is from the older logging functionality pre-2.1.
"logging": {
"default": ...
}
It sounds like what you may want is the following, which will effectively disable the sync_gateway_error.txt log file (which is referred to as “console” in the config), and keep the sg_error.log, sg_warn.log, sg_info.log inside “log_file_path”, with the following rotation settings:
When I set the following config file, after stopping the time I want to start the service it throws Error :
Error 1067: The process terminated unexpectedly.
Consideration: the OS is Windows, so the address to log files is between : `
{
"adminInterface": "127.0.0.1:4985",
"interface": "0.0.0.0:4984",
"log": ["HTTP+"],
"logging": {
"log_file_path": `C:\Program Files\Couchbase\Sync Gateway\var\log\sync_gateway`,
"console": {
"log_level": "none"
},
"error": {
"enabled": true,
"rotation": {
"max_size": 10, // Threshold in megabytes to rotate logs
"max_age": 360, // Maximum days to retain log files (Min: 180)
"localtime": true // Use local computer's time on backup timestamps (false=UTC)
}
}
},
"databases": {
"db": {
"server": "walrus:data",
"users": {
"GUEST": {"disabled": false, "admin_channels": ["*"] }
},
"allow_conflicts": false,
"revs_limit": 20
}
}
}
"max_size": 10, // Threshold in megabytes to rotate logs
"max_age": 360, // Maximum days to retain log files (Min: 180)
"localtime": true // Use local computer's time on backup timestamps (false=UTC)
Paste your config into here to validate the JSON formatting: https://jsonlint.com