Skip to content

Log Management#

Logging for Janssen Server modules is managed at the individual module level. Meaning there is no single switch or configuration that will enable or disable logs for all modules. Each module can be individually configured and can be configured differently when it comes to logging.

Logging for jans-auth service is what we are going to discuss in detail in this document. Logging for other modules is configured by changing the module's property values. Use the documentation on how to update configuration properties for corresponding modules to update logging related properties. For instance:

Log Configuration For jans-auth#

Use the command line to perform actions from the terminal. Learn how to use Jans CLI here or jump straight to the Using Command Line

Use a fully functional text-based user interface from the terminal. Learn how to use Jans Text-based UI (TUI) here or jump straight to the Using-text-based-ui

Use REST API for programmatic access or invoke via tools like CURL or Postman. Learn how to use Janssen Server Config API here or Jump straight to the Using Configuration REST API

Using Command Line#

In the Janssen Server, you can deploy and customize the Logging Configuration using the command line. To get the details of Janssen command line operations relevant to Logging configuration, you can check the operations under ConfigurationLogging task using the command below:

Command
/opt/jans/jans-cli/config-cli.py --info ConfigurationLogging
Sample Output
Operation ID: get-config-logging
  Description: Returns Jans Authorization Server logging settings
Operation ID: put-config-logging
  Description: Updates Jans Authorization Server logging settings
  Schema: Logging

To get sample schema type /opt/jans/jans-cli/config-cli.py --schema <schema>, for example /opt/jans/jans-cli/config-cli.py --schema Logging

Find Logging Configuration#

Command
/opt/jans/jans-cli/config-cli.py --operation-id get-config-logging
Sample Output
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "loggingLevel": "DEBUG",
  "loggingLayout": "string",
  "httpLoggingEnabled": true,
  "disableJdkLogger": true,
  "enabledOAuthAuditLogging": true,
  "externalLoggerConfiguration": "string",
  "httpLoggingExcludePaths": [
    "string"
  ]
}

Update Logging Configuration#

To update logging configuration, get the schema first:

Command
/opt/jans/jans-cli/config-cli.py --schema Logging > /tmp/log-config.json
The schema can now be found in the log-config.json file.

For your information, you can obtain the format of the Logging schema by running the aforementioned command without a file.

Schema Format
loggingLevel                  string
loggingLayout                 string
httpLoggingEnabled            boolean
disableJdkLogger              boolean
enabledOAuthAuditLogging      boolean
externalLoggerConfiguration   string
httpLoggingExcludePaths       array of string
                              uniqueItems: True

you can also use the following command for Logging schema example.

Command
/opt/jans/jans-cli/config-cli.py --schema-sample Logging
Schema Example
{
  "loggingLevel": "string",
  "loggingLayout": "string",
  "httpLoggingEnabled": true,
  "disableJdkLogger": false,
  "enabledOAuthAuditLogging": true,
  "externalLoggerConfiguration": "string",
  "httpLoggingExcludePaths": [
    "string"
  ]
}

let's update the schema:

Command
nano /tmp/log-config.json

As seen below, I have added loggingLevel for the value INFO and enabledOAuditLogging for the value false.

Input
{
  "loggingLevel": "INFO",
  "loggingLayout": "string",
  "httpLoggingEnabled": true,
  "disableJdkLogger": true,
  "enabledOAuthAuditLogging": false,
  "externalLoggerConfiguration": "string",
  "httpLoggingExcludePaths": [
    "string"
  ]
}

Let's do the operation:

Command
/opt/jans/jans-cli/config-cli.py --operation-id put-config-logging \
 --data /tmp/log-config.json

You will get the updated result as below:

Sample Output
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "loggingLevel": "INFO",
  "loggingLayout": "string",
  "httpLoggingEnabled": true,
  "disableJdkLogger": true,
  "enabledOAuthAuditLogging": false,
  "externalLoggerConfiguration": "string",
  "httpLoggingExcludePaths": [
    "string"
  ]
}

Using-text-based-ui#

In Janssen, You can manage Logging configuration using the Text-Based UI also.

You can start TUI using the command below:

Command
sudo /opt/jans/jans-cli/jans_cli_tui.py

Logging Screen#

  • Navigate to Auth Server -> Logging to open the Logging screen as shown in the image below.

  • Logging screen allows the administrator to set logging parameters as per the requirements.

image

Using Configuration REST API#

Janssen Server Configuration REST API exposes relevant endpoints for managing and configuring logging. Endpoint details are published in the Swagger document.

Default Log Location#

On a VM installation, logs for jans-auth module are generated at /opt/jans/jetty/jans-auth/logs/.

Cloud-Native Deployments#

Logging configuration for a cloud-native deployment is detailed here


Last update: 2024-06-27
Created: 2021-04-22