SG Collect Info
sgcollect_info
is command line utility that provides detailed statistics for a specific Sync Gateway node.
This tool must be run on each node individually, not on all simultaneously.
sgcollect_info
outputs the following statistics in a zip file:
-
Logs
-
Configuration
-
Expvars (exported variables) that contain important stats
-
System Level OS stats
-
Golang profile output (runtime memory and cpu profiling info)
Examples
Collect Sync Gateway diagnostics and save locally:
./sgcollect_info /tmp/sgcollect_info.zip
Collect Sync Gateway diagnostics and upload them to the Couchbase Support AWS S3 bucket:
./sgcollect_info \
--sync-gateway-config=/path/to/config.json \
--sync-gateway-executable=/usr/bin/sync_gateway \
--upload-host=s3.amazonaws.com/cb-customers \
--customer=Acme \
--ticket=123
/tmp/sgcollect_info.zip
REST Endpoint
sgcollect_info
can now be run from the Admin REST API as of Sync Gateway 2.1 using the _sgcollect_info endpoint.
Zipfile contents
The tool creates the following log files in the ouput file.
Log file | Description |
---|---|
|
The http access log for sync gateway (i.e which GETs and PUTs it has received and from which IPs) |
|
The http access log for sg_accel (i.e which GETs and PUTs it has received and from which IPs) |
|
The error log (all logging sent to stderr by sg_accel) for the sg_accel process |
|
The error log (all logging sent to stderr by sync_gateway) for the sync_gateway process |
|
The output of http://localhost:4895 for the running sync gateway |
|
The output of http://localhost:4895/db_name for the running sync gateway |
|
The on-disk configuration file used by sync_gateway when it was launched |
|
The on-disk configuration file used by sg_accel when it was launched |
|
The configuration used by sync gateway as it is running (may not match the on-disk config as it can be changed on-the-fly) |
|
The config used by sync gateway for the database specified by db_name |
|
The expvars (global exposed variables - see https://www.mikeperham.com/2014/12/17/expvar-metrics-for-golang/ for the running sync gateway instance) |
|
The command line arguments passed to sgcollect_info for this particular output |
|
OS-level System Stats |
|
Exported Variables (expvars) from Sync Gateway which show runtime stats |
|
Goroutine pprof profile output |
|
Heap pprof profile output |
|
CPU profile pprof profile output |
|
System level logs like /var/log/dmesg on Linux |
|
The Sync Gateway binary executable |
|
The pprof output that collects directly via an http client rather than using go tool, in case Go is not installed |
File concatenation
SGCollect Info has been updated to use the continuous logging feature introduced in 2.1, and collects the four leveled files (sg_error.log, sg_warn.log, sg_info.log and sg_debug.log).
These new log files are rotated and compressed by Sync Gateway, so sgcollect_info
decompresses these rotated logs, and concatenates them back into a single file upon collection.
For example, if you have sg_debug.log, and sg_debug-2018-04-23T16-57-13.218.log.gz and then run sgcollect_info
as normal, both of these files get put into a sg_debug.log file inside the zip output folder.
Log Redaction
SGCollect Info now supports log redaction post-processing.
In order to utilize this, Sync Gateway needs to be run with the logging.redaction_level
property set to "partial".
Two new command line options have been added to sgcollect_info
:
-
--log-redaction-level=REDACT_LEVEL
: redaction level for the logs collected,none
andpartial
supported. Defaults tonone
.When
--log-redaction-level
is set to partial, two zip files are produced, and tagged contents in the redacted one should be hashed in the same way ascbcollect_info
:$ ./sgcollect_info --log-redaction-level=partial sgout.zip ... Zipfile built: sgout-redacted.zip Zipfile built: sgout.zip
-
--log-redaction-salt=SALT_VALUE
: salt used in the hashing of tagged data when enabling redaction. Defaults to a random uuid.
Installing Optional Dependencies
sgcollect_info
will be able to collect more information if the following tools are installed:
-
Graphviz — this is used to render PDFs of the go pprof output.
-
Golang — this should be the same version that Sync Gateway was built with.
Version Go build version 1.3.0
1.5.3
1.3.1
1.6.3
1.4.1
1.7.4
1.5.2
1.7.4
2.0
1.8.5
2.1
1.8.5
If go is not installed,
sgcollect_info
will print the following error message, you can ignore it.Exception during compression: [Error 2] The system cannot find the file specified IMPORTANT:Compression using gozip failed. Falling back to python implementation. Please let us know about this and provide console output.
Sharing Files with Us
The sgcollect_info
tool can result in large files.
Simply run the command below, replacing <FILE NAME>
and <YOUR COMPANY NAME>
, to upload a file to our cloud storage on Amazon AWS.
Make sure you include the last slash (/
) character after the company name.
curl --upload-file FILE NAME https://s3.amazonaws.com/customers.couchbase.com/<YOUR COMPANY NAME>/
We ship curl with Couchbase Server, on Linux this is located in /opt/couchbase/bin/ .
|