# smartd not logging



## Pfarthing6 (Jul 21, 2011)

Hey there,

So, I got smartmontools all setup, even configured periodic to send me daily reports, but smartd isn't logging anything locally. 

According to the man page, it's supposed to poll every 30 minutes and by default log to the daemon facility of syslog.

What's unlcear, is if I should see an entry every 30 minutes that shows that it polled or only see a log entry if there are errors or changes to the smart status of the disk?

Normally I'd expect a log entry just to show that the service is doing what it's supposed to, not just for errors. But the man page is a bit fuzzy. 

Relevant smartd man page snippet:

```
smartd  will attempt to enable SMART monitoring on ATA devices (equiva-
lent to smartctl -s on) and polls these and SCSI devices every 30  min-
utes   (configurable),  logging  SMART  errors  and  changes  of  SMART
Attributes via the SYSLOG interface.  The default  location  for  these
SYSLOG   notifications  and  warnings  is  system-dependent  (typically
/var/log/messages or /var/log/syslog).  To change  this  default  loca-
tion, please see the '-l' command-line option described below.


-l FACILITY, --logfacility=FACILITY
  Uses  syslog  facility FACILITY to log the messages from smartd.
  Here FACILITY is one of local0, local1, ..., local7,  or  daemon
  [default].   If  this  command-line  option is not used, then by
  default messages from smartd are logged to the facility  daemon.
```

I'm assuming here that "-l" is optional and if not present, smartd will do as indicated, polling every 30 min and log the results to the facility "daemon", as indicated above (which in turn should go to messages or syslog logs). 

Is this right?

This is my smartd.conf:

```
DEVICESCAN -a -s (S/../.././02|L/../../6/03)
```


Looking at the default syslog.conf however, there is no daemon facility:

```
[tim@nas1 ~]$ cat /etc/syslog.conf
# $FreeBSD: src/etc/syslog.conf,v 1.30.2.1 2009/08/03 08:13:06 kensmith Exp $
# extraneous comments removed
*.err;kern.warning;auth.notice;mail.crit                /dev/console
*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err   /var/log/messages
security.*                                      /var/log/security
auth.info;authpriv.info                         /var/log/auth.log
mail.info                                       /var/log/maillog
lpr.info                                        /var/log/lpd-errs
ftp.info                                        /var/log/xferlog
cron.*                                          /var/log/cron
*.=debug                                        /var/log/debug.log
*.emerg                                         *
!ppp
*.*                                             /var/log/ppp.log
!*
```

So, I added a daemon facility like so:

```
daemon.*;*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err  /var/log/messages
```

And I also hupped syslogd so that the new settings would take.

Any helpful hints are appreciated!


----------



## DutchDaemon (Jul 22, 2011)

I think it only logs if there is something to report. I have a number of machines running smartd and reporting to a central syslog server, but all I get are these:


```
Jul 22 00:14:11 box1 smartd[32843]: Device: /dev/ad4, Failed SMART usage Attribute: 190 Airflow_Temperature_Cel.
Jul 22 00:14:11 box1 smartd[32843]: Device: /dev/ad8, Failed SMART usage Attribute: 190 Airflow_Temperature_Cel.
Jul 22 00:14:27 box2 smartd[1356]: Device: /dev/ada0, SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 62 to 60
Jul 22 00:14:27 box2 smartd[1356]: Device: /dev/ada0, SMART Usage Attribute: 194 Temperature_Celsius changed from 38 to 40
Jul 22 00:44:12 box1 smartd[32843]: Device: /dev/ad4, Failed SMART usage Attribute: 190 Airflow_Temperature_Cel.
Jul 22 00:44:12 box1 smartd[32843]: Device: /dev/ad8, Failed SMART usage Attribute: 190 Airflow_Temperature_Cel.
Jul 22 00:44:26 box2 smartd[1356]: Device: /dev/ada0, SMART Usage Attribute: 195 Hardware_ECC_Recovered changed from 77 to 76
Jul 22 01:14:12 box1 smartd[32843]: Device: /dev/ad4, Failed SMART usage Attribute: 190 Airflow_Temperature_Cel.
Jul 22 01:14:12 box1 smartd[32843]: Device: /dev/ad8, Failed SMART usage Attribute: 190 Airflow_Temperature_Cel.
```

The other boxes are silent, because there's nothing to report.


----------



## Terry_Kennedy (Jul 22, 2011)

DutchDaemon said:
			
		

> I think it only logs if there is something to report. I have a number of machines running smartd and reporting to a central syslog server, but all I get are these:


smartd has gotten a lot chattier in recent versions. I'll attach a log file showing what is logged in my daemon.log (I can't include it in this post because it exceeds the forum limit of 10K). The main thing is that it will report:

```
offline data collection was completed without error
```
for each drive at intervals.

To the OP - I specified a separate daemon.log file in syslog.conf:

```
*** syslog.conf_orig    Mon Apr 19 17:26:04 2010
--- syslog.conf Thu Apr 22 21:20:42 2010
***************
*** 13,18 ****
--- 13,19 ----
  lpr.info                                      /var/log/lpd-errs
  ftp.info                                      /var/log/xferlog
  cron.*                                                /var/log/cron
+ daemon.*                                      /var/log/daemon.log
  *.=debug                                      /var/log/debug.log
  *.emerg                                               *
  # uncomment this to log all writes to /dev/console to /var/log/console.log
```

Which makes it easier to separate the daemon stuff out from other things (one of my central syslog servers processes many 100's of log messages/second, and sorting them to separate files in syslogd helps a lot. If you do this, don't forget to create the file (syslogd won't create it for you) and have a plan in place for rotating the file during the nightly periodic processing.

Note that the version of sysutils/smartmontools I'm running is rather heavily-modified from stock - the initial reason was a 3Ware firmware revision which would report failure if smartd made a request while there was very heavy I/O loading (700MB/sec or more) on the controller. I patched the port to work around this and submitted the changes upstream, but never heard anything back. Later versions wouldn't even start properly on a 3Ware controller, instead claiming that the controller was busy. Hence, more patches. None of this should affect you if you don't have a 3Ware controller.


----------



## DutchDaemon (Jul 22, 2011)

Terry_Kennedy said:
			
		

> smartd has gotten a lot chattier in recent versions.



Using smartmontools-5.41_2 here, so maybe it's in some flags that I do not use?


----------

