Skip to content

Commit 4d97f3d

Browse files
authored
Merge pull request #8420 from naveenpaul1/update_noobaa_log
NSFS | Update noobaa log document and add syslog-ng
2 parents 3d6e7ec + 51b551f commit 4d97f3d

File tree

1 file changed

+64
-13
lines changed

1 file changed

+64
-13
lines changed

docs/NooBaaNonContainerized/Logging.md

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,19 @@ This document provides an overview of the logging capabilities within NooBaa, de
1919

2020
## NooBaa Service Logs
2121

22-
NooBaa service logs are written directly to stderr and to syslog -
23-
1. NooBaa writes the logs into stderr and to `/var/log/noobaa.log`.
24-
2. The `journalctl` service watches stderr and writes it to `journal`.
25-
3. A `syslog` service, like `rsyslog/syslog_ng` watches `journal` and writes it to `/var/log/messages/`.
22+
NooBaa service logs are written directly to stderr, syslog, or both.
23+
1. The `journalctl` service watches stderr and writes into `journal`. That internally updates the `/var/log/messages`.
24+
2. Noobaa sends logs to a syslog service such as rsyslog or syslog_ng and writes the logs to `/var/log/noobaa.log` if enabled. We can not have more than one service enabled at a time. It might cause some issues.
25+
26+
### Set log config
27+
28+
Set `LOG_TO_STDERR_ENABLED` property to `true` to send Noobaa logs to stderr. Noobaa logs will be send to syslog when the property `LOG_TO_SYSLOG_ENABLED` set to `true`.
29+
30+
Default configurations are:
31+
```
32+
LOG_TO_STDERR_ENABLED = true;
33+
LOG_TO_SYSLOG_ENABLED = false;
34+
```
2635

2736
### Journal logs
2837
1. NooBaa service logs -
@@ -42,15 +51,15 @@ NooBaa logs are configured using rsyslog and logrotate. NooBaa RPM will configur
4251
systemctl status rsyslog
4352
```
4453

45-
NooBaa logs are pushed to `var/log/noobaa.log` and the log is rotated and compressed daily.
54+
NooBaa logs are pushed to `/var/log/noobaa.log` and the log is rotated and compressed daily.
4655

4756
The following files contain NooBaa specific configuration for rsyslog and logrotate -
4857
1. `etc/rsyslog.d/noobaa_syslog.conf`
4958
2. `etc/logrotate.d/noobaa-logrotate`
5059

5160
Verify the rsyslog and logrotate rpm configuration is complete by checking the files above.
5261

53-
#### Logrotate
62+
### Logrotate
5463

5564
##### Logrotate automatic rotation
5665

@@ -79,16 +88,58 @@ logrotate etc/logrotate.d/noobaa-logrotate
7988
Set `NOOBAA_LOG_LEVEL` property in config.json to control the amount of debugging information generated by the application.
8089
For more info about setting custom properties, see - [Non Containerized Config File Customizations](./ConfigFileCustomizations.md)
8190

82-
## NooBaa Logs format
91+
### NooBaa Logs format
8392
NooBaa logs are formatted with ANSI color codes. </br>
8493
Use the `cat <logfile> | less -R` command in order to display the contents of a log file with pagination and the ability to handle ANSI color codes.
8594

86-
### Set log config
95+
## How to configure syslog-ng
96+
97+
1. create syslog-ng noobaa specific config file `noobaa-syslog-ng.conf` under `etc/syslog-ng/conf.d/`
98+
```
99+
vi etc/syslog-ng/conf.d/noobaa-syslog-ng.conf
100+
```
101+
2. update the file with bellow configuration
87102

88-
Set `LOG_TO_STDERR_ENABLED` property to `true` to send Noobaa logs to stderr. Noobaa logs will be send to syslog when the property `LOG_TO_SYSLOG_ENABLED` set to `true`.
103+
```
104+
destination d_noobaa_msg { file("/var/log/noobaa.log"); };
105+
destination d_noobaa_event { file("/var/log/noobaa_events.log"); };
89106
90-
Default configurations are:
107+
filter f_noobaa_msg { facility(local0); };
108+
filter f_noobaa_event { facility(local2); };
109+
110+
log { source(s_sys); filter(f_noobaa_msg); destination(d_noobaa_msg); };
111+
log { source(s_sys); filter(f_noobaa_event); destination(d_noobaa_event); };
91112
```
92-
LOG_TO_STDERR_ENABLED = true;
93-
LOG_TO_SYSLOG_ENABLED = false;
94-
```
113+
We are creating two new destination one is `d_noobaa_msg`, point to log file `/var/log/noobaa.log` and another one is `d_noobaa_event` , point to log file `/var/log/noobaa_events.log`
114+
Filter `f_noobaa_msg` and `f_noobaa_event` will filter out only noobaa logs and events log. Last created two source that will filter and log only noobaa normal logs and events to previously added destinations.
115+
116+
3. Update existing filter `f_default` in default syslog-ng `etc/syslog-ng/syslog-ng.conf` to make sure noobaa logs and event are not send to `/var/log/message` log file.
117+
```
118+
vi etc/syslog-ng/syslog-ng.conf
119+
// update file for filter f_default
120+
filter f_default { level(info..emerg) and
121+
not (facility(mail)
122+
or facility(local0)
123+
or facility(local2)
124+
or facility(authpriv)
125+
or facility(cron)); };
126+
```
127+
Noobaa logs with facility local0 and local2 are excluded from message logs
128+
4. restart syslog-ng
129+
```
130+
systemctl restart syslog-ng
131+
```
132+
133+
### Known issues
134+
135+
1. missing logs due to systemd-journald log suppression
136+
`Suppressed 6284127 messages from noobaa.service`
137+
138+
solution :
139+
* Edit /etc/systemd/journald.conf
140+
* add below configuration
141+
```
142+
RateLimitInterval=0
143+
RateLimitBurst=0
144+
```
145+
link : https://my.f5.com/manage/s/article/K70501143

0 commit comments

Comments
 (0)