Skip to content

Conversation

@mgtm98
Copy link
Collaborator

@mgtm98 mgtm98 commented Jan 29, 2026

Description

To enable elastic search logging you need to add the following in the toml file

[plugins.scale.logging]
type = "elasticsearch"

[plugins.scale.logging.elasticsearch]
enabled = true
hosts = "<elastic search engine path>"
bulk_size = 100

# Option1: Authenticate using username/password
username = ""
password = ""

# Option2: Authenticate using API key
api_key = ""

# Option3: No authentication at all

Authentication

Configuration Options

Option Type Default Description
type string "standard" Logger type: "standard" (console) or "elasticsearch"
enabled bool false Enable Elasticsearch logging
hosts string "localhost:9200" Elasticsearch hosts (comma-separated for multiple)
index_prefix string "jac-scale" Prefix for log indices (creates {prefix}-YYYY.MM.DD)
username string "" Username for basic authentication
password string "" Password for basic authentication
api_key string "" API key (preferred over username/password)
bulk_size int 100 Number of logs to buffer before sending

Authentication Priority

When multiple auth methods are configured:

  1. API Key (if provided) - Takes precedence
  2. Username + Password (if provided)
  3. No Auth (if neither provided)

Log Structure

Each log entry is automatically enriched:

{
  "@timestamp": "2024-01-29T10:15:30.123Z",
  "level": "ERROR",
  "message": "Payment processing failed",
  "pod_name": "jac-scale-api-7d4f-abc",
  "namespace": "production",
  "service_name": "jac-scale-api",
  "user_id": 123,
  "transaction_id": "txn-789",
  "amount": 99.99,
  "error_code": "INSUFFICIENT_FUNDS"
}

Fields automatically added:

  • @timestamp - ISO 8601 timestamp
  • level - Log level (INFO, ERROR, WARN, DEBUG)
  • message - Your log message
  • pod_name - From $HOSTNAME env var (Kubernetes pod name)
  • namespace - From $POD_NAMESPACE env var
  • service_name - From $SERVICE_NAME env var

Plus any custom fields you provide in the context dict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant