Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a bunch of logs which are not created using syslog. I would like to export them to another host. If possible using syslog or rsyslog. A pipe?

how can I do that?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You want rsyslog's imfile module.

The documentation and the use of these modules differs depending on which version of rsyslog you are using (v7 or v8+). Since log forwarding isn't working in v8 yet (according to the docs), here is some example v7 syntax:

# /etc/rsyslog.conf

$ModLoad imfile

<... other configuration ...>

$InputFileName /var/log/custom.log
$InputFileTag custom:
$InputFileStateFile custom.state
$InputRunFileMonitor

<... repeat for each file ...>

# send all facility/severity to another syslog server
*.* @@my.syslog.server:514

NB: each file needs its own unique state file. By default, messages are severity notice and facility local0. If you wanted to change these, look up the imfile documentation.

share|improve this answer
    
Thanks it's working very well :) –  momeunier Mar 18 at 13:21

Two possible ways:

  1. Cron job with scp or rsync, to copy the files over, say every hour. This would work even if the target host for the log files is outside of your LAN.
  2. NFS mount (read-only) of the log directory on the target host. This would be best within your LAN, since the log files would always be up-to-date there.

I'm not sure if syslog or rsyslog could do this directly. Maybe they could, but you'd have to read the docs to find out.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.