by Devin Yang
(This article was automatically translated.)

Published - 11 months ago ( Updated - 11 months ago )

This article introduces how I use the Synology Log Center to record all the logs of my home host.
In Synolog's log center, we can search through its UI.

In this way, we can centrally view our logs, such as the scheduled execution status of Linux hosts.
It can also send messages to the log center through commands, and we can check the daily backup tasks of the Linux host at any time, whether the backup is successful or failed, etc.

Before starting, let's look at the results after setting:
He can instantly show whoever hacked into my computer 😩 (you won't succeed, don't try again, I guess it should be a random scanning robot).

We can also select logs from other servers in the log center and filter the content

We can write a simple Bash to send a message to the log center

For example, in Linux, you can directly write a function and put it in ~/.bashrc.

 function log {
logger -p "$@"

After reading so much, how to set it up, don’t worry it’s so simple

1. In the log center of the NAS, click Log Receive, and add a new receiving rule.

2. The next point is the key point. The setting is very simple, but to be honest, I have also studied it for a long time.
If you haven't tried it yet, give it a like after reading it. If you want to use it, it should save a lot of time😝.

In the Linux system, if you have /etc/rsyslog.conf, you can basically use it. I have tested it on Raspberry Pi and Ubuntu, and there is no problem.
Please add the template in RFC3164fmt format to rsyslog.conf.

 $template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%"

For example the content below

 # /etc/rsyslog.conf configuration file for rsyslog
# For more information install rsyslog-doc and see
# /usr/share/doc/rsyslog-doc/html/configuration/index.html

$template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%"
#### MODULES ####

In Ubuntu, there should be a /etc/rsyslog.d/50-default.conf file, please fill in the IP of your Nas in the last line.
Below is my Nas IP, you should replace it with your own Nas IP.
豆豆龍風格,我喜歡讓您看最真實的設定,不會像有些文早會打成之類的替換文字,當然這些文字有可能是我變更過的。 Doudoulong style, I like to let you see the most realistic settings, not like some texts would have been replaced with , of course, these texts may have been changed by me.

# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/tty8
 *.* @;RFC3164fmt

If you do not have this file on the Raspberry Pi, you can create one yourself, just restart the rsyslog service

 systemctl restart rsyslog

There is no rsyslog on MacOS. The macOS I use is 13.0.1 (22A400). If you are an old version, you can try it, but it may not be useful.
I added it directly in /etc/syslog.conf, and then restarted the Mac and it should take effect.

 # Note that flat file logs are now configured in /etc/asl.conf

install.* @
 *.* @

Then if you are using MacOS, you can use syslog on your MacOS to test whether the message can be sent to the log center.

 $syslog -s -l Info -r TEST1
$ syslog -s -l Error -r TEST1
 $ syslog -s -l Debug -r TEST1

The result is as follows:

If you have a Juyi Router, you can also try the following settings. After I tested it, the logs can be sent to the Synolog log center normally.

If you think this article is helpful to you, remember to give it a like, and see if the SEO of this article can rush to the ranking🥹

Tags: synology log center rsyslog syslog

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


How to modify the logging driver of Docker on Synolog NAS

On my Synolog Nas, a strange logging driver named db is running by default, how to modify it to a normal json-file? In Synolog's Nas, his Daemon config file is special, and it is placed in the /var/packages/Docker/etc/ directory. Called dockerd.json.


Use HAProxy to remove the /mail path of the Sysnolgy Mail Station

This article explains the version of DSM7. The Package Center of Synology Nas provides two Mail Servers, one is Synology Mail Server and the other is Synology MailPlus. For me, the advantage of Synology MailPlus is that he can easily specify a domain name in the login portal, but it is limited to a maximum of five accounts, and if there are more accounts, you will have to buy a license. If you use Synoloyg Mail Server, there will be no limit on the number of accounts, but it does not integrate the login portal. If you install the webmail of Mail Station, there will be an additional path of /mail in the directory of the website. Although it is not in the way, but I just do not like it.


Sharing about gitlab's docker settings

My friend wants to study the operation of gitlab. I said that it takes less than ten minutes to install it with docker image. There is also a gitlab package on my Synology Nas that can be installed directly. As a result, either the installation failed, or it was being repaired, or it was already started and could not be used. @@ Also choked by friends...