Skip to content

Commit

Permalink
GDB-7986: Review notes
Browse files Browse the repository at this point in the history
- Removed the default logback XML configuration and configmap in favor of an [example](examples/custom-logback) and a new configuration options
  under `logging.logback`
- Configmaps from `graphdb.configs` are now under `extraConfiguration`, `repositories` and `initialConfiguration` with a different structure allowing
  better reuse of existing configmaps
- Existing configmaps for `logging.logback` and `extraConfiguration.properties` are now templated
  • Loading branch information
mihailradkov committed Apr 11, 2024
1 parent 0a21342 commit 4b85bab
Show file tree
Hide file tree
Showing 19 changed files with 315 additions and 239 deletions.
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ TODO: decide how detailed we want this to be
- Removed setting FQDN as hostnames in GraphDB and the proxy in favor of dynamically resolving and configuring the hostnames in the init containers
- Renamed `messageSize` to `messageSizeKB` in the cluster creation configuration
- Renamed `java_args` to `javaArguments`
- Removed the default logback XML configuration and configmap in favor of an [example](examples/custom-logback) and a new configuration options
under `logging.logback`
- Removed `global.storageClass` in favor of using by default the default storage class in the cluster. Templates will no longer
use `global.storageClass`.
- Updated the GraphDB deployment URL to be http://graphdb.127.0.0.1.nip.io/ by default
Expand All @@ -25,8 +27,8 @@ TODO: decide how detailed we want this to be
- Moved all proxy configurations from `graphdb.clusterProxy` to just `proxy`
- Renamed `proxy.persistence.enablePersistence` toggle to just `enabled`
- Moved `proxy.serviceType` to `proxy.service.type`
- Configmaps from `graphdb.configs` are now under `configuration`, `repositories` and `security` with a different structure allowing better reuse
of existing configmaps
- Configmaps from `graphdb.configs` are now under `extraConfiguration`, `repositories` and `initialConfiguration` with a different structure allowing
better reuse of existing configmaps
- Moved job related configurations from `graphdb` (e.g. `graphdb.jobResources`) to a new root section `jobs`
- Moved `images.graphdb` configurations to just `image`
- Moved `deployment.imagePullPolicy` to `image.pullPolicy` and `deployment.imagePullSecret` to `image.pullSecrets`
Expand All @@ -52,12 +54,12 @@ TODO: decide how detailed we want this to be
- Added `image.sha` to optionally provide an expected SHA checksum of the image
- Added `persistence.enabled` toggle flag for enabling or disabling the persistence of GraphDB
- Added new configuration options for the default ingress `ingress`:
- Ability to override the `host` and `path` for GraphDB from `configuration.host` and `configuration.path`
- Changing the `pathType`
- Ability to override the `host` and `path` for GraphDB from `configuration.host` and `configuration.path`
- Changing the `pathType`
- Inserting additional hosts and TLS configurations with `extraHosts` and `extraTLS`
- Added `labels` for each service resource for insertion of additional labels
- Added `labels` for each service resource for insertion of additional labels
- Added `containerPorts` and `proxy.containerPorts` for mapping the ports on which GraphDB listens on
- Added `ports` mappings in each service
- Added `ports` mappings in each service
- Added `extraContainerPorts` and `proxy.extraContainerPorts`
- Added `imagePullPolicy` to the jobs containers
- Added feature toggles
Expand All @@ -70,11 +72,12 @@ TODO: decide how detailed we want this to be

### Updates

- GraphDB properties and logback configuration configmaps are now applied by default
- GraphDB properties configmap is now applied by default
- Values in `labels`, `annotations` and `imagePullSecrets` are now evaluated as templates
- Removed unused busybox image configurations from `images.busybox`
- Service resources and probes now refer to the target ports by their nicknames
- Renamed the port mappings of GraphDB and GraphDB proxy to `http` and `rpc`
- Existing configmaps for `logging.logback` and `extraConfiguration.properties` are now templated

## Version 10.6.0-R2

Expand Down
26 changes: 26 additions & 0 deletions examples/custom-logback/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# GraphDB with Custom Logback Configuration

GraphDB comes with a pre-configured Logback XML using sensible configuration defaults.
However, for certain use cases, it might need to be finely tuned.

This example shows how to use a custom Logback XML configuration with GraphDB's Helm chart.

## Usage

1. Customize [configmap-logback.yaml](configmap-logback.yaml) according to your needs and apply:

```bash
kubecttl apply -f configmap-logback.yaml
```
2. Configure the Helm chart to use the custom ConfigMap in [values.yaml](values.yaml)

```yaml
logging:
logback:
existingConfigmap: "graphdb-custom-logback-config"
```
3. Deploy the Helm chart with the custom configurations
```bash
helm upgrade --install --values values.yaml graphdb-logback ../../
```
194 changes: 194 additions & 0 deletions examples/custom-logback/configmap-logback.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: graphdb-custom-logback-config
data:
logback.xml: |-
<configuration debug="false" scan="true" scanPeriod="30 seconds">
<jmxConfigurator/>
<!-- Try to guess the logs destination based on the application server or fallback to a default logs directory(embedded mode)
NOTE: We are using a really old version of logback so we have to use p().isEmpty instead of isDefined -->
<if condition='p("logDestinationDirectory").isEmpty()'>
<then>
<!-- catalina.base if we are running on tomcat -->
<if condition='!p("catalina.base").isEmpty()'>
<then>
<property name="logDestinationDirectory" value="${catalina.base}/logs/graphdb"/>
</then>
<else>
<!-- jetty.base if we are running on tomcat -->
<if condition='!p("jetty.base").isEmpty()'>
<then>
<property name="logDestinationDirectory" value="${jetty.base}/logs/graphdb"/>
</then>
<else>
<!-- we are running in embedded mode -->
<property name="logDestinationDirectory" value="logs"/>
</else>
</if>
</else>
</if>
</then>
</if>
<property name="defaultPattern" value="[%-5p] %d{ISO8601} [%t | %c{5}]%X{headers} %m%n%ex"/>
<property name="encoding" value="UTF-8"/>
<!-- Properties for log keeping based on age and size. By default logs will be kept for 30 days with no size limit-->
<!-- Sets the maximum age of kept logs in days. Set to 0 for no limit -->
<property name="keepLogDays" value="30"/>
<!-- Sets the maximum size of every log kept. Accepts values like 500KB, 200MB, 1GB etc. Set to 0 for no limit
NOTE: This sets the size limit per each different log type. If you want more control change the totalSizeCap of each log separately-->
<property name="logMaxSize" value="0"/>
<!-- This attribute sets the maximum size that an individual log file can reach before Logback triggers a rollover.
When a log file surpasses this size, a new log file is created, and the old one may be archived, compressed, or otherwise handled based on the rolling policy. -->
<property name="maxFileSize" value="1GB"/>
<!-- Audit log. Contains security related things -->
<appender name="AuditLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDestinationDirectory}/audit.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logDestinationDirectory}/audit-%d{yyyy-MM}/audit-%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
<maxFileSize>${maxFileSize}</maxFileSize>
<maxHistory>${keepLogDays}</maxHistory>
<totalSizeCap>${logMaxSize}</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<pattern>${defaultPattern}</pattern>
<charset>${encoding}</charset>
</encoder>
</appender>
<appender name="MainLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDestinationDirectory}/main.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logDestinationDirectory}/main-%d{yyyy-MM}/main-%d{yyyy-MM-dd}.%i.zip
</fileNamePattern>
<maxFileSize>${maxFileSize}</maxFileSize>
<maxHistory>${keepLogDays}</maxHistory>
<totalSizeCap>${logMaxSize}</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<pattern>${defaultPattern}</pattern>
<charset>${encoding}
</charset>
</encoder>
</appender>
<appender name="ErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDestinationDirectory}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logDestinationDirectory}/errors-%d{yyyy-MM}/error-%d{yyyy-MM-dd}.%i.zip
</fileNamePattern>
<maxFileSize>${maxFileSize}</maxFileSize>
<maxHistory>${keepLogDays}</maxHistory>
<totalSizeCap>${logMaxSize}</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<pattern>${defaultPattern}</pattern>
<charset>${encoding}</charset>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<appender name="QueryLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDestinationDirectory}/query.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logDestinationDirectory}/queries-%d{yyyy-MM}/query-%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
<maxFileSize>${maxFileSize}</maxFileSize>
<maxHistory>${keepLogDays}</maxHistory>
<totalSizeCap>${logMaxSize}</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<pattern>${defaultPattern}</pattern>
<charset>${encoding}</charset>
</encoder>
</appender>
<appender name="SlowQueryLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDestinationDirectory}/slow-query.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logDestinationDirectory}/slow-queries-%d{yyyy-MM}/slow-query-%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
<maxFileSize>${maxFileSize}</maxFileSize>
<maxHistory>${keepLogDays}</maxHistory>
<totalSizeCap>${logMaxSize}</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<pattern>${defaultPattern}</pattern>
<charset>${encoding}</charset>
</encoder>
</appender>
<if condition='!p("graphdb.foreground").isEmpty()'>
<then>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${defaultPattern}</pattern>
</encoder>
</appender>
</then>
</if>
<!-- Log all repository, user creations, modifications and deletions. Also logs successful or not attempts to
login into system. Updates, queries and imports to repository. Set to "INFO" level for logging all former updates.
Will log exceptions on "ERROR" level. Additivity is set to "false" and called first to prevent the messages
from cluttering the other logs. -->
<logger name="com.ontotext.forest.security.audit.AuditLoggingFilter" level="INFO" additivity="false">
<appender-ref ref="AuditLog"/>
</logger>
<!-- Log update operations on workers. Set to "INFO" level by default for logging all updates in workers' QueryLog.
Will log exceptions on "ERROR" level. Additivity is set to "false" and called first to prevent the messages
from cluttering the other logs.-->
<logger name="com.ontotext.trree.monitorRepository.MonitorRepositoryConnection" level="INFO" additivity="false">
<appender-ref ref="QueryLog"/>
</logger>
<!-- Log querry operations on the repository. Set to "DEBUG" level for logging all querries. Will log exceptions on "ERROR"
level. Additivity is set to "false" to prevent the messages from cluttering the other logs. -->
<logger name="com.ontotext.trree.query.LoggingClosableIteration" level="INFO" additivity="false">
<appender-ref ref="QueryLog"/>
</logger>
<!-- Log slow queries on "INFO" level. Queries are deemed "slow" if they take more than "SlowOpThresholdMs" from the
RepositorySettings property. Set the level to "OFF" to stop this log. Additivity is set to "false" to prevent the messages
from cluttering the other logs. -->
<logger name="slow-queries" level="INFO" additivity="false">
<appender-ref ref="SlowQueryLog"/>
</logger>
<root>
<level value="${graphdb.logger.root.level:-DEBUG}"/>
<appender-ref ref="MainLog"/>
<appender-ref ref="ErrorLog"/>
<if condition='!p("graphdb.foreground").isEmpty()'>
<then>
<appender-ref ref="STDOUT"/>
</then>
</if>
</root>
<!-- Make some of the more verbose loggers less chatty -->
<logger name="org.springframework" level="WARN"/>
<logger name="org.apache" level="WARN"/>
<logger name="com.github.ziplet" level="WARN"/>
<logger name="springfox.documentation" level="WARN"/>
<logger name="org.eclipse.rdf4j.query.algebra.evaluation" level="ERROR"/>
<!-- GeoSPAQRL related deps be less verbose -->
<logger name="hsqldb.*" level="WARN"/>
<logger name="org.geotoolkit.*" level="WARN"/>
<!-- SemanticVectors related logger be less verbose -->
<logger name="pitt.search.semanticvectors.DocVectors" level="WARN"/>
</configuration>
4 changes: 4 additions & 0 deletions examples/custom-logback/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
logging:
logback:
existingConfigmap: "graphdb-custom-logback-config"
configmapKey: "logback.xml"
Loading

0 comments on commit 4b85bab

Please sign in to comment.