// Module included in the following assemblies:
//
// * cloud_experts_tutorials/cloud-experts-deploying-application/cloud-experts-deploying-application-logging.adoc

:_mod-docs-content-type: PROCEDURE
[id="cloud-experts-deploying-application-logging-forward-to-cloudwatch_{context}"]
= Forwarding logs to CloudWatch

[role="_abstract"]
Install the logging add-on service to forward the logs to AWS CloudWatch.

.Procedure
. Run the following script to configure your {product-title} cluster to forward logs to CloudWatch:
+
[source,terminal]
----
$ curl https://raw.githubusercontent.com/openshift-cs/rosaworkshop/master/rosa-workshop/ostoy/resources/configure-cloudwatch.sh | bash
----
+
[NOTE]
====
Configuring {product-title} to send logs to CloudWatch goes beyond the scope of this tutorial. Integrating with AWS and enabling CloudWatch logging are important aspects of {product-title}, so a script is included to simplify the configuration process. The script will automatically set up AWS CloudWatch. You can examine the script to understand the steps involved.
====
+
**Example output**
+
[source,terminal]
----
Varaibles are set...ok.
Policy already exists...ok.
Created RosaCloudWatch-mycluster role.
Attached role policy.
Deploying the Red Hat OpenShift Logging Operator
namespace/openshift-logging configured
operatorgroup.operators.coreos.com/cluster-logging created
subscription.operators.coreos.com/cluster-logging created
Waiting for Red Hat OpenShift Logging Operator deployment to complete...
Red Hat OpenShift Logging Operator deployed.
secret/cloudwatch-credentials created
clusterlogforwarder.logging.openshift.io/instance created
clusterlogging.logging.openshift.io/instance created
Complete.
----
. After a few minutes, you should begin to see log groups inside of AWS CloudWatch. Run the following command to see the log groups:
+
[source,terminal]
----
$ aws logs describe-log-groups --log-group-name-prefix rosa-mycluster
----
+
**Example output**
+
[source,terminal]
----
{
    "logGroups": [
        {
            "logGroupName": "rosa-mycluster.application",
            "creationTime": 1724104537717,
            "metricFilterCount": 0,
            "arn": "arn:aws:logs:us-west-2:000000000000:log-group:rosa-mycluster.application:*",
            "storedBytes": 0,
            "logGroupClass": "STANDARD",
            "logGroupArn": "arn:aws:logs:us-west-2:000000000000:log-group:rosa-mycluster.application"
        },
        {
            "logGroupName": "rosa-mycluster.audit",
            "creationTime": 1724104152968,
            "metricFilterCount": 0,
            "arn": "arn:aws:logs:us-west-2:000000000000:log-group:rosa-mycluster.audit:*",
            "storedBytes": 0,
            "logGroupClass": "STANDARD",
            "logGroupArn": "arn:aws:logs:us-west-2:000000000000:log-group:rosa-mycluster.audit"
        },
----