Fork me on GitHub

Dropwizard Configuration Reference

The dropwizard-configuration module provides you with a polymorphic configuration mechanism.

Servers

server:
  type: default
  maxThreads: 1024

All

Name Default Description
type default
  • default
  • simple
maxThreads 1024 The maximum number of threads to use for requests.
minThreads 8 The minimum number of threads to use for requests.
maxQueuedRequests 1024 The maximum number of requests to queue before blocking the acceptors.
idleThreadTimeout 1 minute The amount of time a worker thread can be idle before being stopped.
nofileSoftLimit (none) The number of open file descriptors before a soft error is issued. Requires Jetty’s libsetuid.so on java.library.path.
nofileHardLimit (none) The number of open file descriptors before a hard error is issued. Requires Jetty’s libsetuid.so on java.library.path.
gid (none) The group ID to switch to once the connectors have started. Requires Jetty’s libsetuid.so on java.library.path.
uid (none) The user ID to switch to once the connectors have started. Requires Jetty’s libsetuid.so on java.library.path.
user (none) The username to switch to once the connectors have started. Requires Jetty’s libsetuid.so on java.library.path.
group (none) The group to switch to once the connectors have started. Requires Jetty’s libsetuid.so on java.library.path.
umask (none) The umask to switch to once the connectors have started. Requires Jetty’s libsetuid.so on java.library.path.
startsAsRoot (none) Whether or not the Dropwizard application is started as a root user. Requires Jetty’s libsetuid.so on java.library.path.

GZip

server:
  gzip:
    bufferSize: 8KiB
Name Default Description
enabled true If true, all requests with gzip in their Accept-Content-Encoding headers will have their response entities encoded with gzip.
minimumEntitySize 256 bytes All response entities under this size are not compressed.
bufferSize 8KiB The size of the buffer to use when compressing.
excludedUserAgents [] The set of user agents to exclude from compression.
compressedMimeTypes [] If specified, the set of mime types to compress.

Request Log

server:
  requestLog:
    timeZone: UTC
Name Default Description
timeZone UTC The time zone to which request timestamps will be converted.
appenders console appender The set of AppenderFactory appenders to which requests will be logged. TODO See logging/appender refs for more info

Simple

Extends the attributes that are available to all servers

server:
  type: simple
  applicationContextPath: /application
  adminContextPath: /admin
  connector:
    type: http
    port: 8080
Name Default Description
connector http connector HttpConnectorFactory HTTP connector listening on port 8080. The ConnectorFactory connector which will handle both application and admin requests. TODO link to connector below.
applicationContextPath /application The context path of the application servlets, including Jersey.
adminContextPath /admin The context path of the admin servlets, including metrics and tasks.

Default

Extends the attributes that are available to all servers

server:
  adminMinThreads: 1
  adminMaxThreads: 64
  applicationConnectors:
    - type: http
      port: 8080
    - type: https
      port: 8443
      keyStorePath: example.keystore
      keyStorePassword: example
      validateCerts: false
  adminConnectors:
    - type: http
      port: 8081
    - type: https
      port: 8444
      keyStorePath: example.keystore
      keyStorePassword: example
      validateCerts: false
Name Default Description
applicationConnectors An HTTP connector listening on port 8080. A set of connectors which will handle application requests.
adminConnectors An HTTP connector listening on port 8081. An HTTP connector listening on port 8081. A set of connectors which will handle admin requests.
adminMinThreads 1 The minimum number of threads to use for admin requests.
adminMaxThreads 64 The maximum number of threads to use for admin requests.

Connectors

HTTP

# Extending from the default server configuration
server:
  applicationConnectors:
    - type: http
      port: 8080
      bindHost: 127.0.0.1 # only bind to loopback
      headerCacheSize: 512 bytes
      outputBufferSize: 32KiB
      maxRequestHeaderSize: 8KiB
      maxResponseHeaderSize: 8KiB
      inputBufferSize: 8KiB
      idleTimeout: 30 seconds
      minBufferPoolSize: 64 bytes
      bufferPoolIncrement: 1KiB
      maxBufferPoolSize: 64KiB
      acceptorThreads: 1
      selectorThreads: 2
      acceptQueueSize: 1024
      reuseAddress: true
      soLingerTime: 345s
      useServerHeader: false
      useDateHeader: true
      useForwardedHeaders: true
Name Default Description
port 8080 The TCP/IP port on which to listen for incoming connections.
bindHost (none) The hostname to bind to.
headerCacheSize 512 bytes The size of the header field cache.
outputBufferSize 32KiB The size of the buffer into which response content is aggregated before being sent to the client. A larger buffer can improve performance by allowing a content producer to run without blocking, however larger buffers consume more memory and may induce some latency before a client starts processing the content.
maxRequestHeaderSize 8KiB The maximum size of a request header. Larger headers will allow for more and/or larger cookies plus larger form content encoded in a URL. However, larger headers consume more memory and can make a server more vulnerable to denial of service attacks.
maxResponseHeaderSize 8KiB The maximum size of a response header. Larger headers will allow for more and/or larger cookies and longer HTTP headers (eg for redirection). However, larger headers will also consume more memory.
inputBufferSize 8KiB The size of the per-connection input buffer.
idleTimeout 30 seconds The maximum idle time for a connection, which roughly translates to the java.net.Socket#setSoTimeout(int) call, although with NIO implementations other mechanisms may be used to implement the timeout. The max idle time is applied when waiting for a new message to be received on a connection or when waiting for a new message to be sent on a connection. This value is interpreted as the maximum time between some progress being made on the connection. So if a single byte is read or written, then the timeout is reset.
minBufferPoolSize 64 bytes The minimum size of the buffer pool.
bufferPoolIncrement 1KiB The increment by which the buffer pool should be increased.
maxBufferPoolSize 64KiB The maximum size of the buffer pool.
acceptorThreads # of CPUs/2 The number of worker threads dedicated to accepting connections.
selectorThreads # of CPUs The number of worker threads dedicated to sending and receiving data.
acceptQueueSize (OS default) The size of the TCP/IP accept queue for the listening socket.
reuseAddress true Whether or not SO_REUSEADDR is enabled on the listening socket.
soLingerTime (disabled) Enable/disable SO_LINGER with the specified linger time.
useServerHeader false Whether or not to add the Server header to each response.
useDateHeader true Whether or not to add the Date header to each response.
useForwardedHeaders true Whether or not to look at X-Forwarded-* headers added by proxies. See ForwardedRequestCustomize for details.

HTTPS

Extends the attributes that are available to the HTTP connector

# Extending from the default server configuration
server:
  applicationConnectors:
    - type: https
      port: 8443
      ....
      keyStorePath: /path/to/file
      keyStorePassword: changeit
      keyStoreType: JKS
      keyStoreProvider:
      trustStorePath: /path/to/file
      trustStorePassword: changeit
      trustStoreType: JKS
      trustStoreProvider:
      keyManagerPassword: changeit
      needClientAuth: false
      wantClientAuth:
      certAlias: <alias>
      crlPath: /path/to/file
      enableCRLDP: false
      enableOCSP: false
      maxCertPathLength: (unlimited)
      ocspResponderUrl: (none)
      jceProvider: (none)
      validateCerts: true
      validatePeers: true
      supportedProtocols: SSLv3
      supportedCipherSuites: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
      allowRenegotiation: true
      endpointIdentificationAlgorithm: (none)
Name Default Description
keyStorePath REQUIRED The path to the Java key store which contains the host certificate and private key.
keyStorePassword REQUIRED The password used to access the key store.
keyStoreType JKS The type of key store (usually JKS, PKCS12, JCEKS``, Windows-MY}, or Windows-ROOT).
keyStoreProvider (none) The JCE provider to use to access the key store.
trustStorePath (none) The path to the Java key store which contains the CA certificates used to establish trust.
trustStorePassword (none) The password used to access the trust store.
trustStoreType JKS The type of trust store (usually JKS, PKCS12, JCEKS, Windows-MY, or Windows-ROOT).
trustStoreProvider (none) The JCE provider to use to access the trust store.
keyManagerPassword (none) The password, if any, for the key manager.
needClientAuth (none) Whether or not client authentication is required.
wantClientAuth (none) Whether or not client authentication is requested.
certAlias (none) The alias of the certificate to use.
crlPath (none) The path to the file which contains the Certificate Revocation List.
enableCRLDP false Whether or not CRL Distribution Points (CRLDP) support is enabled.
enableOCSP false Whether or not On-Line Certificate Status Protocol (OCSP) support is enabled.
maxCertPathLength (unlimited) The maximum certification path length.
ocspResponderUrl (none) The location of the OCSP responder.
jceProvider (none) The name of the JCE provider to use for cryptographic support.
validateCerts true Whether or not to validate TLS certificates before starting. If enabled, Dropwizard will refuse to start with expired or otherwise invalid certificates.
validatePeers true Whether or not to validate TLS peer certificates.
supportedProtocols (none) A list of protocols (e.g., SSLv3, TLSv1) which are supported. All other protocols will be refused.
supportedCipherSuites (none) A list of cipher suites (e.g., TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256) which are supported. All other cipher suites will be refused
allowRenegotiation true Whether or not TLS renegotiation is allowed.
endpointIdentificationAlgorithm (none) Which endpoint identification algorithm, if any, to use during the TLS handshake.

SPDY

Extends the attributes that are available to the HTTPS connector

server:
  applicationConnectors:
    - type: spdy3
      port: 8445
      keyStorePath: example.keystore
      keyStorePassword: example
      validateCerts: false
Name Default Description
pushStrategy (none) The push strategy to use for server-initiated SPDY pushes.

Logging

logging:
  level: INFO
  loggers:
    io.dropwizard: INFO
  appenders:
    - type: console
Name Default Description
level Level.INFO Logback logging level
loggers (none)  
appenders (none) one of console, file or syslog

Console

logging:
  level: INFO
  appenders:
    - type: console
      threshold: ALL
      timeZone: UTC
      target: stdout
      logFormat: # TODO
Name Default Description
type REQUIRED The appender type. Must be console.
threshold ALL The lowest level of events to print to the console.
timeZone UTC The time zone to which event timestamps will be converted.
target stdout The name of the standard stream to which events will be written. Can be stdout or stderr.
logFormat default The Logback pattern with which events will be formatted. See the Logback documentation for details.

File

logging:
  level: INFO
  appenders:
    - type: file
      currentLogFilename: /var/log/myapplication.log
      threshold: ALL
      archive: true
      archivedLogFilenamePattern: /var/log/myapplication-%d.log
      archivedFileCount: 5
      timeZone: UTC
      logFormat: # TODO
Name Default Description
type REQUIRED The appender type. Must be file.
currentLogFilename REQUIRED The filename where current events are logged.
threshold ALL The lowest level of events to write to the file.
archive true Whether or not to archive old events in separate files.
archivedLogFilenamePattern (none) Required if archive is true. The filename pattern for archived files. %d is replaced with the date in yyyy-MM-dd form, and the fact that it ends with .gz indicates the file will be gzipped as it’s archived. Likewise, filename patterns which end in .zip will be filled as they are archived.
archivedFileCount 5 The number of archived files to keep. Must be between 1 and 50.
timeZone UTC The time zone to which event timestamps will be converted.
logFormat default The Logback pattern with which events will be formatted. See the Logback documentation for details.

Syslog

logging:
  level: INFO
  appenders:
    - type: syslog
      host: localhost
      port: 514
      facility: local0
      threshold: ALL
      logFormat: # TODO
Name Default Description
host localhost The hostname of the syslog server.
port 514 The port on which the syslog server is listening.
facility local0 The syslog facility to use. Can be either auth, authpriv, daemon, cron, ftp, lpr, kern, mail, news, syslog, user, uucp, local0, local1, local2, local3, local4, local5, local6, or local7.
threshold ALL The lowest level of events to write to the file.
logFormat defaultThe Logback pattern with which events will be formatted. See the Logback documentation for details.

Metrics

The metrics configuration has two fields; frequency and reporters.

metrics:
  frequency: 1 second
  reporters:
    - type: <type>
Name Default Description
frequency 1 second The frequency to report metrics. Overridable per-reporter.
reporters (none) A list of reporters to report metrics.

All Reporters

The following options are available for all metrics reporters.

metrics:
  reporters:
    - type: <type>
      durationUnit: milliseconds
      rateUnit: seconds
      excludes: (none)
      includes: (all)
      frequency: 1 second
Name Default Description
durationUnit milliseconds The unit to report durations as. Overrides per-metric duration units.
rateUnit seconds The unit to report rates as. Overrides per-metric rate units.
excludes (none) Metrics to exclude from reports, by name. When defined, matching metrics will not be reported.
includes (all) Metrics to include in reports, by name. When defined, only these metrics will be reported.
frequency 1 second The frequency to report metrics. Overrides the default.

Formatted Reporters

These options are available only to “formatted” reporters and extend the options available to all reporters

metrics:
  reporters:
    - type: <type>
      locale: <system default>
Name Default Description
locale System default The Locale for formatting numbers, dates and times.

Console Reporter

Reports metrics periodically to the console.

Extends the attributes that are available to formatted reporters

metrics:
  reporters:
    - type: console
      timeZone: UTC
      output: stdout
Name Default Description
timeZone UTC The timezone to display dates/times for.
output stdout The stream to write to. One of stdout or stderr.

CSV Reporter

Reports metrics periodically to a CSV file.

Extends the attributes that are available to formatted reporters

metrics:
  reporters:
    - type: csv
      file: /path/to/file
Name Default Description
file No default The CSV file to write metrics to.

Ganglia Reporter

Reports metrics periodically to Ganglia.

Extends the attributes that are available to all reporters

metrics:
  reporters:
    - type: ganglia
      host: localhost
      port: 8649
      mode: unicast
      ttl: 1
      uuid: (none)
      spoof: localhost:8649
      tmax: 60
      dmax: 0
Name Default Description
host localhost The hostname (or group) of the Ganglia server(s) to report to.
port 8649 The port of the Ganglia server(s) to report to.
mode unicast The UDP addressing mode to announce the metrics with. One of unicast or multicast.
ttl 1 The time-to-live of the UDP packets for the announced metrics.
uuid (none) The UUID to tag announced metrics with.
spoof (none) The hostname and port to use instead of this nodes for the announced metrics. In the format hostname:port.
tmax 60 The tmax value to annouce metrics with.
dmax 0 The dmax value to announce metrics with.

Graphite Reporter

Reports metrics periodically to Graphite.

Extends the attributes that are available to all reporters

metrics:
  reporters:
    - type: graphite
      host: localhost
      port: 8080
      prefix: <prefix>
Name Default Description
host localhost The hostname of the Graphite server to report to.
port 8080 The port of the Graphite server to report to.
prefix (none) The prefix for Metric key names to report to Graphite.

SLF4J

Reports metrics periodically by logging via SLF4J.

Extends the attributes that are available to all reporters

See BaseReporterFactory and BaseFormattedReporterFactory for more options.

metrics:
  reporters:
    - type: log
      logger: metrics
      markerName: <marker name>
Name Default Description
logger metrics The name of the logger to write metrics to.
markerName (none) The name of the marker to mark logged metrics with.