<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problems with Log Analytics with Matomo]]></title><description><![CDATA[<p dir="auto">Hello all,<br />
first of all thanks to <a class="plugin-mentions-user plugin-mentions-a" href="/user/sydney" aria-label="Profile: Sydney">@<bdi>Sydney</bdi></a> for your great tutorial for log analysis.<br />
Unfortunately I still have problems in the implementation.</p>
<p dir="auto">I installed Matomo in Cloudron, set up the site in Matomo and now I want to import the logs. I use the command for this:</p>
<pre><code>python3 import_logs.py \
--url=https://analytics.my-site.de \
--token-auth=my-token\
--log-format-regex='(?P&lt;ip&gt;[\w*.:-]+)\s+\S+\s+[(?P&lt;date&gt;.*?)\s+(?P&lt;timezone&gt;.*?)]\s+"(?P&lt;method&gt;\S+)\s+(?P&lt;path&gt;.*?)\s+\S+"\s+(?P&lt;status&gt;\d+)\s+(?P&lt;length&gt;\S+)\s+(?P&lt;generation_time_milli&gt;\d*\.?\d+)\s+"(?P&lt;referrer&gt;.*?)"\s"(?P&lt;host&gt;[\w\-\.]*)"\s"(?P&lt;user_agent&gt;.*?)"' \
/var/log/nginx/access.log.1
</code></pre>
<p dir="auto">The answer:</p>
<pre><code>0 lines parsed, 0 lines recorded, 0 records/sec (avg), 0 records/sec (current)
Parsing log /var/log/nginx/access.log.1...

Logs import summary
-------------------

    0 requests imported successfully
    0 requests were downloads
    23233 requests ignored:
        0 HTTP errors
        0 HTTP redirects
        23233 invalid log lines
        0 filtered log lines
        0 requests did not match any known site
        0 requests did not match any --hostname
        0 requests done by bots, search engines...
        0 requests to static resources (css, js, images, ico, ttf...)
        0 requests to file downloads did not match any --download-extensions

Website import summary
----------------------

    0 requests imported to 0 sites
        0 sites already existed
        0 sites were created:

    0 distinct hostnames did not match any existing site:



Performance summary
-------------------

    Total time: 0 seconds
    Requests imported per second: 0.0 requests per second

Processing your log data
------------------------

    In order for your logs to be processed by Matomo, you may need to run the following command:
     ./console core:archive --force-all-websites --url='https://analytics.my-site.de'

</code></pre>
<p dir="auto">Debug Log-Example:</p>
<pre><code>Invalid line detected (line did not match): 66.249.*.* - [31/Jan/2022:21:59:34 +0000] "GET my-site.com/blog/*/*/* HTTP/1.1" 200 14007 0.438 "-" "my-site.com" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.g**gle.com/bot.html)"

</code></pre>
<p dir="auto">I only want to track a WordPress site, no other apps running in Cloudron.</p>
<p dir="auto">Version Cloudron:  v7.0.4 (Ubuntu 20.04.3 LTS)<br />
Version Matomo: Matomo 4.6.2</p>
<p dir="auto">Would anyone here support me?<br />
Thanks in advance <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=74f512c8ff7" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://forum.cloudron.io/topic/6421/problems-with-log-analytics-with-matomo</link><generator>RSS for Node</generator><lastBuildDate>Tue, 09 Jun 2026 15:06:27 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/6421.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 Feb 2022 11:56:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problems with Log Analytics with Matomo on Thu, 03 Feb 2022 07:46:24 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/user/sydney" aria-label="Profile: sydney">@<bdi>sydney</bdi></a>,<br />
I tried <a href="http://regexr.com" target="_blank" rel="noopener noreferrer nofollow ugc">regexr.com</a>. The regex seems to be correct. However, I still get the error message. No idea what is wrong here.<br />
But thanks for your engagement <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=74f512c8ff7" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://forum.cloudron.io/post/42796</link><guid isPermaLink="true">https://forum.cloudron.io/post/42796</guid><dc:creator><![CDATA[FeelNiceInc]]></dc:creator><pubDate>Thu, 03 Feb 2022 07:46:24 GMT</pubDate></item><item><title><![CDATA[Reply to Problems with Log Analytics with Matomo on Wed, 02 Feb 2022 20:45:45 GMT]]></title><description><![CDATA[<p dir="auto">Hey there, <a class="plugin-mentions-user plugin-mentions-a" href="/user/feelniceinc" aria-label="Profile: FeelNiceInc">@<bdi>FeelNiceInc</bdi></a> . I'm glad to hear that my tutorial was helpful for you, and I'm sorry that my provided regex did not work.</p>
<p dir="auto">I think <a class="plugin-mentions-user plugin-mentions-a" href="/user/girish" aria-label="Profile: girish">@<bdi>girish</bdi></a> 's solution is the best - by changing Cloudron's Nginx webserver to use the default <code>combined</code> log format, matomo's log import script will automatically recognise and import the logs without needing to specify a special regex.</p>
<p dir="auto">The regex that I provided in my tutorial was specifically in order to accomodate Cloudron's idiosyncratic <code>combined2</code> log format -- but otherwise it provides little benefit.</p>
<p dir="auto">I'm not sure why the regex didn't work for you, as it is working for me. For future readers that stumble upon this thread, I would recommend going with <a class="plugin-mentions-user plugin-mentions-a" href="/user/girish" aria-label="Profile: girish">@<bdi>girish</bdi></a> 's advice, and simply change Cloudron to use the <code>combined</code> format.</p>
<p dir="auto">However, if you already have an archive of logs that are in the <code>combined2</code> format which you need to import, I recommend trying to figure out the correct regex by hand. I use a regex visualiser called RegExr, which makes it easier to craft custom regular expressions.</p>
<p dir="auto">The Regexr link to the <code>combined2</code> log format is here:</p>
<p dir="auto"><a href="https://regexr.com/6dlnf" target="_blank" rel="noopener noreferrer nofollow ugc">https://regexr.com/6dlnf</a></p>
<p dir="auto">I recommend taking a few lines of your server logs, and pasting them into regexr -- and see what matches, and what doesn't match. The way the regex expression is formatted is that it defines a few named capture groups, which are as follows:</p>
<ul>
<li><code>(?P&lt;ip&gt;[\w*.:-]+)</code> IP Address</li>
<li><code>(?P&lt;date&gt;.*?)</code> Date</li>
<li><code>(?P&lt;timezone&gt;.*?)</code> Timezone</li>
<li><code>(?P&lt;method&gt;\S+)</code> HTTP Request Method (e.g. Post, Get)</li>
<li><code>(?P&lt;path&gt;.*?)</code> HTTP Request Path (e.g. /homepage.html)</li>
<li><code>(?P&lt;status&gt;\d+)</code> HTTP Request Status</li>
<li><code>(?P&lt;generation_time_milli&gt;\d*\.?\d+)</code> Amount of time for the server to respond</li>
<li><code>(?P&lt;referrer&gt;.*?)</code> Referrer header</li>
<li><code>(?P&lt;host&gt;[\w\-\.]*)</code> Host</li>
<li><code>(?P&lt;user_agent&gt;.*?)</code> User Agent (what browser, device, etc)</li>
</ul>
<p dir="auto">All the weird things like <code>\s</code> or <code>.+</code> in between simply account for things like spaces in the log lines. Try playing around with the Regex until it matches everything in your logs. The regexr website makes it all very visual and easy to understand.</p>
<p dir="auto">I'm glad that you were able to get log analytics working. I hope this helps!</p>
]]></description><link>https://forum.cloudron.io/post/42785</link><guid isPermaLink="true">https://forum.cloudron.io/post/42785</guid><dc:creator><![CDATA[Sydney]]></dc:creator><pubDate>Wed, 02 Feb 2022 20:45:45 GMT</pubDate></item><item><title><![CDATA[Reply to Problems with Log Analytics with Matomo on Wed, 02 Feb 2022 19:17:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/robi" aria-label="Profile: robi">@<bdi>robi</bdi></a> said in <a href="/post/42740">Problems with Log Analytics with Matomo</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/feelniceinc" aria-label="Profile: feelniceinc">@<bdi>feelniceinc</bdi></a> Can you post your final import command so the solution is available here?</p>
</blockquote>
<p dir="auto">Hey, my bash script for the cronjob is now:</p>
<pre><code>#!/usr/bin/env bash

sudo python3 /path/to/matomo-log-analytics/import_logs.py \
--url=https://mysite/matomo \
--token-auth=token \
--idsite=site_id  \
/var/log/nginx/access.log.1


</code></pre>
]]></description><link>https://forum.cloudron.io/post/42781</link><guid isPermaLink="true">https://forum.cloudron.io/post/42781</guid><dc:creator><![CDATA[FeelNiceInc]]></dc:creator><pubDate>Wed, 02 Feb 2022 19:17:07 GMT</pubDate></item><item><title><![CDATA[Reply to Problems with Log Analytics with Matomo on Tue, 01 Feb 2022 22:21:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/feelniceinc" aria-label="Profile: feelniceinc">@<bdi>feelniceinc</bdi></a> Can you post your final import command so the solution is available here?</p>
]]></description><link>https://forum.cloudron.io/post/42740</link><guid isPermaLink="true">https://forum.cloudron.io/post/42740</guid><dc:creator><![CDATA[robi]]></dc:creator><pubDate>Tue, 01 Feb 2022 22:21:15 GMT</pubDate></item><item><title><![CDATA[Reply to Problems with Log Analytics with Matomo on Tue, 01 Feb 2022 20:28:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/girish" aria-label="Profile: girish">@<bdi>girish</bdi></a> Hey, thank you for the hint. Matomo is working now. Thank you <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=74f512c8ff7" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>https://forum.cloudron.io/post/42731</link><guid isPermaLink="true">https://forum.cloudron.io/post/42731</guid><dc:creator><![CDATA[FeelNiceInc]]></dc:creator><pubDate>Tue, 01 Feb 2022 20:28:48 GMT</pubDate></item><item><title><![CDATA[Reply to Problems with Log Analytics with Matomo on Tue, 01 Feb 2022 19:34:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/feelniceinc" aria-label="Profile: feelniceinc">@<bdi>feelniceinc</bdi></a> I think this is because the regexp to parse the log lines is not correct. Cloudron uses a format called "combined2" like below, so you might have to adjust that regexp accordingly:</p>
<pre><code>    log_format combined2 '$remote_addr - [$time_local] '
        '"$request" $status $body_bytes_sent $request_time '
        '"$http_referer" "$host" "$http_user_agent"';
</code></pre>
<p dir="auto">That said, in the next release, we have removed the above custom format since it was causing problems when integrating with other tools  (like crowdsec, iirc). As a temporary workaround, you can edit the nginx configs to say <code>access_log /var/log/nginx/access.log combined;</code> instead of combined2 and restart nginx to see if it parses correctly.</p>
]]></description><link>https://forum.cloudron.io/post/42725</link><guid isPermaLink="true">https://forum.cloudron.io/post/42725</guid><dc:creator><![CDATA[girish]]></dc:creator><pubDate>Tue, 01 Feb 2022 19:34:13 GMT</pubDate></item></channel></rss>