Skip to content

Commit 608f6d5

Browse files
themr0clinfrazepabel-rh
authored
RHIDP-6507 - modularize _Monitoring and logging with AWS (#1089)
Co-authored-by: Lindsey Frazier <[email protected]> Co-authored-by: Priyanka Abel <[email protected]>
1 parent 5a75420 commit 608f6d5

10 files changed

+195
-150
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[id="assembly-logging-with-amazon-cloudwatch_{context}"]
2+
= Logging with Amazon CloudWatch
3+
4+
Logging within the {product} relies on the link:https://github.com/winstonjs/winston[Winston library].
5+
The default logging level is `info`.
6+
To have more detailed logs, set the `LOG_LEVEL` environment variable to `debug` in your {product} instance.
7+
8+
9+
include::modules/observe/proc-configuring-the-application-log-level-for-logging-with-amazon-cloudwatch-logs-by-using-the-operator.adoc[leveloffset=+1]
10+
11+
12+
include::modules/observe/proc-configuring-the-application-log-level-for-logging-with-amazon-cloudwatch-logs-by-using-the-helm-chart.adoc[leveloffset=+1]
13+
14+
15+
include::modules/observe/proc-retrieving-logs-from-amazon-cloudwatch.adoc[leveloffset=+1]
16+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[id="assembly-monitoring-and-logging-with-aws_{context}"]
2+
= Monitoring and logging {product} on {aws-brand-name} ({aws-short})
3+
4+
You can configure {product} to use Amazon CloudWatch for real-time monitoring and Amazon Prometheus for comprehensive logging.
5+
This is convenient when hosting {product-short} on {aws-brand-name} ({aws-short}) infrastructure.
6+
7+
include::assembly-monitoring-with-amazon-prometheus.adoc[leveloffset=+1]
8+
9+
10+
include::assembly-logging-with-amazon-cloudwatch.adoc[leveloffset=+1]
11+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[id="assembly-monitoring-with-amazon-prometheus_{context}"]
2+
= Monitoring with Amazon Prometheus
3+
4+
You can configure {product} to use Amazon Prometheus for comprehensive logging.
5+
Amazon Prometheus extracts data from pods that have specific pod annotations.
6+
7+
== Prerequisites
8+
9+
* You link:https://docs.aws.amazon.com/eks/latest/userguide/prometheus.htm[configured Prometheus for your {eks-name} ({eks-short}) clusters].
10+
* You link:https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html[created an Amazon managed service for the Prometheus workspace].
11+
* You link:https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-ingest-metrics.html[configured Prometheus to import the {product-short} metrics].
12+
* You ingested Prometheus metrics into the created workspace.
13+
14+
15+
include::modules/observe/proc-configuring-annotations-for-monitoring-with-amazon-prometheus-by-using-the-operator.adoc[leveloffset=+1]
16+
17+
18+
include::modules/observe/proc-configuring-annotations-for-monitoring-with-amazon-prometheus-by-using-the-helm-chart.adoc[leveloffset=+1]
19+
20+
21+
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[id="configuring-annotations-for-monitoring-with-amazon-prometheus-by-using-the-helm-chart_{context}"]
2+
= Configuring annotations for monitoring with Amazon Prometheus by using the {product} Helm chart
3+
4+
To enable logging to Amazon Prometheus, you can configure the required pod annotations by using the {product} Helm chart.
5+
6+
.Procedure
7+
* To annotate the backstage pod for monitoring, update your `values.yaml` file as follows:
8+
+
9+
[source,yaml]
10+
----
11+
upstream:
12+
backstage:
13+
# --- TRUNCATED ---
14+
podAnnotations:
15+
prometheus.io/scrape: 'true'
16+
prometheus.io/path: '/metrics'
17+
prometheus.io/port: '9464'
18+
prometheus.io/scheme: 'http'
19+
----
20+
21+
.Verification
22+
To verify if the scraping works:
23+
24+
. Use `kubectl` to port-forward the Prometheus console to your local machine as follows:
25+
+
26+
[source,bash]
27+
----
28+
kubectl --namespace=prometheus port-forward deploy/prometheus-server 9090
29+
----
30+
31+
. Open your web browser and navigate to `pass:c[http://localhost:9090]` to access the Prometheus console.
32+
33+
. Monitor relevant metrics, such as `process_cpu_user_seconds_total`.
34+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[id="configuring-annotations-for-monitoring-with-amazon-prometheus-by-using-the-operator_{context}"]
2+
= Configuring annotations for monitoring with Amazon Prometheus by using the {product} Operator
3+
4+
To enable logging to Amazon Prometheus, you can configure the required pod annotations by using the {product} Operator.
5+
6+
.Procedure
7+
. As an administrator of the {product} Operator, edit the default configuration to add Prometheus annotations as follows:
8+
+
9+
----
10+
# Update OPERATOR_NS accordingly
11+
$ OPERATOR_NS=rhdh-operator
12+
$ kubectl edit configmap backstage-default-config -n "${OPERATOR_NS}"
13+
----
14+
15+
. Find the `deployment.yaml` key in the config map and add the annotations to the `spec.template.metadata.annotations` field as follows:
16+
+
17+
[source,yaml]
18+
----
19+
deployment.yaml: |-
20+
apiVersion: apps/v1
21+
kind: Deployment
22+
# --- truncated ---
23+
spec:
24+
template:
25+
# --- truncated ---
26+
metadata:
27+
labels:
28+
rhdh.redhat.com/app: # placeholder for 'backstage-<cr-name>'
29+
# --- truncated ---
30+
annotations:
31+
prometheus.io/scrape: 'true'
32+
prometheus.io/path: '/metrics'
33+
prometheus.io/port: '9464'
34+
prometheus.io/scheme: 'http'
35+
# --- truncated ---
36+
----
37+
38+
. Save your changes.
39+
40+
.Verification
41+
To verify if the scraping works:
42+
43+
. Use `kubectl` to port-forward the Prometheus console to your local machine as follows:
44+
+
45+
----
46+
$ kubectl --namespace=prometheus port-forward deploy/prometheus-server 9090
47+
----
48+
49+
. Open your web browser and navigate to `pass:c[http://localhost:9090]` to access the Prometheus console.
50+
. Monitor relevant metrics, such as `process_cpu_user_seconds_total`.
51+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[id="configuring-the-application-log-level-by-using-the-helm-chart_{context}"]
2+
= Configuring the application log level by using the {product} Helm chart
3+
4+
You can configure the application log level by using the {product} Helm chart.
5+
6+
.Procedure
7+
* Modify the logging level by adding the environment variable `LOG_LEVEL` to your Helm chart `values.yaml` file:
8+
+
9+
[source,yaml]
10+
----
11+
upstream:
12+
backstage:
13+
# --- Truncated ---
14+
extraEnvVars:
15+
- name: LOG_LEVEL
16+
value: debug
17+
----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[id="configuring-the-application-log-level-by-using-the-operator_{context}"]
2+
= Configuring the application log level by using the {product} Operator
3+
4+
You can configure the application log level by using the {product} Operator.
5+
6+
.Procedure
7+
* Modify the logging level by including the environment variable `LOG_LEVEL` in your custom resource as follows:
8+
+
9+
[source,yaml]
10+
----
11+
spec:
12+
# Other fields omitted
13+
application:
14+
extraEnvs:
15+
envs:
16+
- name: LOG_LEVEL
17+
value: debug
18+
----
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[id="retrieving-logs-from-amazon-cloudwatch_{context}"]
2+
= Retrieving logs from Amazon CloudWatch
3+
4+
.Prerequisites
5+
* CloudWatch Container Insights is used to capture logs and metrics for {eks-brand-name}.
6+
For more information, see https://docs.aws.amazon.com/prescriptive-guidance/latest/implementing-logging-monitoring-cloudwatch/kubernetes-eks-logging.html[Logging for {eks-brand-name}] documentation.
7+
8+
* To capture the logs and metrics, link:https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Container-Insights-setup-EKS-addon.html[install the Amazon CloudWatch Observability EKS add-on] in your cluster.
9+
Following the setup of Container Insights, you can access container logs using Logs Insights or Live Tail views.
10+
11+
* CloudWatch names the log group where all container logs are consolidated in the following manner:
12+
+
13+
[subs="+quotes"]
14+
----
15+
/aws/containerinsights/_<cluster_name>_/application
16+
----
17+
18+
.Procedure
19+
* To retrieve logs from the {product-short} instance, run a query such as:
20+
+
21+
[source,sql]
22+
----
23+
fields @timestamp, @message, kubernetes.container_name
24+
| filter kubernetes.container_name in ["install-dynamic-plugins", "backstage-backend"]
25+
----

modules/observe/proc-rhdh-monitoring-logging-aws.adoc

Lines changed: 0 additions & 149 deletions
This file was deleted.

titles/monitoring-and-logging/master.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include::artifacts/attributes.adoc[]
1111
include::assemblies/assembly-rhdh-observability.adoc[leveloffset=+1]
1212

1313
//AWS
14-
include::modules/observe/proc-rhdh-monitoring-logging-aws.adoc[leveloffset=+1]
14+
include::assemblies/assembly-monitoring-and-logging-with-aws.adoc[leveloffset=+1]
1515

1616
//AKS
1717
include::assemblies/assembly-monitoring-and-logging-aks.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)