Editing
How to make your NAS a SYSLOG Server
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==The Process== '''NOTE: The Syslog-ng binary is included with DSM 3.0 (FW 1337). If you have DSM 3.0 you can skip the installation of ipkg and syslog-ng below, see this wiki's discussion page for more information''' #Using an internet browser login to the Management webpage of your NAS as "admin" #Create a shared folder called "logs" on volume1. You can place it on another volume if you want but from now on I will assume it is on volume1 #Set access permissions for the newly created "logs" folder as you require #If you have not previously installed ipkg you will need to do so by following the instructions in [[Overview on modifying the Synology Server, bootstrap, ipkg etc#How_to_install_ipkg]] #If you didn't follow the step above because you had previously installed ipkg, enable and then login into the [[Modifications|Command Line Interface]] as "root" #Navigate to the root folder i.e. enter "cd /" #Update the list of ipkg packages, i.e. enter "ipkg update" #Install syslog-ng, i.e. enter "ipkg install syslog-ng" #Configure syslog-ng using the [[Linux VI Editor]] to modify the file /opt/etc/syslog-ng/syslog-ng.conf, i.e. enter "vi /opt/etc/syslog-ng/syslog-ng.conf" #Press the "i" key to enter the text insertion mode of vi, and then use the cursor keys to comment out all lines in this file by entering a "#" at the start of each line that does not already have a "#" at the start of it. #Then copy and paste the code below (see the section "syslog-ng.conf code") at the end of the file. #Press the escape key to quit the insertion mode of vi #Type "ZZ" (note capital Z's) to save the changes and close vi. #Close the [[Modifications|Command Line Interface]] session, i.e. enter “exit”. #Use the Management web page to reboot the NAS #Installation and configuration of syslog-ng is now complete and after rebooting the NAS syslog-ng will start automatically and monitor the defined port (49152) for System messages to log. #You now need to configure your network device (e.g. your router) to send its System messages to your NAS. In your network devices “SysLog sending configuration page” (or equivalent) enter the IP address of your NAS and the relevant port number (49152). ===syslog-ng.conf code=== Below is the code to be copied and pasted into the file "/opt/etc/syslog-ng/syslog-ng.conf". All other lines in the file (i.e. all except those below) should be commented out, i.e. put a "#" at the start of each line. The code below tells syslog-ng to monitor port 49152 for UDP packets, this port should be free unless you have already configured that port for something else. If you want to use another port you can change it but do not attempt to use port 514 as it is disabled by the internal syslogd. Also if the device sending the Syslog data only supports TCP packets then you may need to change that, see this wiki's discussion page for more info. The log files created by the code below will have the "owner" file permission set to "root", if for scripting reasons you need the log files to belong to specific owners/groups, how to control this is also stated on this wiki's discussion page. The code below tells syslog-ng to create a new file for storing log messages every day, you can change the log file name if required, but beware of using a static name as the log file can grow too large if you do not have some method of clearing/rotating it. <pre> options { long_hostnames(off); sync(0); use_dns(no); create_dirs(no); }; source s_net { udp(port(49152) ); }; destination d_router { file("/volume1/logs/router_$YEAR.$MONTH.$DAY.log"); }; log { source(s_net); destination(d_router); }; </pre>
Summary:
Please note that all contributions to wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
British English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information