Logging with DD-WRT

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:08, 2 May 2009 (edit)
Soulstace (Talk | contribs)
m (Saving the logfile across reboots)
← Previous diff
Revision as of 03:22, 9 December 2017 (edit) (undo)
Ian5142 (Talk | contribs)
(Recommended tools)
Next diff →
(14 intermediate revisions not shown.)
Line 17: Line 17:
Here are some utilities you may wish to check out if you're logging remotely: Here are some utilities you may wish to check out if you're logging remotely:
-[http://www.sonic.net/wallwatcher/ WallWatcher]<br>+[http://www.wallwatcher.com/ WallWatcher]<br>
syslog-ng ([http://www.cygwin.com/ CYGWIN])<br> syslog-ng ([http://www.cygwin.com/ CYGWIN])<br>
[http://www.kiwisyslog.com/ Kiwi Syslog]<br> [http://www.kiwisyslog.com/ Kiwi Syslog]<br>
-[http://www.linklogger.com/download.htm#WRT Link Logger]+[http://www.linklogger.com/download.htm#WRT Link Logger]<br>
 +[https://github.com/MaxBelkov/visualsyslog/releases Visual Syslog Server for Windows] - Opensource, lots of options.
Linux already has syslogd built in. Linux already has syslogd built in.
 +
 +==Remote logging with Papertrail==
 +[https://papertrailapp.com Papertrail] provides hosted log management, live in minutes.
 +It's free of charge (if you do not need more than 100MB a month). Setup is easy with a just few of clicks.
 +You can access and see your logs from anywhere in the world by visiting Papertrail web page.
 +
 +<p>Once you have a Papertrail account, the easiest way to setup the website logging in DD-WRT is to use the unique hostname and port that Papertrail provides to you for your account, and paste it into the Remote Server field.</p>
 +
 +<p><ol>
 +<li>Go to the '''Settings''' tab in Papertrail</li>
 +<li>Click '''Log Destinations''' tab</li>
 +<li>Copy the url and port number provided (i.e. logs2.papertrailapp.com:xxxxx)</li>
 +<li>Go to the Services tab in DD-WRT</li>
 +<li>Enable Syslog on the Services tab</li>
 +<li>Paste the url from step 3 into the '''Remote Server''' field for Syslog</li>
 +<li>Apply changes, and your router will begin sending logs to the Papertrail website</li>
 +</ol></p>
 +
 +==Remote logging with Logentries==
 +[https://logentries.com Logentries] is an easy-to-use, self-hosted log management and analytics service for teams of all sizes.
==Displaying logs in your web browser== ==Displaying logs in your web browser==
Line 28: Line 49:
create a symbolic link in /tmp/www create a symbolic link in /tmp/www
-ln -s /tmp/var/log/messages /tmp/www/log.html+ ln -s /tmp/var/log/messages /tmp/www/log.html
now go to: now go to:
-http://192.168.1.1/user/log.html+ http://192.168.1.1/user/log.html
(credits to kuthulu for that tip) (credits to kuthulu for that tip)
 +
 +If you are on ddwrt v3.0 on a kernel 3.10 and above, you can see your logs by typing:
 +
 + http://192.168.1.1/Syslog.asp
 +
 +in your web browser (assuming 192.168.1.1 is IP of your ddwrt router)
====micro versions==== ====micro versions====
Line 49: Line 76:
Another option is to restart the syslog daemon, telling it to save the logfile in a new place. For example: Another option is to restart the syslog daemon, telling it to save the logfile in a new place. For example:
- killall syslogd + killall syslogd
- syslogd -L -s 8192 -O /opt/var/log/messages+ syslogd -L -s 8192 -O /opt/var/log/messages<br>
 + ''#credits to frater for the commands''
Note: If you choose to restart syslogd, you'll probably want to do it in a startup script. Note: If you choose to restart syslogd, you'll probably want to do it in a startup script.
Line 57: Line 85:
[[dmesg command]] [[dmesg command]]
-[[Category: English documentation]][[Category: Basic tutorials]]+[[Category:Monitoring]]
 +[[Category: Basic tutorials]]

Revision as of 03:22, 9 December 2017

Contents

Overview

DD-WRT uses the syslog and klog daemons to log system, kernel, and firewall events. This can be useful for troubleshooting purposes, or just to keep an eye on how your router/network is behaving.

Setup

Logging is probably disabled by default. To enable it:

  1. Enable Syslogd under the Services tab.
    • If you wish to send logs to a remote system, enter the IP address of that machine which is also running a syslog utility (it needs an open network socket in order to accept logs being sent by the router).
  2. To log firewall events, go to the Security tab and enable the appropriate options under Log Management. (Note: this doesn't function in micro)

That's all there is to it. DD-WRT should now be logging...either locally to /tmp/var/log/messages, or remotely to the IP address you specified earlier.

Recommended tools

Here are some utilities you may wish to check out if you're logging remotely:

WallWatcher
syslog-ng (CYGWIN)
Kiwi Syslog
Link Logger
Visual Syslog Server for Windows - Opensource, lots of options.

Linux already has syslogd built in.

Remote logging with Papertrail

Papertrail provides hosted log management, live in minutes. It's free of charge (if you do not need more than 100MB a month). Setup is easy with a just few of clicks. You can access and see your logs from anywhere in the world by visiting Papertrail web page.

Once you have a Papertrail account, the easiest way to setup the website logging in DD-WRT is to use the unique hostname and port that Papertrail provides to you for your account, and paste it into the Remote Server field.

  1. Go to the Settings tab in Papertrail
  2. Click Log Destinations tab
  3. Copy the url and port number provided (i.e. logs2.papertrailapp.com:xxxxx)
  4. Go to the Services tab in DD-WRT
  5. Enable Syslog on the Services tab
  6. Paste the url from step 3 into the Remote Server field for Syslog
  7. Apply changes, and your router will begin sending logs to the Papertrail website

Remote logging with Logentries

Logentries is an easy-to-use, self-hosted log management and analytics service for teams of all sizes.

Displaying logs in your web browser

create a symbolic link in /tmp/www

ln -s /tmp/var/log/messages /tmp/www/log.html

now go to:

http://192.168.1.1/user/log.html

(credits to kuthulu for that tip)

If you are on ddwrt v3.0 on a kernel 3.10 and above, you can see your logs by typing:

http://192.168.1.1/Syslog.asp

in your web browser (assuming 192.168.1.1 is IP of your ddwrt router)

micro versions

Micro versions have a stripped down version of BusyBox, so it might not include the ln command used above. In that case, you can use a different method to view the logs from within your browser, shown below.

Issue the following command from the Web Interface -> Commands section (or via Telnet):

cat /tmp/var/log/messages

As noted in the Setup section, the logfile in micro currently does not show any firewall events, unfortunately.

Saving the logfile across reboots

If you have some external storage such as a USB hard drive or SD/MMC card, you can probably use a CRON job and/or shutdown script to copy the logfile there.

Another option is to restart the syslog daemon, telling it to save the logfile in a new place. For example:

killall syslogd
syslogd -L -s 8192 -O /opt/var/log/messages
#credits to frater for the commands

Note: If you choose to restart syslogd, you'll probably want to do it in a startup script.

See Also

dmesg command