<div dir="ltr"><div style>Hello, list.</div><div style><br></div><div style>I've been trying to parse my apache logs in order to separate log messages into different files based on a column provided by the parser, which in my case is $APACHE.SERVER_NAME.</div>
<div style><br></div><div style>It's pretty much the same as the example available on the Administrator Guide, in section 3.8, p 60.</div><div style><br></div><div style>Looks like I'm close to get it working but there are two problems which I could not solve:</div>
<div style><br></div><div style>1- The first field of the log (APACHE.CLIENT_IP) vanishes when it reaches its final destination and for that reason APACHE.SERVER_NAME, which is the last column in the parser is empty. That messes up the file creation on the server. Not mentioning the important log data loss.</div>
<div style><br></div><div style>2- Syslog-ng server only logs for a few seconds and suddenly stops. Whenever the client is reloaded, it starts logging for a few seconds again. Nothing useful for debugging shows up at the server or client internal logs.</div>
<div style><br></div><div style>Hope you guys can lend me a hand here. Please let me know if you need any other information.</div><div style><br></div><div style>Here are the meaningful config sections on both the server and the client.</div>
<div style><br></div><div style>(I think it's worth mentioning that the sources, destinations and the parser below are not used by any other log paths.)</div><div style><br></div><div style>########### SERVER</div><div style>
<br></div><div style><div>options {</div><div> flush_lines (0);</div><div> time_reopen (10);</div><div> log_fifo_size (1000);</div><div> long_hostnames (off);</div><div> use_dns (no);</div>
<div> use_fqdn (no);</div><div> create_dirs (no);</div><div> keep_hostname (yes);</div><div> owner("root");</div><div> group("adm");</div><div> perm(0640);</div>
<div>};</div><div><br></div></div><div style><div>source s_remote_apache {</div><div> tcp(ip(0.0.0.0) port(51480));</div><div>};</div><div><br></div><div>destination d_apache { file("/var/log/httpd/${APACHE.SERVER_NAME:-nouser}.log" template("MSGONLY\n")); };<br>
</div><div><br></div><div><div>parser p_apache {</div><div> csv-parser(columns("APACHE.CLIENT_IP", "APACHE.IDENT_NAME", "APACHE.USER_NAME",</div><div> "APACHE.TIMESTAMP", "APACHE.REQUEST_URL", "APACHE.REQUEST_STATUS",</div>
<div> "APACHE.CONTENT_LENGTH", "APACHE.REFERER", "APACHE.USER_AGENT",</div><div> "APACHE.PROCESS_TIME", "APACHE.SERVER_NAME")</div>
<div> flags(escape-double-char,strip-whitespace)</div><div> delimiters(" ")</div><div> quote-pairs('""[]')</div><div> );</div><div>};</div>
</div><div><br></div><div>log { source(s_remote_apache); parser(p_apache); destination(d_apache); };<br></div><div><br></div><div><br></div><div style>############ CLIENT</div><div style><br></div><div style><div>options {</div>
<div> sync (0);</div><div> time_reopen (10);</div><div> log_fifo_size (1000);</div><div> long_hostnames (off);</div><div> use_dns (yes);</div><div> use_fqdn (no);</div><div> create_dirs (no);</div>
<div> keep_hostname (yes);</div><div>};</div></div><div style><br></div><div style><div>source s_apache {</div><div> file ("/var/log/httpd/access_log" flags(no-parse));</div><div>};</div><div><br>
</div>
<div><div>destination d_apache_remote {</div><div> tcp("<a href="http://myhost.example.com">myhost.example.com</a>" port(51480));</div><div>};</div></div><div><br></div><div>log { source(s_apache); destination(d_apache_remote); };<br>
</div></div></div><div style><br></div><div><br></div><br clear="all"><div><div><font color="#888888" style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255);color:rgb(136,136,136)"><font color="#888888">Luis Alen<br>
</font></font><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255);color:rgb(136,136,136)"><font color="#888888"><a href="http://www.izap.com.br/" style="color:rgb(17,85,204)" target="_blank">www.izap.com.br</a><br>
</font><font color="#999999"><font size="1">Ligue com tarifa local de todo o Brasil</font> 4020.3000 <font><a value="+13186810642" style="color:rgb(17,85,204)"></a></font></font></div><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255);color:rgb(136,136,136)">
<br></div><div style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255);color:rgb(136,136,136)"><img src="http://izap.com.br/plus/temas/izap-v3/img/logo.png" width="96" height="33"></div></div>
</div>
</div>