Find the answer to your Linux question:
Results 1 to 7 of 7
I have some databases which log to a flat text file and I don't think that this version can log to syslog, so I'd like to stream the log file ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie humbletech99's Avatar
    Join Date
    Nov 2005
    Posts
    225

    Logging - Text File to Syslog


    I have some databases which log to a flat text file and I don't think that this version can log to syslog, so I'd like to stream the log file into syslog myself. I figure that keeping something like this running should work:
    Code:
    tail -f /path/to/logfile | logger
    or
    Code:
    logger -f /path/to/logfile
    My question is whether or not there is a better way of doing this?

    I think that if this process is restarted, and the logfile is always quite large, that it will read at least some of it again and duplicate that information into syslog which I'd like to avoid.

    Is there a better way, some program perhaps that will remember it's position in the logfile and if crashed/restarted will pick up again from that exact point without missing anything or reinserting the same log information again, possibly also handling log truncation or rotation? Does logger -f have an intelligence on this?
    The Human Equation:

    value(geeks) > value(mundanes)

  2. #2
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    What is the application doing the logging exactly? Usually daemons write to a syslog facility, which you can configure appropriately.

  3. #3
    Linux Newbie humbletech99's Avatar
    Join Date
    Nov 2005
    Posts
    225
    this is Oracle 9i, I don't believe it has a syslog feature in this version from what I'm told.

    I also want to know how to do this in a nice way because it's a cool thing to do in general should I need it in some other situation for some other program.


    Does anyone know of a program like tail -f but with a memory for where it was in the file and handle log switching/truncation?
    The Human Equation:

    value(geeks) > value(mundanes)

  4. #4
    Just Joined!
    Join Date
    Jun 2007
    Posts
    6
    I will implement a text file input for rsyslog (syslogd supporting MySQL and TCP :: rsyslog ) this month (already begun to do so). If you are still interested, I would love to discuss feature set and of course I am also looking for testers.

    Rainer

  5. #5
    Linux Newbie humbletech99's Avatar
    Join Date
    Nov 2005
    Posts
    225
    syslog-ng already has this so I'm not sure it's worth re-inventing the wheel.

    The only reason I'm not using syslog-ng in this instance is that is a package-cripplied rpm rhel system that I cannot easily upgrade and is in heavy production so I'd rather not mess with it.

    So in this instance, I am really stuck with a text file that I need a way of intelligently tailing...
    The Human Equation:

    value(geeks) > value(mundanes)

  6. #6
    Just Joined!
    Join Date
    Jun 2007
    Posts
    6
    Quote Originally Posted by humbletech99 View Post
    syslog-ng already has this so I'm not sure it's worth re-inventing the wheel.
    Yeah, I know it has this feature, but rsyslog shall provide it, too, so that it is a complete package. Its especially important as rsyslog now has a lot of features syslog-ng does not offer, at least not in the open source edition.

    Quote Originally Posted by humbletech99 View Post
    The only reason I'm not using syslog-ng in this instance is that is a package-cripplied rpm rhel system that I cannot easily upgrade and is in heavy production so I'd rather not mess with it.
    I see... that's a restraint...

    Quote Originally Posted by humbletech99 View Post
    So in this instance, I am really stuck with a text file that I need a way of intelligently tailing...
    Well, you could still use rsyslog for that. The v3 branch has very modular inputs and outputs. So once the file reader is ready, you could create an instance of rsyslog that does only run the file reader (and output to syslog) and run that alongside syslog-ng. Sounds a bit usual, but could be a good option for that use case...

    HTH
    Rainer

  7. #7
    Just Joined!
    Join Date
    Jun 2007
    Posts
    6
    Rsyslog now supports text file to syslog conversion via the imfile plugin. Documentation is available on the site:

    Text File Input Monitor :: syslogd supporting MySQL and TCP :: rsyslog

    I would appreciate any deployment reports, including feature enhancement requests.

    Rainer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •