Skip to main content

Configure Logging with ClusterNest Managed OpenSearch

Set up centralized logging with Fluent Bit and ClusterNest Managed OpenSearch: provision a cluster via the Console or Terraform, forward logs with Fluent Bit, and visualize them in OpenSearch Dashboards.

Log in to ClusterNest Console. Navigate to OpenSearch from the Services section and launch a cluster.

  • Enter a unique name for your OpenSearch cluster.
  • Select a performance tier based on resource needs: Basic, Standard, or Advanced.
  • Choose the required OpenSearch version (optional).
  • Click Create Cluster to deploy.

Save the credentials securely for configuration and accessing OpenSearch Dashboards later.

Index Template

After the cluster is available, open OpenSearch Dashboards from the cluster details page. Log in using the saved credentials.

From the left sidebar, navigate to Stack Management > Index Management > Templates. Create a new index template named fluent-bit with the following settings:

  • Index patterns: fluent-bit-*
  • Priority: 1
  • Number of shards: 1
  • Number of replicas: 1
  • Click Create template to save.

Fluent Bit

Create/Edit fluent-bit.conf

[SERVICE]
Flush 5
Log_Level info
Parsers_File parsers.conf
[INPUT]
Name tail
Path <logs_path>/*.log
Tag *
[OUTPUT]
Name opensearch
Match *
Port 443
tls On
Host <CLUSTER_HOST>
HTTP_User <CLUSTER_USERNAME>
HTTP_Passwd <CLUSTER_PASSWORD>
Logstash_Format On
Logstash_Prefix fluent-bit
Replace_Dots On
Retry_Limit False
Suppress_Type_Name On

Fill in <CLUSTER_HOST>, <CLUSTER_USERNAME>, and <CLUSTER_PASSWORD> from the Terraform outputs above.

Create/Edit parsers.conf

[PARSER]
Name cri
Format regex
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<log>.*)$
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L%z

Save the config and run:

  • sudo systemctl enable --now fluent-bit
  • sudo systemctl status fluent-bit

Run the following to generate a sample log and verify ingestion:

echo "Test log entry" | sudo tee -a <logs_path>/test.log
sudo journalctl -u fluent-bit -n 5

Verify

sudo systemctl is-enabled fluent-bit

This should return: enabled

Dashboard

Open OpenSearch Dashboards. From the left sidebar, navigate to Discover. Create an index pattern using fluent-bit-*. You should start seeing logs in Discover.

Once verified, you have a complete centralized logging setup powered by Fluent Bit and ClusterNest Managed OpenSearch.

Debugging

For debugging Fluent Bit, update config-map.yaml

Add

[OUTPUT]
Name stdout
Match *

Update

[SERVICE]
Log_Level debug

For Linux, run

sudo journalctl -u fluent-bit

Args in DaemonSet

args: ["-c", "/fluent-bit/etc/fluent-bit.conf", "-v", "--trace-input","--trace-output"]

Retention Policy

Fluent Bit creates a new fluent-bit-* index every day, so without cleanup they grow indefinitely. Set up an Index State Management (ISM) policy to delete old indices automatically.

Open Dev Tools from the left sidebar and run:

PUT _plugins/_ism/policies/fluent-bit-retention
{
"policy": {
"description": "Delete fluent-bit logs after 7 days",
"default_state": "hot",
"states": [
{
"name": "hot",
"actions": [],
"transitions": [
{ "state_name": "delete", "conditions": { "min_index_age": "7d" } }
]
},
{
"name": "delete",
"actions": [{ "delete": {} }],
"transitions": []
}
],
"ism_template": [
{ "index_patterns": ["fluent-bit-*"], "priority": 100 }
]
}
}

The ism_template field attaches the policy to every index matching fluent-bit-*, including ones created after the policy exists. Adjust min_index_age to your preferred retention.