This is the backend for the log exploration application for the Openshift Logging Stack
- Fetch logs from specific log group
- Fetch logs for specific time window
- Fetch logs for the pod for the specific time window
make build
- to build the application
make test
- to run unit tests
This application uses Prometheus for monitoring metrics. See Official Prometheus Docs and this Prometheus User Guide for more information.
- oc installed
- an existing Openshift cluster you can connect to
- the following log-exploration-api objects should have already been created : deployment, service, and route
- if not use the commands :
oc apply -f log-exploration-api-deployment.yaml
oc apply -f log-exploration-service.yaml
oc apply -f log-exploration-api-route.yaml
- if not use the commands :
oc apply -f log-exploration-api-service-monitor
ServiceMonitor describes the set of targets to be monitored by Prometheus.
oc apply -f log-exploration-api-namespace
This enables cluster monitoring of the namespace.
Use the command :
oc get route
Copy and paste the log-exploration-api HOST/PORT into your browser followed by the endpoint /metrics
.
Go to the Openshift Console > Monitoring > Metrics > Prometheus UI. You will be prompted to 'Login with Openshift'. Sign in with your cluster username and password. This will log you into the Prometheus homepage. At the top of the screen you should see a dialogue box to enter expressions.
Enter the following expressions to query for log-exploration-api's custom metrics:
custom_metric_http_requests_total
This expression obtains the total number of requests at each endpoint.
custom_metric_http_response_time_seconds_bucket
custom_metric_http_response_time_seconds_count
custom_metric_http_response_time_seconds_sum
These expressions return information about response time when endpoints are called.
custom_metric_response_status
This expression returns the counts for response statuses (e.g., 200, 404).
On the Prometheus UI find the navigation bar and click Status > Targets. If Prometheus is able to monitor
our application you should see the target named
openshift-logging/log-exploration-api-service-monitor/0
.