Command Syntax
Logging Options Reference
string
File to redirect log output. By default, logs are written to stdout.Examples:
The log file can be rotated using the
reopen signal. See Signals for details.boolean
default:"true"
Timestamp log entries. Enabled by default.Examples:With timestamps:Without timestamps:
boolean
Log to syslog or Windows event log. Routes log output to the system’s logging facility.Examples:
string
Syslog server address. Send logs to a remote syslog server.Format:
udp://hostname:portExamples:boolean
Enable debugging output. Provides detailed information about server operations.Examples:Debug output includes:
- Client connections and disconnections
- Subscription details
- Route and gateway connections
- Internal server state changes
boolean
Trace the raw protocol. Shows the actual NATS protocol messages exchanged with clients (excluding system account).Examples:Trace output example:
boolean
Verbose trace. Traces system account as well. Includes all protocol messages including system account traffic.Examples:Use this when debugging system account issues or JetStream internals.
boolean
Debug and trace. Convenient combination of debug and trace flags.Examples:
boolean
Debug and verbose trace. Combination of debug and verbose trace flags.Examples:
string
default:"auto"
Logfile size limit. When the log file reaches this size, it is automatically rotated.Format: Number with optional unit (B, KB, MB, GB)Examples:When the limit is reached, the current log file is renamed with a timestamp suffix and a new log file is created.
number
default:"unlimited"
Maximum printable length for traced messages. Limits the payload size shown in trace output.Examples:Useful when tracing messages with large payloads to prevent log file bloat.Output example with limit:
Complete Examples
Development Debugging
Production Logging
Remote Syslog
Protocol Debugging
Full Debug Mode
Production with Info Logging
Log Levels
NATS server uses the following log levels:Log Rotation
Logs can be rotated in two ways:- Automatic rotation - When
--log_size_limitis reached - Manual rotation - Send
reopensignal to the server
Related Options
- Server Options - Core server configuration
- Signals - Log rotation and reload signals