---
title: "Wildfly integration | Grafana Cloud documentation"
description: "Learn about Wildfly Grafana Cloud integration."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Wildfly integration for Grafana Cloud

Wildfly is a modular &amp; lightweight application server that handles deploying and managing several Java applications. The Wildfly integration uses Grafana Alloy to collect metrics and logs for monitoring a Wildfly instance. Including metrics for monitoring sessions, deployments, network traffic, and datasource connections. This also includes monitoring server log files of a Wildfly instance which provides valuable information for usage and operations of the instance.

This integration supports Wildfly 27.X onwards.

This integration includes 2 useful alerts and 3 pre-built dashboards to help monitor and visualize Wildfly metrics and logs.

## Before you begin

In order to collect metrics from Wildfly, ensure the metric subsystem is enabled by following the [WildFly Admin Guide (Metrics subsystem)](https://docs.wildfly.org/39/Admin_Guide.html#metrics-metrics-http-endpoint).

To enable session metrics, run the following command in the CLI:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
/subsystem=undertow:write-attribute(name=statistics-enabled,value=true)
```

To enable transaction metrics, run the following command in the CLI:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
/subsystem=transactions:write-attribute(name=statistics-enabled, value=true)
```

Wildfly has authentication enabled by default (for Wildfly management interfaces). This includes a simple username and password from an established user. To setup a user, simply run the `add-user.sh` script inside the Wildfly installation’s `bin` folder. Once script is complete, add your new `<wildfly_user>` and `<wildfly_password>` to the username and password fields underneath `basic_auth`. However, in the case that Wildlfly authentication is not enabled, `basic_auth` may need to be removed in your metrics config.

More info on user creation can be found in the [Getting Started Guide — Managing your WildFly instance](https://docs.wildfly.org/39/Getting_Started_Guide.html#managing-your-wildfly-10).

The CLI is launched using `jboss-cli.sh` or `jboss-cli.bat` located in the WildFly `bin` directory. For more information on the default directory layout, see [Getting Started Guide — WildFly directory structure](https://docs.wildfly.org/39/Getting_Started_Guide.html#wildfly-directory-structure).

Next, connect to the WildFly instance. This is done by running `connect` command.

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
./bin/jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server
or 'help' for the list of supported commands.
[disconnected /]

[disconnected /] connect
[domain@localhost:9990 /]

[domain@localhost:9990 /] quit
Closed connection to localhost:9990
```

To terminate the session type `quit`.

## Install Wildfly integration for Grafana Cloud

1. In your Grafana Cloud stack, click **Connections** in the left-hand menu.
2. Find **Wildfly** and click its tile to open the integration.
3. Review the prerequisites in the **Configuration Details** tab and set up Grafana Alloy to send Wildfly metrics and logs to your Grafana Cloud instance.
4. Click **Install** to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your Wildfly setup.

## Configuration snippets for Grafana Alloy

### Simple mode

These snippets are configured to scrape a single Wildfly instance running locally with default ports.

First, **manually** copy and append the following snippets into your alloy configuration file.

### Logs snippets

#### darwin

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_wildfly" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/opt/wildfly/standalone/log/server.log",
		instance    = constants.hostname,
		job         = "integrations/wildfly",
	}]
}

loki.process "logs_integrations_integrations_wildfly" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "\\d+-\\d+-\\d+ \\d+:\\d+:\\d+,\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

loki.source.file "logs_integrations_integrations_wildfly" {
	targets    = local.file_match.logs_integrations_integrations_wildfly.targets
	forward_to = [loki.process.logs_integrations_integrations_wildfly.receiver]
}
```

#### linux

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_wildfly" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/opt/wildfly/standalone/log/server.log",
		instance    = constants.hostname,
		job         = "integrations/wildfly",
	}]
}

loki.process "logs_integrations_integrations_wildfly" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "\\d+-\\d+-\\d+ \\d+:\\d+:\\d+,\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

loki.source.file "logs_integrations_integrations_wildfly" {
	targets    = local.file_match.logs_integrations_integrations_wildfly.targets
	forward_to = [loki.process.logs_integrations_integrations_wildfly.receiver]
}
```

#### windows

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_wildfly" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/opt/wildfly/standalone/log/server.log",
		instance    = constants.hostname,
		job         = "integrations/wildfly",
	}]
}

loki.process "logs_integrations_integrations_wildfly" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "\\d+-\\d+-\\d+ \\d+:\\d+:\\d+,\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

loki.source.file "logs_integrations_integrations_wildfly" {
	targets    = local.file_match.logs_integrations_integrations_wildfly.targets
	forward_to = [loki.process.logs_integrations_integrations_wildfly.receiver]
}
```

### Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your Wildfly instances, **manually** copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

### Advanced metrics snippets

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
discovery.relabel "metrics_integrations_integrations_wildfly" {
	targets = [{
		__address__ = "localhost:9990",
	}]

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}
}

prometheus.scrape "metrics_integrations_integrations_wildfly" {
	targets    = discovery.relabel.metrics_integrations_integrations_wildfly.output
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/wildfly"

	basic_auth {
		username = "<wildfly_user>"
		password = "<wildfly_password>"
	}
}
```

To monitor your Wildfly instance, you must use a [discovery.relabel](/docs/alloy/latest/reference/components/discovery.relabel/) component to discover your Wildfly Prometheus endpoint and apply appropriate labels, followed by a [prometheus.scrape](/docs/alloy/latest/reference/components/prometheus.scrape) component to scrape it.

Configure the following properties within each `discovery.relabel` component:

- `__address__`: The address to your Wildfly Prometheus metrics endpoint.
- `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Wildfly instance. Make sure this label value is the same for all telemetry data collected for this instance.

If you have multiple Wildfly servers to scrape, configure one `discovery.relabel` for each and scrape them by including each under `targets` within the `prometheus.scrape` component.

### Advanced logs snippets

#### darwin

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_wildfly" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/opt/wildfly/standalone/log/server.log",
		instance    = constants.hostname,
		job         = "integrations/wildfly",
	}]
}

loki.process "logs_integrations_integrations_wildfly" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "\\d+-\\d+-\\d+ \\d+:\\d+:\\d+,\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

loki.source.file "logs_integrations_integrations_wildfly" {
	targets    = local.file_match.logs_integrations_integrations_wildfly.targets
	forward_to = [loki.process.logs_integrations_integrations_wildfly.receiver]
}
```

To monitor your Wildfly instance logs, you will use a combination of the following components:

- [local.file\_match](/docs/alloy/latest/reference/components/local.file_match) defines where to find the log file to be scraped. Change the following properties according to your environment:
  
  - `__address__`: The Wildfly instance address
  - `__path__`: The path to the log file.
  - `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Wildfly instance. Make sure this label value is the same for all telemetry data collected for this instance.
- [loki.process](/docs/alloy/latest/reference/components/loki.process) defines how to process logs before sending it to Loki.
- [loki.source.file](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

#### linux

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_wildfly" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/opt/wildfly/standalone/log/server.log",
		instance    = constants.hostname,
		job         = "integrations/wildfly",
	}]
}

loki.process "logs_integrations_integrations_wildfly" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "\\d+-\\d+-\\d+ \\d+:\\d+:\\d+,\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

loki.source.file "logs_integrations_integrations_wildfly" {
	targets    = local.file_match.logs_integrations_integrations_wildfly.targets
	forward_to = [loki.process.logs_integrations_integrations_wildfly.receiver]
}
```

To monitor your Wildfly instance logs, you will use a combination of the following components:

- [local.file\_match](/docs/alloy/latest/reference/components/local.file_match) defines where to find the log file to be scraped. Change the following properties according to your environment:
  
  - `__address__`: The Wildfly instance address
  - `__path__`: The path to the log file.
  - `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Wildfly instance. Make sure this label value is the same for all telemetry data collected for this instance.
- [loki.process](/docs/alloy/latest/reference/components/loki.process) defines how to process logs before sending it to Loki.
- [loki.source.file](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

#### windows

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file_match "logs_integrations_integrations_wildfly" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/opt/wildfly/standalone/log/server.log",
		instance    = constants.hostname,
		job         = "integrations/wildfly",
	}]
}

loki.process "logs_integrations_integrations_wildfly" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "\\d+-\\d+-\\d+ \\d+:\\d+:\\d+,\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

loki.source.file "logs_integrations_integrations_wildfly" {
	targets    = local.file_match.logs_integrations_integrations_wildfly.targets
	forward_to = [loki.process.logs_integrations_integrations_wildfly.receiver]
}
```

To monitor your Wildfly instance logs, you will use a combination of the following components:

- [local.file\_match](/docs/alloy/latest/reference/components/local.file_match) defines where to find the log file to be scraped. Change the following properties according to your environment:
  
  - `__address__`: The Wildfly instance address
  - `__path__`: The path to the log file.
  - `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Wildfly instance. Make sure this label value is the same for all telemetry data collected for this instance.
- [loki.process](/docs/alloy/latest/reference/components/loki.process) defines how to process logs before sending it to Loki.
- [loki.source.file](/docs/alloy/latest/reference/components/loki.source.file) sends logs to Loki.

## Kubernetes instructions

Instructions for Kubernetes

### Before you begin with Kubernetes

**Please note**: These instructions assume the use of the [Kubernetes Monitoring Helm chart](https://github.com/grafana/k8s-monitoring-helm)

In order to collect metrics from Wildfly, ensure the metric subsystem is enabled by following the [WildFly Admin Guide (Metrics subsystem)](https://docs.wildfly.org/39/Admin_Guide.html#metrics-metrics-http-endpoint).

To enable session metrics, run the following command in the CLI:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
/subsystem=undertow:write-attribute(name=statistics-enabled,value=true)
```

To enable transaction metrics, run the following command in the CLI:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
/subsystem=transactions:write-attribute(name=statistics-enabled, value=true)
```

Wildfly has authentication enabled by default (for Wildfly management interfaces). This includes a simple username and password from an established user. To setup a user, simply run the `add-user.sh` script inside the Wildfly installation’s `bin` folder. Once script is complete, add your new `<wildfly_user>` and `<wildfly_password>` to the username and password fields underneath `basic_auth`. However, in the case that Wildlfly authentication is not enabled, `basic_auth` may need to be removed in your metrics config.

More info on user creation can be found in the [Getting Started Guide — Managing your WildFly instance](https://docs.wildfly.org/39/Getting_Started_Guide.html#managing-your-wildfly-10).

The CLI is launched using `jboss-cli.sh` or `jboss-cli.bat` located in the WildFly `bin` directory. For more information on the default directory layout, see [Getting Started Guide — WildFly directory structure](https://docs.wildfly.org/39/Getting_Started_Guide.html#wildfly-directory-structure).

For using the CLI you will need to use the `connect` command before any user creation or permission management:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
./bin/jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server
or 'help' for the list of supported commands.
[disconnected /]

[disconnected /] connect
[domain@localhost:9990 /]

[domain@localhost:9990 /] quit
Closed connection to localhost:9990
```

To terminate the session type `quit`.

### Configuration snippets for Kubernetes Helm chart

The following snippets provide examples to guide you through the configuration process.

To scrape your Wildfly instances, **manually** modify your Kubernetes Monitoring Helm chart with these configuration snippets.

Replace any values between the angle brackets `<>` in the provided snippets with your desired configuration values.

#### Metrics snippets

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
alloy-metrics:
    extraConfig: |-
        discovery.kubernetes "integrations_wildfly" {
            role = "endpoints"
            selectors {
                role = "service"
                field = "metadata.name=wildfly"
            }
        }
        
        prometheus.scrape "integrations_wildfly" {
            targets  = discovery.kubernetes.integrations_wildfly.targets
            job_name = "integrations/wildfly"
            basic_auth {
                username = "<wildfly_user>"
                password = "<wildfly_password>"
            }
            forward_to = [prometheus.remote_write.grafana_cloud_metrics.receiver]
        }
```

#### Logs snippets

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
podLogs:
    extraDiscoveryRules: |-
        rule {
            source_labels = ["__meta_kubernetes_namespace", "__meta_kubernetes_pod_name"]
            separator     = ":"
            regex         = "(<wildfly_namespace>:wildfly.*)"
            replacement   = "wildfly"
            target_label  = "integration"
        }

        rule {
            source_labels = ["integration", "__meta_kubernetes_pod_ip","__meta_kubernetes_pod_container_port_number"]
            separator = ":"
            regex = "wildfly:(.*:.*)"
            target_label = "instance"
        }
        
        rule {
            source_labels = ["integration", "__meta_kubernetes_pod_node_name"]
            separator = ":"
            regex = "wildfly:(.*)"
            target_label = "host"
        }
        
        rule {
            source_labels = ["integration"]
            regex = "wildfly"
            replacement = "integrations/wildfly"
            target_label = "job"
        }
        
        rule {
            source_labels = ["integration"]
            regex = "wildfly"
            replacement = "wildfly"
            target_label = "log_type"
        }
        
    extraLogProcessingStages: |-
        stage.match {
            selector = "{integration=\\"wildfly\\"}"

            stage.multiline {
                firstline = "\\\\\\\\d+:\\\\\\\\d+:\\\\\\\\d+,\\\\\\\\d+"
                max_lines     = 0
                max_wait_time = "3s"
            }
        }
```

## Dashboards

The Wildfly integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

- Wildfly datasource
- Wildfly logs
- Wildfly overview

**Wildfly overview**

**Wildfly logs**

**Wildfly datasource**

## Alerts

The Wildfly integration includes the following useful alerts:

Expand table

| Alert                             | Description                                                             |
|-----------------------------------|-------------------------------------------------------------------------|
| HighPercentageOfErrorResponses    | Critical: Large percentage of requests are resulting in 5XX responses.  |
| HighRejectedSessionsForDeployment | Critical: Large number of sessions are being rejected for a deployment. |

## Metrics

The most important metrics provided by the Wildfly integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

- up
- wildfly\_batch\_jberet\_active\_count
- wildfly\_datasources\_pool\_idle\_count
- wildfly\_datasources\_pool\_in\_use\_count
- wildfly\_transactions\_number\_of\_aborted\_transactions\_total
- wildfly\_transactions\_number\_of\_inflight\_transactions
- wildfly\_transactions\_number\_of\_transactions\_total
- wildfly\_undertow\_active\_sessions
- wildfly\_undertow\_bytes\_received\_total\_bytes
- wildfly\_undertow\_bytes\_sent\_total\_bytes
- wildfly\_undertow\_error\_count\_total
- wildfly\_undertow\_expired\_sessions\_total
- wildfly\_undertow\_rejected\_sessions\_total
- wildfly\_undertow\_request\_count\_total

## Changelog

md ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```md
# 1.1.0 - April 2026

* Updated dashboards to follow new stylistic standards
* Renamed alert `HighNumberOfRejectedSessionsForDeployment` to `HighRejectedSessionsForDeployment` — update any silences, routing rules, or notification policies that reference the old name 

# 1.0.0 - May 2024

* Added cluster selector to dashboards for kubernetes support

# 0.0.3 - September 2023

* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.

# 0.0.2 - August 2023

* Add regex filter for logs datasource

# 0.0.1 - April 2023

- Initial release
```

## Cost

By connecting your Wildfly instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see [Active series and dpm usage](/docs/grafana-cloud/fundamentals/active-series-and-dpm/) and [Cloud tier pricing](/products/cloud/pricing/).
