2

Using the Pure-ftpd daemon to serve ftp service. I've modified the init script to run multiple domains with different IPs, with separate DBs and separate WELCOME MSGs.

daemon "$pure_launch_script /etc/pure-ftpd/dom1.conf --daemonize > /dev/null -F /etc/pure-ftpd/dom1.msg"
daemon "$pure_launch_script /etc/pure-ftpd/dom2.conf --daemonize > /dev/null -F /etc/pure-ftpd/dom2.msg"
daemon "$pure_launch_script /etc/pure-ftpd/dom3.conf --daemonize > /dev/null -F /etc/pure-ftpd/dom2.msg"

Everything working flawlessly and perfect without errors. But the pain the ass is that all the domains that i serving are logged (verbose) in only one xfer.log file. It's not comfortable for investigate and monitor the activity. My system using rsyslog wich is very advanced ... So, my only solution that i see is to filter the messages, but must be filtered by the IP of the interface that is dedicated to the each one of the multiple servers and can't find filter for this in rsyslog. That only option is fromhost-ip ... wich is not working in my case, can't filter by $msg contains because the users are logged like user@remoteip...

I'm the black hole now... if somebody have a good idea it will be great.

Stavry
  • 31
  • 3
  • Are details you want logged in case of using "-O" switch? Or maybe you want to enable verbose log. – GioMac Aug 28 '13 at 19:00
  • "-O" not work with xfer log format, now i use verbose log ... but now everything is in 1 file... big mess... – Stavry Aug 28 '13 at 19:25
  • Your goal is to monitor activity and define to which instance does it belong, right? Or you want to have xfer log too? – GioMac Aug 28 '13 at 19:41
  • I need to separate the xfer log (verbose log generated by rsyslog) to each one process which is started by init script that i modified. The init script starts multiple instances of daemon with different settings but the log file is only one. – Stavry Aug 28 '13 at 19:47
  • A very nice question, here's your answer :) – GioMac Aug 28 '13 at 19:53

1 Answers1

0

A. You need to modify the code (ouch)

B. Create named pipe, so all three instances can write to it, from the other side you can read all messages with simple script and according to running pid you'll know to which instance does the message belong to

http://www.linuxjournal.com/content/using-named-pipes-fifos-bash

With other manipulations I'm very sure you can automate it by writing variables (PID) during the startup of each instance, so you won't need to check pid of instance everytime you parse the output.

GioMac
  • 4,544
  • 4
  • 27
  • 41
  • I search for more simple solution, i think the rsyslog daemon can do more things that i don't know... thank u for your solution... – Stavry Aug 29 '13 at 07:04
  • The only difference between instances is PID and listened ip address. Instances aren't showing it's address in output, so, only option is PID. You can add `$SystemLogUsePIDFromSystem on` to the rsyslog configuration and it will add PID's to the message, but you need to know to which instance does it belong to, this cannot be done with rsyslog, so, rsyslog is not an option. This is the simplest solution - you only need to write a very simple bash script and check pid of pure-ftpd instance when starting. – GioMac Aug 29 '13 at 09:31