Skip to content

Commit

Permalink
update logging stack
Browse files Browse the repository at this point in the history
  • Loading branch information
rasheedamir committed Oct 26, 2024
1 parent 9d35e7d commit cd2621b
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 99 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions content/managed-addons/logging-stack/images/logging.xml

This file was deleted.

13 changes: 0 additions & 13 deletions content/managed-addons/logging-stack/kibana-view-logs.md

This file was deleted.

85 changes: 3 additions & 82 deletions content/managed-addons/logging-stack/overview.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,10 @@
# Logging

Stakater App Agility Platform uses EFK Stack (ElasticSearch, Fluentd and Kibana) to provide logging for applications. Fluentd daemonsets pick up the logs and send these to ElasticSearch. Kibana dashboards can be used to view/analyze logs

![Logging](./images/logging.jpg)
Stakater App Agility Platform (SAAP) uses Loki and Vector to provide logging for applications.

## Components

Here are the logging stack components:

- Fluentd
- ElasticSearch
- Kibana
- Event Router

## Parse JSON Application Logs

Logs are parsed by default if applications output logs in `JSON format` on stdout. Moreover one step nested JSON parsing is also supported additionally.

Consider the following example of a one line event by a java application:

```json
{"timestamp":"2021-04-15 11:41:01.427","level":"WARN","thread":"http-nio-8080-exec-4","mdc":{"breadcrumbId":"441ce707-8096-4aba-a927-0afa8c34802b-by-BOKE","user":"service-account-boke"},"logger":"org.zalando.logbook.Logbook","message":"{\"origin\":\"local\",\"type\":\"response\",\"correlation\":\"ef4f3737f2bcf856\"}"}
```

This will be parsed as follows:

```json
{
"timestamp":"2021-04-15 11:41:01.427",
"level":"WARN",
"thread":"http-nio-8080-exec-4",
"mdc.breadcrumbId":"441ce707-8096-4aba-a927-0afa8c34802b-by-BOKE",
"mdc.user":"service-account-boke",
"logger":"org.zalando.logbook.Logbook",
"message":"{\"origin\":\"local\",\"type\":\"response\",\"correlation\":\"ef4f3737f2bcf856\"}",
"origin": "local",
"type": "response",
"correlation": "ef4f3737f2bcf856"
}
```

## Parse non JSON Application Logs

Parsing application logs which are not in `JSON format` can be done as follows:

Consider the following example of a one line event by a java application:

```sh
2019-11-27 11:04:12.682 INFO 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
```

The configuration to parse/match/send logs can be specified in the [Application Chart](https://github.com/stakater-charts/application), by specifying regular expressions as described below:

| Parameter | Description |
|:---|:---|
|.Values.deployment.fluentdConfigAnnotations.regexFirstLine|specify the regex to match the first line of the log|
|.Values.deployment.fluentdConfigAnnotations.regex|specify the regex to parse the complete log entry|
|.Values.deployment.fluentdConfigAnnotations.timeFormat|specify the regex to parse time|

Use the following Configuration for parsing java springboot logs :

```yaml
deployment:
fluentdConfigAnnotations:
regex: /^(?<time>\\d+(?:-\\d+){2}\\s+\\d+(?::\\d+){2}\\.\\d+)\\s*(?<level>\\S+)
(?<pid>\\d+) --- \\[(?<thread>[\\s\\S]*?)\\] (?<class>\\S+)\\s*:\\s*(?<message>[\\s\\S]*?)(?=\\g<time>|\\Z)/
regexFirstLine: /^\\d+(?:-\\d+){2}\\s+\\d+(?::\\d+){2}\\.\\d+/
timeFormat: "%Y-%m-%d %H:%M:%S.%L"
```
This will be parsed as follows:
```yaml
time: 2019-11-27 11:04:12.682
level: INFO
pid: 1
thread: nio-8080-exec-1
class: o.s.web.servlet.DispatcherServlet
message: Initializing Servlet 'dispatcherServlet'
```
## Log Retention
By default Application logs are retained for 7 days.
## Application alerting
Alerts can be sent to Slack channels by matching a string against a particular field. e.g. Send an alert to Slack if `level`==`ERROR`. These alerts increase operational efficiency. See [Application log alerting](../monitoring-stack/log-alerts.md#Application-Logs-Alerting) on how to configure alerts
- [Loki](https://github.com/grafana/loki)
- [Vector](https://github.com/vectordotdev/vector)
2 changes: 1 addition & 1 deletion content/managed-addons/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Here is the list of fully managed addons available on Stakater App Agility Platf

Managed AddOn | Description
--- | ---
Logging | [ElasticSearch, Fluentd and Kibana](./logging-stack/overview.md)
Logging | [Loki and Vector](./logging-stack/overview.md)
Monitoring | [Grafana, Prometheus, Thanos and Alertmanager](./monitoring-stack/overview.md)
CI (continuous integration) | [Tekton](./tekton/overview.md)
CD (continuous delivery) | [ArgoCD](./argocd/overview.md)
Expand Down
1 change: 0 additions & 1 deletion theme_override/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ nav:
- managed-addons/konfigurator/explanation/pod-metadata-injector.md
- Logging:
- managed-addons/logging-stack/overview.md
- managed-addons/logging-stack/kibana-view-logs.md
- Monitoring:
- managed-addons/monitoring-stack/overview.md
- managed-addons/monitoring-stack/stack.md
Expand Down

0 comments on commit cd2621b

Please sign in to comment.