Module metrics.logs

ballerinax/metrics.logs Ballerina library

1.1.0

Package Overview

The Metrics Logs Observability Extension is used to enable Ballerina metrics logs to be observed by OpenSearch.

Enabling Metrics Logs Extension

To package the metrics logs extension into the Jar, follow the following steps.

  1. Add the following import to your program.
Copy
import ballerinax/metrics.logs as _;
  1. Add the following to the Ballerina.toml when building your program.
Copy
[package]
org = "my_org"
name = "my_package"
version = "1.0.0"

[build-options]
observabilityIncluded=true

To enable the extension and publish metrics logs to OpenSearch, add the following to the Config.toml when running your program.

Copy
[ballerina.observe]
metricsLogsEnabled=true

You can configure log file location, log format and log rotation in the Config.toml.

Copy
[ballerinax.metrics.logs]
logFilePath = "<PATH_TO_LOG_FILE>"      # Optional configuration
logLevel = "INFO"                       # Optional configuration. Possible values: "DEBUG", "INFO", "WARN", "ERROR"
logFormat = "logfmt"                    # Optional configuration. Possible values: "logfmt", "json"
enableLogRotation = false               # Optional configuration. Possible values: true, false

[ballerinax.metrics.logs.rotation]      # Optional configuration. Applies only when logFilePath is set
policy = "BOTH"                         # SIZE_BASED, TIME_BASED, or BOTH
maxFileSize = 10485760                  # 10MB in bytes
maxAge = 86400                          # 24 hours in seconds
maxBackupFiles = 7                      # Keep 7 backup files

Import

import ballerinax/metrics.logs;Copy

Other versions

Metadata

Released date: 10 days ago

Version: 1.1.0


Compatibility

Platform: any

Ballerina version: 2201.13.0

GraalVM compatible: Yes


Pull count

Total: 390

Current verison: 9


Weekly downloads