title: Sending apache logs to remote rsyslog server adds extra space
body: <p>I'm trying to send Apache/2.2.22 (Ubuntu) logs to remote rsyslogd  8.2001.0 (aka 2020.01) server and then use awstats 7.6 (build 20161204). I have problem with format and awstats shows that lines a corrupted I'm guessing that lines corrupted because of one extra white space in the beginning. Can someone tell me why rsyslog adds this extra space or how to remove it ? Log looks like:</p>
  <pre><code>  x.x.x.x - - [06/Jan/2022:08:39:07 +0200] &quot;GET /1.php HTTP/1.1&quot; 200 2906 &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36&quot;
  </code></pre>
  <p>But should look like:</p>
  <pre><code>x.x.x.x - - [06/Jan/2022:08:39:07 +0200] &quot;GET /1.php HTTP/1.1&quot; 200 2906 &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36&quot;
  </code></pre>
  <p>My apache config to send logs to local7:</p>
  <pre><code>CustomLog &quot;| /bin/bash -c /usr/bin/tee -a ${APACHE_LOG_DIR}/access-my.domain.log | /usr/bin/logger -t my.domain.com -p local7.info&quot; combined  
  </code></pre>
  <p>Sender rsyslog config:</p>
  <pre><code>$ModLoad imfile
  $InputFilePollInterval 10
  $InputFileName  /var/log/apache2/access-*.log
  $InputFileTag apache2-access
  $InputFileStateFile stat-apache-access
  $InputFileSeverity info
  $InputRunFileMonitor
  $InputFileFacility local7
  local7.*        @x.x.x.x
  </code></pre>
  <p>Receiver rsyslog:</p>
  <pre><code>module(load=&quot;imudp&quot;)
  input(type=&quot;imudp&quot; port=&quot;514&quot;)
  $template mydomain, &quot;/var/log/remote-logs/access-my.domain.com.log&quot;
  $template mydomain2, &quot;%msg%\n&quot;
  if $syslogtag == &quot;my.domain.com:&quot; then ?mydomain;mydomain2
  &amp; stop
  </code></pre>
  <p>Please help, and if you know this is extra: Apache should log to local7 and keep files locally, but this CustomLog only sends to local7 without saving files locally, i know this is OLD (DISTRIB_DESCRIPTION=&quot;Ubuntu 12.04.5 LTS&quot;), that's why I sending logs to remote server , because in this distro no more packages for awstats and Perl modules.</p>