Sunday, January 20, 2013

auth.log Service Restart

I tried to incorporate my auth.log file into logrotate and didn't use copytruncate in my logrotate.d configuration file, so I ended up with a missing auth.log file. I tried to recreate auth.log by copying auth.log.0 and chown'ing it syslog:adm, but I ended up with an auth.log that wasn't being updated because the authentication daemon no longer had a handle to the file.

Rather than reboot the whole server, I wanted to restart the service that writes to auth.log. I found a reference to rsyslog, but I was a couple of versions of Ubuntu later than the 10.04 mentioned in that conversation. (Ubuntu 12.04 LTS) so I ended up getting "rsyslog: unrecognized service" when I tried that.

I ran "service --status-all" to get a list of services on the machine and "sysklogd" looked promising so I tried restarting it.

user@server:~# service sysklogd restart
 * Restarting system log daemon...                                       [ OK ]

Then I exited SSH and logged back in, to find that my auth.log file was getting written to again.

Saturday, January 19, 2013

regex capture $1 refers to no regex

I discovered this warning in my Apache log after adding a command via mod_include which utilized awk. When I placed backslashes before the dollar signs in my html page, the error disapeared.

To

awk '{print \$1\"/\"\$2\"/\"\$3}'

From

awk '{print $1\"/\"$2\"/\"$3}'