Updated on 2024-11-21 GMT+08:00

Logstash Configuration Description

The data collector Logstash for tenant-side collection is customized by SecMaster. In different transmission scenarios, you can adjust parameter settings to obtain an optimal performance. This topic mainly covers how to tune log4j2.properties and jvm.options.

JVM Running Memory Configuration

Figure 1 jvm.options
Table 1 JVM running memory configuration

Parameter

Configuration Type

Default Value

Description

-Djava.awt.headless

boolean

true

Server side configuration. If it is set to "true", you can run an application in headless mode (without a keyboard or display). This parameter is used for data related services.

-XX:+UseConcMarkSweepGC

boolean

false

Concurrent Mark Sweep (CMS) garbage collector for the old generation.

-Xmn

String

1024M

The size of the heap for the young generation. If the collection pressure is high, adjust this value. The larger the heap size for the young generation, the smaller the number of garbage collection times, and the higher the collection efficiency. Xmn must be smaller than Xmx.

-Xmx

String

2048M

The total (maximum) heap size. A proper Xmx can prevent JVM from using excessive system resources to keep the application available and stable. If this parameter is set to a very small value, the collector will start garbage collection over and over again. This will affect collector performance.

-Djruby.jit.threshold

number

0

The specified method invocation count. When this threshold is reached, the JIT compiler of JRuby attempts to compile the local code of the method. You can adjust this value to obtain an optimal balance between startup time (compilation cost) and execution time performance

-XX:CMSInitiatingOccupancyFraction

number

75

CMS garbage collector. When the old generation usage reaches 75%, CMS garbage collection is triggered.

-Xms

String

20248M

The initial Java heap size. When JVM starts, it attempts to allocate the specified amount of memory to the heap. A proper initial heap size will free you from frequent heap size adjustments while the application is running.

log4j2 log configuration

Figure 2 log4j2.properties
Table 2 log4j2 log configuration

Parameter

Configuration Type

Default Value

Description

appender.json_console_slowlog.layout.compact

boolean

true

JSON slow query log output.

appender.json_console_slowlog.layout.type

String

JSONLayout

Layout type of JSON slow query logs. Retain the default value.

appender.json_console_slowlog.type

String

Console

Type of JSON slow query logs. Default value: Console, which means that logs are directly displayed on the console.

appender.json_console_slowlog.layout.eventEol

boolean

true

JSON slow query log output.

appender.json_console_slowlog.name

String

json_console_slowlog

Name of the JSON slow query log. Retain the default value.