Land Oracle WebLogic Server logs to Elasticsearch and Kibana

This page documents how to configure an existing deployment of Oracle WebLogic Server to land logs to Elasticsearch and Kibana using Azure CLI.

Prerequisites

Environment for Setup

WebLogic Server Instance

The ELK ARM template will be applied to an existing Oracle WebLogic Server instance. If you don’t have one, please create a new instance from the Azure portal, by following the link to the offer in the index.

Virtual machine size requirement

Ensure the virtual machines that have been deployed have at least 2.5GB of memory. The default virtual machine size for WLS does not have enough memory. Use at least Standard_A2_v2.

Elasticsearch instance

Refer to Create an an Elastic on Azure instance

Prepare the Parameters JSON file

You must construct a parameters JSON file containing the parameters to the ELK ARM template. See Create Resource Manager parameter file for background information about parameter files.

We must specify the information of the existing Oracle WebLogic Server and Elasticsearch instance. This section shows how to obtain the values for the following required properties.

Parameter Name Explanation
_artifactsLocation See below for details.
adminVMName Virtual machine name of which hosts the Oracle WebLogic Server admin server.
elasticsearchEndpoint The Elasticsearch endpoint.
elasticsearchPassword Password for the Elasticsearch account.
elasticsearchUserName User name for the Elasticsearch account.
location Must be the same region into which the server was initially deployed.
logsToIntegrate Specify the WebLogic logs to export to Elasticsearch, you must select at least one log.
managedServerPrefix Must be the same prefix with which the cluster was initially deployed.
maxDynamicClusterSize Must be the same value with which the cluster was initially deployed.
numberOfManagedApplicationInstances Number of VMs that have been deployed to host managed application server.
numberOfManagedCacheInstances Number of VMs that have been deployed to host managed cache server, please set the value if your cluster is Coherence cluster.
wlsDomainName Must be the same value provided at initial deployment time.
wlsPassword Must be the same value provided at initial deployment time.
wlsUserName Must be the same value provided at initial deployment time.

_artifactsLocation

This value must be the following.

https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/

Number of Managed application instances

You can get the existing Managed application instances number with the following command using Azure CLI.

$ resourceGroup=<your-resource-group>
$ managedServerPrefix=<managed-server-prefix>
$ numberOfManagedApplicationInstances=$(az resource list -g ${resourceGroup} --resource-type Microsoft.Compute/virtualMachines --query [*].name | grep "${managedServerPrefix}VM[0-9]" | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g' | tr -s ' ' | sed 's/ /\n/g' | sort  -nr | head -n1)
$ echo ${numberOfManagedApplicationInstances}

Number of Managed cache instances

This parameter works for Coherence cluster. If your cluster is not Coherence cluter, keep it with default value 0.

You can get the existing Managed cache instances number with the following command using Azure CLI. It should be 0 if no value returned.

$ resourceGroup=<your-resource-group>
$ managedServerPrefix=<managed-server-prefix>
$ numberOfManagedCacheInstances=$(az resource list -g ${resourceGroup} --resource-type Microsoft.Compute/virtualMachines --query [*].name | grep "${managedServerPrefix}StorageVM[0-9]" | sed -e 's/[^0-9]/ /g' -e 's/^ *//g' -e 's/ *$//g' | tr -s ' ' | sed 's/ /\n/g' | sort  -nr | head -n1)
$ echo ${numberOfManagedCacheInstances}

Example Parameters JSON

Here is a fully filled out parameters file. We will leave values of adminUsername, authenticationType, dnsLabelPrefix, and usePreviewImage as default value.

Some things to note:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "_artifactsLocation": {
            "value": "https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/"
        },
        "adminVMName": {
           "value": "adminVM"
        },
        "elasticsearchEndpoint": {
           "value": "https://example.eastus2.azure.elastic-cloud.com:9243"
        },
        "elasticsearchPassword": {
           "value": "wlkpsw"
        },
        "elasticsearchUserName": {
           "value": "elastic"
        },
        "location": {
            "value": "eastus"
        },
        "managedServerPrefix": {
            "value": "msp"
        },
        "maxDynamicClusterSize": {
            "value": 8
        },
        "numberOfManagedApplicationInstances": {
            "value": 3
        },
        "numberOfManagedCacheInstances": {
            "value": 0
        },
        "wlsDomainName": {
            "value": "wlsd"
        },
        "wlsPassword": {
          "value": "welcome1"
        },
        "wlsUserName": {
          "value": "weblogic"
        }
    }
}

Invoke the ARM template

Assume your parameters file is available in the current directory and is named parameters.json. This section shows the commands to configure your Oracle WebLogic Server deployment to connect to Elasticsearch and Kinaba intance. Replace yourResourceGroup with the Azure resource group in which the Oracle WebLogic Server is deployed.

First, validate your parameters file

The az group deployment validate command is very useful to validate your parameters file is syntactically correct.

az deployment group validate --verbose --resource-group `yourResourceGroup` --parameters @parameters.json --template-uri https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/nestedtemplates/elkNestedTemplate.json

If the command returns with an exit status other than 0, inspect the output and resolve the problem before proceeding. You can check the exit status by executing the commad echo $? immediately after the az command.

Next, execute the template

After successfully validating the template invocation, change validate to create to invoke the template.

az deployment group create --verbose --resource-group `yourResourceGroup` --parameters @parameters.json --template-uri https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/nestedtemplates/elkNestedTemplate.json

As with the validate command, if the command returns with an exit status other than 0, inspect the output and resolve the problem.

This is an example output of successful deployment. Look for "provisioningState": "Succeeded" in your output.

{
  "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Resources/deployments/elkNestedTemplate",
  "location": null,
  "name": "elkNestedTemplate",
  "properties": {
    "correlationId": "61a46b43-27d0-4478-baba-c288059892d5",
    "debugSetting": null,
    "dependencies": [
      {
        "dependsOn": [
          {
            "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspVM1/extensions/newuserscript",
            "resourceGroup": "haiche-cluster-elk",
            "resourceName": "mspVM1/newuserscript",
            "resourceType": "Microsoft.Compute/virtualMachines/extensions"
          },
          {
            "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspVM2/extensions/newuserscript",
            "resourceGroup": "haiche-cluster-elk",
            "resourceName": "mspVM2/newuserscript",
            "resourceType": "Microsoft.Compute/virtualMachines/extensions"
          },
          {
            "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspStorageVM1/extensions/newuserscript",
            "resourceGroup": "haiche-cluster-elk",
            "resourceName": "mspStorageVM1/newuserscript",
            "resourceType": "Microsoft.Compute/virtualMachines/extensions"
          }
        ],
        "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Resources/deployments/pid-e4165284-b017-5df9-9b91-3f11dd8a72e5",
        "resourceGroup": "haiche-cluster-elk",
        "resourceName": "pid-e4165284-b017-5df9-9b91-3f11dd8a72e5",
        "resourceType": "Microsoft.Resources/deployments"
      },
      {
        "dependsOn": [
          {
            "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/adminVM/extensions/newuserscript",
            "resourceGroup": "haiche-cluster-elk",
            "resourceName": "adminVM/newuserscript",
            "resourceType": "Microsoft.Compute/virtualMachines/extensions"
          }
        ],
        "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspVM1/extensions/newuserscript",
        "resourceGroup": "haiche-cluster-elk",
        "resourceName": "mspVM1/newuserscript",
        "resourceType": "Microsoft.Compute/virtualMachines/extensions"
      },
      {
        "dependsOn": [
          {
            "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/adminVM/extensions/newuserscript",
            "resourceGroup": "haiche-cluster-elk",
            "resourceName": "adminVM/newuserscript",
            "resourceType": "Microsoft.Compute/virtualMachines/extensions"
          }
        ],
        "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspVM2/extensions/newuserscript",
        "resourceGroup": "haiche-cluster-elk",
        "resourceName": "mspVM2/newuserscript",
        "resourceType": "Microsoft.Compute/virtualMachines/extensions"
      },
      {
        "dependsOn": [
          {
            "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/adminVM/extensions/newuserscript",
            "resourceGroup": "haiche-cluster-elk",
            "resourceName": "adminVM/newuserscript",
            "resourceType": "Microsoft.Compute/virtualMachines/extensions"
          }
        ],
        "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspStorageVM1/extensions/newuserscript",
        "resourceGroup": "haiche-cluster-elk",
        "resourceName": "mspStorageVM1/newuserscript",
        "resourceType": "Microsoft.Compute/virtualMachines/extensions"
      }
    ],
    "duration": "PT8M54.4785762S",
    "mode": "Incremental",
    "onErrorDeployment": null,
    "outputResources": [
      {
        "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/adminVM/extensions/newuserscript",
        "resourceGroup": "haiche-cluster-elk"
      },
      {
        "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspStorageVM1/extensions/newuserscript",
        "resourceGroup": "haiche-cluster-elk"
      },
      {
        "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspVM1/extensions/newuserscript",
        "resourceGroup": "haiche-cluster-elk"
      },
      {
        "id": "/subscriptions/685ba005-af8d-4b04-8f16-a7bf38b2eb5a/resourceGroups/haiche-cluster-elk/providers/Microsoft.Compute/virtualMachines/mspVM2/extensions/newuserscript",
        "resourceGroup": "haiche-cluster-elk"
      }
    ],
    "outputs": {
      "artifactsLocationPassedIn": {
        "type": "String",
        "value": "https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/"
      },
      "logIndex": {
        "type": "String",
        "value": "azure-weblogic-cluster-b4e465d5-6ffc-49cf-b1d9-b4dbf6455d0a"
      }
    },
    "parameters": {
      "_artifactsLocation": {
        "type": "String",
        "value": "https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/"
      },
      "_artifactsLocationELKTemplate": {
        "type": "String",
        "value": "https://raw.githubusercontent.com/oracle/weblogic-azure/2024-02-29-1-Q1/weblogic-azure-vm/arm-oraclelinux-wls-dynamic-cluster/arm-oraclelinux-wls-dynamic-cluster/src/main/arm/"
      },
      "_artifactsLocationSasToken": {
        "type": "SecureString"
      },
      "adminVMName": {
        "type": "String",
        "value": "adminVM"
      },
      "elasticsearchEndpoint": {
        "type": "String",
        "value": "https://example.eastus2.azure.elastic-cloud.com:9243"
      },
      "elasticsearchPassword": {
        "type": "SecureString"
      },
      "elasticsearchUserName": {
        "type": "String",
        "value": "elastic"
      },
      "guidValue": {
        "type": "String",
        "value": "b4e465d5-6ffc-49cf-b1d9-b4dbf6455d0a"
      },
      "location": {
        "type": "String",
        "value": "eastus"
      },
      "logsToIntegrate": {
        "type": "Array",
        "value": [
          "HTTPAccessLog",
          "ServerLog",
          "DomainLog",
          "DataSourceLog",
          "StandardErrorAndOutput",
          "NodeManagerLog"
        ]
      },
      "managedServerPrefix": {
        "type": "String",
        "value": "msp"
      },
      "maxDynamicClusterSize": {
            "value": 8
      },
      "numberOfManagedApplicationInstances": {
        "type": "Int",
        "value": 2
      },
      "numberOfManagedCacheInstances": {
        "type": "Int",
        "value": 1
      },
      "wlsDomainName": {
        "type": "String",
        "value": "wlsd"
      },
      "wlsPassword": {
        "type": "SecureString"
      },
      "wlsUserName": {
        "type": "String",
        "value": "weblogic"
      }
    },
    "parametersLink": null,
    "providers": [
      {
        "id": null,
        "namespace": "Microsoft.Resources",
        "registrationPolicy": null,
        "registrationState": null,
        "resourceTypes": [
          {
            "aliases": null,
            "apiVersions": null,
            "capabilities": null,
            "locations": [
              null
            ],
            "properties": null,
            "resourceType": "deployments"
          }
        ]
      },
      {
        "id": null,
        "namespace": "Microsoft.Compute",
        "registrationPolicy": null,
        "registrationState": null,
        "resourceTypes": [
          {
            "aliases": null,
            "apiVersions": null,
            "capabilities": null,
            "locations": [
              "eastus"
            ],
            "properties": null,
            "resourceType": "virtualMachines/extensions"
          }
        ]
      }
    ],
    "provisioningState": "Succeeded",
    "template": null,
    "templateHash": "10060935779116645392",
    "templateLink": null,
    "timestamp": "2020-11-11T07:29:42.336797+00:00"
  },
  "resourceGroup": "haiche-cluster-elk",
  "type": "Microsoft.Resources/deployments"
}

Verify ELK connection

Follow the steps to check if WebLogic Server logs are exported to Elasticsearch.