by Devin Yang
(This article was automatically translated.)

Published - 1 year ago ( Updated - 1 year 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


docker,Synology

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.

Synology,NAS

Remove IP of Synology NAS Block via command line

In some cases, your IP may be locked by the Synology NAS, for example, the email host is installed on the Synology NAS, and the email password is incorrectly set. Or Synology did not correctly set the forward header of the real IP on the internal network. No matter what the reason is, we want to remove the locked IP through the command line.

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.