log to nfs and buffer if unavailable

This is the place for you, if you got rsyslog up and running but wonder how to make it do what you want.

Moderator: rgerhards

log to nfs and buffer if unavailable

Postby awinberg » Wed Mar 11, 2009 2:40 pm

Hi,

i'm trying to set up my central rsyslog-server to log messages directly to a nfs share. however, i need some method to deal with the possible situation of that nfs share being unavailable. ideally, the messages would then be buffered in the same way as i have set up on the clients as described in http://www.rsyslog.com/doc-rsyslog_reli ... rding.html.

however, i cant make it work. any ideas?

//Adam

config snippet:
*********************************************
$template DYNmessages,"/data/temp/log/tcp/HOSTS/%HOSTNAME%/%$year%/%$month%/%$day%/messages"

WorkDirectory /var/spool/rsyslog # where to place spool files
$ActionQueueType LinkedList # use asynchronous processing
$ActionQueueFileName srvrfwd1 # set file name, also enables disk mode
$ActionResumeRetryCount -1 # infinite retries on insert failure
$ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down
if $inputname != 'imudp' \
and $syslogseverity-text != 'debug' \
and ( $syslogfacility-text != 'mail' and $syslogfacility-text != 'authpriv' and $syslogfacility-text != 'cron' ) \
then ?DYNmessages
# ### end forwarding rule ###
*********************************************
awinberg
Avarage
 
Posts: 23
Joined: Wed Mar 11, 2009 2:16 pm

Professional Services Information

  • Custom written rsyslog.conf?
  • Maintenance Contract?
  • Installation support?

Re: log to nfs and buffer if unavailable

Postby rgerhards » Wed Mar 11, 2009 2:42 pm

umm.. plainly: that is not currently possible (but reminds me that I wanted to look at the file output so that it supports restartable actions).

Sorry...

Rainer
User avatar
rgerhards
Site Admin
 
Posts: 2647
Joined: Thu Feb 13, 2003 11:57 am

Re: log to nfs and buffer if unavailable

Postby awinberg » Wed Mar 11, 2009 2:48 pm

wow, fast reply!

ok, i'll try to think of a workaround or something.

thanks!
awinberg
Avarage
 
Posts: 23
Joined: Wed Mar 11, 2009 2:16 pm

Re: log to nfs and buffer if unavailable

Postby rgerhards » Wed Mar 11, 2009 2:49 pm

would you be willing to test a devel version and work with me? I could probably add this quickly (no promise), but I currently have no time for real testing...
User avatar
rgerhards
Site Admin
 
Posts: 2647
Joined: Thu Feb 13, 2003 11:57 am

Re: log to nfs and buffer if unavailable

Postby awinberg » Wed Mar 11, 2009 3:08 pm

sure, i'll be happy to try to help!
awinberg
Avarage
 
Posts: 23
Joined: Wed Mar 11, 2009 2:16 pm

Re: log to nfs and buffer if unavailable

Postby rgerhards » Wed Mar 11, 2009 3:09 pm

ok, bear with me a little, will try to look at code asap. If you are curios, you can check http://twitter.com/rgerhards to see what I am working on.

Rainer
User avatar
rgerhards
Site Admin
 
Posts: 2647
Joined: Thu Feb 13, 2003 11:57 am

Re: log to nfs and buffer if unavailable

Postby rgerhards » Wed Mar 11, 2009 3:30 pm

OK, this looks like it was way tooooooo trivial, anyhow. A tarball is available here:

http://git.adiscon.com/?p=rsyslog.git;a ... 469;sf=tgz

You need to run

$ autoreconf -vfi

before you call ./configure (as usual).

I did absolutely no testing, but I'd say 70% chance it works. Please report back.

You can also pull from git, the branch is "omfile-errHandler".

Rainer
User avatar
rgerhards
Site Admin
 
Posts: 2647
Joined: Thu Feb 13, 2003 11:57 am

Re: log to nfs and buffer if unavailable

Postby awinberg » Wed Mar 11, 2009 3:58 pm

ran into some problems - the autoconf i have access to is too old (2.59).
awinberg
Avarage
 
Posts: 23
Joined: Wed Mar 11, 2009 2:16 pm

Re: log to nfs and buffer if unavailable

Postby rgerhards » Wed Mar 11, 2009 3:59 pm

args - let me create a temporary tarball...
User avatar
rgerhards
Site Admin
 
Posts: 2647
Joined: Thu Feb 13, 2003 11:57 am

Re: log to nfs and buffer if unavailable

Postby rgerhards » Wed Mar 11, 2009 4:03 pm

here we go: http://download.rsyslog.com/rsyslog/tmp.tar.gz (can change at any time ;))
User avatar
rgerhards
Site Admin
 
Posts: 2647
Joined: Thu Feb 13, 2003 11:57 am

Re: log to nfs and buffer if unavailable

Postby awinberg » Wed Mar 11, 2009 4:20 pm

hm, same problem:

[root@lxserv140 rsyslog-4.1.5]# autoreconf -vfi
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
configure.ac:4: error: Autoconf version 2.61 or higher is required
configure.ac:4: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: autom4te failed with exit status: 63
autoreconf: aclocal failed with exit status: 63
awinberg
Avarage
 
Posts: 23
Joined: Wed Mar 11, 2009 2:16 pm

Re: log to nfs and buffer if unavailable

Postby rgerhards » Wed Mar 11, 2009 4:21 pm

you don't need the autoreconf with that tarball - it's a regular distribution tarball :)
User avatar
rgerhards
Site Admin
 
Posts: 2647
Joined: Thu Feb 13, 2003 11:57 am

Re: log to nfs and buffer if unavailable

Postby awinberg » Wed Mar 11, 2009 4:47 pm

ok, got it running - but my configuration does not work, the messages are discarded if the nfs mount is unavailable.

is my original configuration supposed to work?

i should probably say that the initial problem was that if the nfs mount is unavailable rsyslog of course just writes to local disk. to get around this and force rsyslog to encounter an error when trying this i made "chattr +i" on the nfs mount dir. this worked, rsyslog cant write there but discards the messages. a better way to fix that might be to use the drop privileges config, but this was not available in my rsyslog version.
awinberg
Avarage
 
Posts: 23
Joined: Wed Mar 11, 2009 2:16 pm

Re: log to nfs and buffer if unavailable

Postby rgerhards » Wed Mar 11, 2009 4:49 pm

the config looks fine. Can you create a debug log http://www.rsyslog.com/doc-troubleshoot.html while NFS goes offline and mail me the output (rgerhards@gmail.com, but ping me here when you have done). Maybe I can see something from the log (should so), if not, I need to do some testing, which probably means next week :(
User avatar
rgerhards
Site Admin
 
Posts: 2647
Joined: Thu Feb 13, 2003 11:57 am

Re: log to nfs and buffer if unavailable

Postby awinberg » Wed Mar 11, 2009 5:00 pm

debug output sent!
awinberg
Avarage
 
Posts: 23
Joined: Wed Mar 11, 2009 2:16 pm

Google Ads


Next

Return to Configuration

Who is online

Users browsing this forum: No registered users and 1 guest

cron