by Devin Yang
(This article was automatically translated.)

Published - 2 years ago ( Updated - 2 years 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 local0.info "$@"
 }


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 192.168.99.130, 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.

 #daemon,mail.*;\
# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/tty8
 *.* @192.168.99.130:514;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.* @127.0.0.1:32376
 *.* @192.168.99.130:514


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 192.168.99.130 TEST1
$ syslog -s -l Error -r 192.168.99.130 TEST1
 $ syslog -s -l Debug -r 192.168.99.130 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


Synology,siri

Turn on synology nas with Siri

I have two Synology NAS at home. One of the Nas for backup is usually turned off. I’m not sure if turning it on and off every day will hurt the machine, but I’m sure if it’s not turned off for 24 hours, it will hurt the hard drive. The hard drive for business is about 5~ It will be replaced in 6 years, and this Nas is usually used for nothing and consumes power. Therefore, at this stage, I only let it automatically turn on at a fixed time to receive backup data.

Synology,haproxy

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.

git,Synology

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...