|
| 1 | +--- |
| 2 | +Title: Diagnostic logging |
| 3 | +alwaysopen: false |
| 4 | +categories: |
| 5 | +- docs |
| 6 | +- operate |
| 7 | +- rs |
| 8 | +description: Diagnostic logs can help troubleshoot Redis Enterprise Software. |
| 9 | +linkTitle: Diagnostic logging |
| 10 | +weight: 50 |
| 11 | +--- |
| 12 | + |
| 13 | +The diagnostic logging service collects detailed system logs, which you can use to troubleshoot Redis Enterprise Software. |
| 14 | + |
| 15 | +## View diagnostic logs |
| 16 | + |
| 17 | +Diagnostic logs are collected at scheduled intervals and saved in the `/var/opt/redislabs/log/diagnostics/` directory. The log files are rotated once a day. |
| 18 | + |
| 19 | +## View log collector settings |
| 20 | + |
| 21 | +To view the current log collection schedule and parameters for each log collector, use the REST API to [get the diagnostic logging service configuration](/operate/rs/references/rest-api/requests/diagnostics/#put-diagnostics). |
| 22 | + |
| 23 | +```sh |
| 24 | +GET /v1/diagnostics |
| 25 | +``` |
| 26 | + |
| 27 | +Example response: |
| 28 | + |
| 29 | +```json |
| 30 | +{ |
| 31 | + "bdb_client_list_target": { |
| 32 | + "cron_expression": "*/10 * * * *" |
| 33 | + }, |
| 34 | + "bdb_info_target": { |
| 35 | + "cron_expression": "*/10 * * * *" |
| 36 | + }, |
| 37 | + "bdb_target": { |
| 38 | + "cron_expression": "*/10 * * * *" |
| 39 | + }, |
| 40 | + "command_stats_target": { |
| 41 | + "cron_expression": "*/30 * * * *" |
| 42 | + }, |
| 43 | + "network_stats_target": { |
| 44 | + "cron_expression": "*/30 * * * *" |
| 45 | + }, |
| 46 | + "persistent_files_target": { |
| 47 | + "cron_expression": "*/10 * * * *" |
| 48 | + }, |
| 49 | + "rladmin_status_target": { |
| 50 | + "cron_expression": "*/10 * * * *" |
| 51 | + }, |
| 52 | + "shard_info_target": { |
| 53 | + "cron_expression": "*/10 * * * *" |
| 54 | + }, |
| 55 | + "shard_latency_histogram_target": { |
| 56 | + "cron_expression": "*/10 * * * *" |
| 57 | + }, |
| 58 | + "shard_latency_target": { |
| 59 | + "cron_expression": "*/10 * * * *" |
| 60 | + }, |
| 61 | + "shard_target": { |
| 62 | + "cron_expression": "*/10 * * * *" |
| 63 | + }, |
| 64 | + "slowlog_target": { |
| 65 | + "cron_expression": "*/10 * * * *", |
| 66 | + "max_entries": 100 |
| 67 | + }, |
| 68 | + "socket_files_target": { |
| 69 | + "cron_expression": "*/10 * * * *" |
| 70 | + } |
| 71 | +} |
| 72 | +``` |
| 73 | + |
| 74 | +## Change log collector settings |
| 75 | + |
| 76 | +To change how often a log is collected, set the `cron_expression` when you [update the diagnostic logging service configuration]({{<relref "/operate/rs/references/rest-api/requests/diagnostics#put-diagnostics">}}) with the REST API. |
| 77 | + |
| 78 | +```sh |
| 79 | +PUT /v1/diagnostics |
| 80 | +{ |
| 81 | + "<log_collector>_target": { |
| 82 | + "cron_expression": "*/5 * * * *" |
| 83 | + } |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +- Replace `<log_collector>` with the name of the log collector you want to turn off. |
| 88 | + |
| 89 | +- Use standard [cron syntax](https://en.wikipedia.org/wiki/Cron) to set the collection interval in the `cron_expression`. |
| 90 | + |
| 91 | +For the slowlog collector only, you can also set `max_entries` to change the maximum number of slow log entries to collect: |
| 92 | + |
| 93 | +```sh |
| 94 | +PUT /v1/diagnostics |
| 95 | +{ |
| 96 | + "slowlog_target": { |
| 97 | + "cron_expression": "*/5 * * * *", |
| 98 | + "max_entries": 200 |
| 99 | + } |
| 100 | +} |
| 101 | +``` |
| 102 | + |
| 103 | +## Turn off log collectors |
| 104 | + |
| 105 | +To turn off a log collector, set its `cron_expression` to an empty string when you [update the diagnostic logging service configuration]({{<relref "/operate/rs/references/rest-api/requests/diagnostics#put-diagnostics">}}) with the REST API. |
| 106 | + |
| 107 | +```sh |
| 108 | +PUT /v1/diagnostics |
| 109 | +{ |
| 110 | + "<log_collector>_target": { |
| 111 | + "cron_expression": "" |
| 112 | + } |
| 113 | +} |
| 114 | +``` |
| 115 | + |
| 116 | +Replace `<log_collector>` with the name of the log collector you want to turn off. |
| 117 | + |
| 118 | +## Log collectors |
| 119 | + |
| 120 | +Each log collector runs independently and writes a separate log file. The following table describes the log collectors. |
| 121 | + |
| 122 | +Default `cron_expression` values: |
| 123 | + |
| 124 | +- `*/10 * * * *`: Logs are collected every 10 minutes. |
| 125 | + |
| 126 | +- `*/30 * * * *`: Logs are collected every 30 minutes. |
| 127 | + |
| 128 | +| Log collector | Description | |
| 129 | +|---------------|-------------| |
| 130 | +| bdb | Logs database metadata similar to [`GET /bdbs`]({{<relref "/operate/rs/references/rest-api/requests/bdbs">}}). Each entry is in JSON format.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 131 | +| bdb_client_list | Logs database client lists, with a separate file for each database. Each entry is in JSON format.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 132 | +| bdb_info | Logs the result of running [`INFO ALL`]({{<relref "/commands/info">}}) on a database, excluding `commandstats`, with a separate file for each database. Each entry is in JSON format.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 133 | +| command_stats | Logs [`INFO commandstats`]({{<relref "/commands/info">}}) for each database, with a separate file for each database. Each entry is in JSON format.<br />Default settings:<br />{{<code>}}"cron_expression": "*/30 * * * *"{{</code>}} | |
| 134 | +| network_stats | Logs the node's network statistics.<br />Default settings:<br />{{<code>}}"cron_expression": "*/30 * * * *"{{</code>}} | |
| 135 | +| persistent_files | Lists persistent files from `/var/opt/redislabs/persist/redis`<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 136 | +| rladmin_status | Logs data about nodes, databases, endpoints, and shards from [`rladmin status`]({{<relref "/operate/rs/references/cli-utilities/rladmin/status">}}). Each entry is in JSON format.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 137 | +| shard | Logs shard status similar to [`GET /shards`]({{<relref "/operate/rs/references/rest-api/requests/shards">}}). Each entry is in JSON format.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 138 | +| shard_info | Logs the result of running [INFO ALL]({{<relref "/commands/info">}}) on a shard, with a separate file for each shard. Each entry is in JSON format.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 139 | +| shard_latency | Logs the result of running [`latency latest`]({{<relref "/commands/latency-latest">}}) on a shard, with a separate file for each shard.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 140 | +| <span class="break-all">`shard_latency_histogram`</span> | Logs the result of running [`latency histogram`]({{<relref "/commands/latency-histogram">}}) on a shard, with a separate file for each shard.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
| 141 | +| slowlog | Logs slow commands from the databases using [`SLOWLOG GET`]({{<relref "/commands/slowlog-get">}}), with a separate file for each database. Each entry is in JSON format.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *",<br />"max_entries": 100{{</code>}} | |
| 142 | +| socket_files | Lists socket files used by Redis Enterprise Software.<br />Default settings:<br />{{<code>}}"cron_expression": "*/10 * * * *"{{</code>}} | |
0 commit comments