[syslog-ng]$HOST variable
Chris Sibbitt
CSibbitt@jetnet.ca
Fri, 3 Aug 2001 13:16:18 -0400
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C11C40.022EA2E0
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C11C40.022EA2E0"
------_=_NextPart_001_01C11C40.022EA2E0
Content-Type: text/plain;
charset="iso-8859-1"
Greetings. I'm having a problem with getting syslog-ng to write out to
filenames based on $HOST. My setup is as follows:
-I have two machines running syslog-ng
-Machine A has a program that sends syslog messages to itself (127.0.0.1)
-Machine A has a tcp destination rule like: destination Machine_B{
tcp(10.1.1.1); }
-Machine B has a tcp source rule that receives the messages from Machine A
-Machine B has a destination rule like: destination host_logs {
file("/logs/$HOST.txt"); }
The problem is that what I end up with on Machine B is a file called
/logs/127.0.0.1 that contains all the messages generated by the program on
Machine A. They look like this:
Aug 3 09:12:48 127.0.0.1/127.0.0.1/10.1.1.2 myprog[2182]: Test message
I've fiddled with setting keep_hostname() to yes and no on Machine B, but
to no avail... apparently this doesn't affect the $HOST variable. I know
that chain_hostnames(no) fixes the problem (I get a file named 10.1.1.2,
which is what I want), but I'd really like to see the whole path the message
took because sometimes Machine A will receive messages from others that get
forwarded on. Is there any way to accomplish this.
In simple terms, I think I'm looking for a way to get the $HOST variable to
pick the LAST hostname in the chain instead of the first. Any ideas, or do I
need to edit the code? If the later is the case, I'm pretty sure I need to
fix something in expand_macro() (in affile.c), if anyone knows exactly how
this should be done some help would be appreciated, otherwise I'll dust off
my debugger skills and see what I can accomplish. I hope it doesn't come to
that though.
JetNet Logo
Chris Sibbitt
Operations Development
106 Schneider Road, Unit C
Kanata, Ontario K2K 1Y2
Phone (613) 271-6220, ext228
Fax (613) 271-6229
------_=_NextPart_001_01C11C40.022EA2E0
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.00.2314.1000" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001> Greetings. I'm
having a problem with getting syslog-ng to write out to filenames based on
$HOST. My setup is as follows:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=497434915-03082001></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001>-I have two machines
running syslog-ng</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001>-Machine A has a
program that sends syslog messages to itself (127.0.0.1)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001>-Machine A has a tcp
destination rule like: destination Machine_B{ tcp(10.1.1.1);
}</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001>-Machine B has a tcp
source rule that receives the messages from Machine A </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001></SPAN></FONT><FONT
face=Arial size=2><SPAN class=497434915-03082001>-Machine B has a destination
rule like: destination host_logs { file("/logs/$HOST.txt");
}</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001> The problem is
that what I end up with on Machine B is a file called /logs/127.0.0.1 that
contains all the messages generated by the program on Machine A. They look like
this:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=497434915-03082001></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001></SPAN></FONT><FONT
face=Arial size=2><SPAN class=497434915-03082001>Aug 3 09:12:48
127.0.0.1/127.0.0.1/10.1.1.2 myprog[2182]: Test message</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=497434915-03082001></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001> I've fiddled
with setting keep_hostname() to yes and no on Machine B, but to no avail...
apparently this doesn't affect the $HOST variable. I know that
chain_hostnames(no) fixes the problem (I get a file named 10.1.1.2, which is
what I want), but I'd really like to see the whole path the message took because
sometimes Machine A will receive messages from others that get forwarded on. Is
there any way to accomplish this.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001></SPAN></FONT><FONT
face=Arial size=2><SPAN class=497434915-03082001></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=497434915-03082001> In simple
terms, I think I'm looking for a way to get the $HOST variable to pick the LAST
hostname in the chain instead of the first. Any ideas, or do I need to edit the
code? If the later is the case, I'm pretty sure I need to fix something in
expand_macro() (in affile.c), if anyone knows exactly how this should be done
some help would be appreciated, otherwise I'll dust off my debugger skills and
see what I can accomplish. I hope it doesn't come to that
though.</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><IMG align=baseline alt="JetNet Logo" border=0 hspace=0
src="cid:497434915@03082001-1e10"></DIV>
<DIV><FONT face=Arial size=2>Chris Sibbitt</FONT></DIV>
<DIV><FONT face=Arial size=2>Operations Development</FONT></DIV>
<DIV><FONT face=Arial size=2>106 Schneider Road, Unit C</FONT></DIV>
<DIV><FONT face=Arial size=2>Kanata, Ontario K2K 1Y2</FONT></DIV>
<DIV><FONT face=Arial size=2>Phone (613) 271-6220, ext228</FONT></DIV>
<DIV><FONT face=Arial size=2>Fax (613)
271-6229</FONT></DIV>
<DIV> </DIV></BODY></HTML>
------_=_NextPart_001_01C11C40.022EA2E0--
------_=_NextPart_000_01C11C40.022EA2E0
Content-Type: image/gif;
name="200x40.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="200x40.gif"
Content-ID: <497434915@03082001-1e10>
R0lGODlhyAAnAPf/AP///wgICBAQEBgYGCEhISkpKTExMTk5OUJCQkpKSlJSUlpaWmNjY2tra3Nz
c3t7e4SEhIyMjJSUlJycnKWlpa2trbW1tb29vcbGxs7OztbW1t7e3ufn5+/v7/f39+/n5/fv7//3
987G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