You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/observability/logging/how-to/enable-secure-logs.md
+28-14
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,35 @@ conditional: [tenant, nav]
4
4
---
5
5
# Enable secure logs
6
6
7
-
This guide will show you how to enable shipping of secure logs for your application
8
-
9
-
Some applications have logs with information that should not be stored with the normal application logs. To support this a directory for these logs can be mounted in the application, and the content of logs written here will be transferred to separate indices in Elasticsearch.
10
-
11
-
!!! warning "Deprecated syntax"
12
-
13
-
This is guide contains a deprecated syntax for enabling secure logs. With the new syntax all logs will be sent to secure logs when enabled and will not require any special log configuration.
7
+
This guide will show you how to enable shipping of secure logs for your application.
14
8
15
9
## Prerequisites
16
10
17
11
If your NAIS team has already at any point produced secure logs, you can skip this step.
18
12
19
13
If your team has never before produced secure logs, before enabling them for the first time, give a warning in [#kibana](https://nav-it.slack.com/archives/C7T8QHXD3) Slack channel. There are some things that need to be adjusted before a new team can start sending. Remember to include the name of your NAIS team in the message.
To enable secure logs for your application, you need to add the following configuration to your application manifest. This will send all logs produced by the application to the secure logs index in Kibana.
18
+
19
+
???+ note ".nais/app.yaml"
20
+
21
+
```yaml
22
+
spec:
23
+
observability:
24
+
logging:
25
+
destinations:
26
+
- id: secure_logs
27
+
```
28
+
29
+
## Legacy secure logs configuration
30
+
31
+
!!! warning "Deprecated syntax"
32
+
33
+
This part of the guide contains the now deprecated syntax for enabling secure logs and is subject to removal in the future.
@@ -28,7 +42,7 @@ If your team has never before produced secure logs, before enabling them for the
28
42
enabled: true
29
43
```
30
44
31
-
## Set log rotation
45
+
###Set log rotation
32
46
33
47
With secure logs enabled a directory `/secure-logs/` will be mounted in the application container. Every `*.log` file in this directory will be monitored and the content transferred to Elasticsearch. Make sure that these files are readable for the log shipper \(the process runs as uid/gid 1065\).
34
48
@@ -38,7 +52,7 @@ With secure logs enabled a directory `/secure-logs/` will be mounted in the appl
38
52
39
53
**If the limit is exceeded the application pod will be evicted and restarted.**
40
54
41
-
### Example log configuration
55
+
####Example log configuration
42
56
43
57
Log files should be in JSON format as the normal application logs. Here is an example configuration of JSON logging with a size based rolling file appender in Logback:
44
58
@@ -57,7 +71,7 @@ Log files should be in JSON format as the normal application logs. Here is an ex
57
71
</appender>
58
72
```
59
73
60
-
## Configure log shipping
74
+
###Configure log shipping
61
75
62
76
Example configuration selecting which logs go to secure logs
63
77
@@ -103,7 +117,7 @@ Example configuration selecting which logs go to secure logs
103
117
</configuration>
104
118
```
105
119
106
-
## Use secure logs in application
120
+
###Use secure logs in application
107
121
108
122
Using the Logback config below you can log to secure logs by writing Kotlin-code like this:
109
123
@@ -122,7 +136,7 @@ log.info("Non-sensitive data here") // Logging to non-secure app logs
122
136
See doc on [Logback filters](https://logback.qos.ch/manual/filters.html#evaluatorFilter) and [markers](https://www.slf4j.org/api/org/slf4j/MarkerFactory.html)
123
137
See [Example log configuration](#example-log-configuration) for further configuration examples.
124
138
125
-
### Non-JSON logs
139
+
####Non-JSON logs
126
140
127
141
If the logging framework used doesn't support JSON logging, it is also possible to use multiline logs in this format:
128
142
@@ -134,7 +148,7 @@ If the logging framework used doesn't support JSON logging, it is also possible
134
148
135
149
Files on this format must be named `*.mlog`.
136
150
137
-
### Sending logs with HTTP
151
+
####Sending logs with HTTP
138
152
139
153
If you do not want to have these logs as files in the pod, it is also possible to use HTTP to write logs. POST your log entry as JSON to `http://localhost:19880`
0 commit comments