Apache pipe log doesn't work

Hi to all.

I have a problem when trying get real time logs using pipe logging apache feature. My virtual host log conf is:

        LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" piwik

        ErrorLog        /var/log/apache2/vhost-error.log
        CustomLog       /var/log/apache2/vhost-custom.log piwik

        Customlog "|/var/www/piwik/misc/log-analytics/import_logs.py \
        --url=http://stats.myserver.com/piwik \
        --add-sites-new-hosts \
        --output=/var/log/apache2/piwik.log \
        --enable-http-errors \
        --enable-http-redirects \
        --enable-static \
        --enable-bots \
        --recorders=1 \
        --exclude-path=/owncloud* \
        --exclude-path=/piwik* \
        --exclude-path=/templates* \
        --exclude-path=/media* \
        --exclude-path=/libraries* \
        --exclude-path=/plugins* \
        --exclude-path=/modules* \
        --exclude-path=/components* \
        --exclude-path=/images/banners* \
        --exclude-path=/images/logo* \
        --debug \
        --log-format-name=common_complete \
        --disable-bulk-tracking \
        - " piwik

When server starts, there is a background process listening; no errors in server conf neither piwik are shown.

If I manually process log file with above command (i.e.:

/var/www/piwik/misc/log-analytics/import_logs.py [ SAME OPTIONS] /var/log/apache2/vhost-custom.log

) , everything works fine and piwik page shows right stats.

I also have some scripts to process log files using cron daemon every some minutes (as a possible workaround), but would be great get real time data (and forget cron).

System data is

Piwik version: 3.2.0
MySQL version: 5.5.5
PHP version: 5.6.30-0+deb8u1
Python 2.7.9

Thanks in advance.

Best regards.

1 Like

Hi @hoguereta,

same for me - did you find a solution?

I thought it might be caused by file permissions, but after some tests with my own shell scripts in the same directory as the import_logs.py, I think I an safely say that that’s not the cause: Apache easily pipes the logs through to my bash scripts, while the piwik import_logs.py script does not seem to receive anything at all.