Sentinel provides the following ways to configure the common items:

  • JVM -D parameter
  • properties file (since 1.7.0)

The project.name item should be configured with JVM -D parameter, while other items support both approaches.

Users can configure the path of the properties file via the -Dcsp.sentinel.config.file property item, which also supports files in classpath (such as classpath:sentinel.properties). Sentinel will attempt to read the configuration from the classpath:sentinel.properties file (the default charset is UTF-8).

Note: If you’re using Spring Boot or Spring Cloud, you may leverage Spring Cloud Alibaba Sentinel to provide Sentinel configuration in your Spring config file directly.

Sentinel Core

Basic configuration items

ItemDescriptionTypeDefault ValueRequiredNotes
project.nameThe name of your microserviceStringnullnoIt’s recommended to provide the name.
csp.sentinel.app.typeThe type of your microserviceint0 (APP_TYPE_COMMON)nointroduced since 1.6.0
csp.sentinel.metric.file.single.sizeThe max size of single metric log filelong52428800 (50MB)no
csp.sentinel.metric.file.total.countThe max amount of metric log filesint6no
csp.sentinel.statistic.max.rtMaximum allowed response time (in ms). If exceeding this value, it will be recorded as this value.int4900nointroduced since 1.4.1
csp.sentinel.spi.classloaderThe SPI classloader mechanismStringdefaultnoIf the value is context, then Sentinel will use the thread context classloader as the SPI classloader.

Logging configuration items

ItemDescriptionTypeDefault ValueRequiredNotes
csp.sentinel.log.dirThe log directoryString${user.home}/logs/csp/nointroduced since 1.3.0
csp.sentinel.log.use.pidWhether the log files include the process IDbooleanfalsenointroduced since 1.3.0
csp.sentinel.log.output.typeThe output destination of the record logs (console for the terminal, file for the file)Stringfilenointroduced since 1.6.2