Skip to content
Marketing Factory Digital GmbH
Contact
Logo Marketing Factory Digital GmbH
  • Agency
    • About us
    • History
  • Services
    • Consulting, Analysis and Strategy
    • Programming and Development
      • Interface Development
      • PIM/ERP Links
      • Custom Development
      • Seamless CMS Integration
    • Hosting and Support
      • Operation on our Colocation Hardware
      • Cloud Strategies
    • Services with Third Parties
  • Technology
    • TYPO3
      • Current TYPO3 Versions
    • Shopware
    • IT Security
      • DDoS Protection
      • Continuous Upgrading
      • Privacy First
    • Tech Stack
      • Commitment to Open Source
      • Technology Selection
      • PHP Ecosystem
      • Containerisation & Clustering
      • Content Delivery Networks
      • Search Technologies
  • References
    • Projects
    • Clients
      • Client List
    • Screenshot of the homepage of the new Maxion Wheels websiteNEW: Relaunch of the corporate website of Maxion Wheels
  • Community
    • Community Initiatives
  • Blog
  • Contact
  • Deutsch
  • English

You are here:

  1. Blog
  2. AWS CloudFront log analysis in Matomo
[Translate to English:]
  • Hosting
  • Tech Stack
14.05.2025

AWS CloudFront log analysis in Matomo


AWS CloudFront Log analysis in Matomo

For most of our clients, we use AWSCloudFront as a CDN and reverse proxy in front of the web server. This speeds up the delivery of pages and assets and this is also reducing the load on the backend. With correctly configured TYPO3 caches and proper cache headers, we’re measuring CDN hit rates of up to 91%. That’s a huge performance gain and a clear reduction in server load.

Running behind a reverse proxy comes with one downside: traditional log file analysis becomes useless. Since CloudFront handles most of the requests, only a few of them ever reach the actual web server. Client-side tracking (e.g. with Matomo or Google Analytics) would be an option, but we decided against that for performance and privacy reasons (and because it’s simply not always necessary).

So, how can we analyze CloudFront log files in Matomo?

 

At the moment, AWS CloudFront provides three options for accessing request logs:

  1. Standard logs written to an S3 bucket
  2. Realtime logs, processed via Amazon Kinesis or similar tools
  3. Lambda@Edge logs, streamed to CloudWatch

We went with the classic S3-based logging approach.

 

CloudFront writes one log file per Point of Presence (PoP). What’s slightly opaque: the duration each log file covers is not defined, and Amazon doesn’t specify when exactly these files will appear in the S3 bucket. Reading the documentation: It may take up to 48 hours for logs to become available.

Matomo doesn’t require logs to be in any specific order, nor does it care about when they’re processed. Even better – Matomo supports CloudFront log formats out of the box.

What was still missing was a small script to retrieve the log files one by one from the S3 bucket, process them, and move them into an archive. Deletion after 30 days is then handled by the S3 retention policy.

That’s it.

 

You can find the script on GitHub
Pull-requests and issues welcome.

Ingo Schmitt

Fluent in TypoScript, php and sql; knows perl and bash and has very basic knowledge in java. Joined in 1996 and is meanwhile as managing director responsible for development, operation and hosting of our products. Articles in this blog cover technical and sustainable topics.

More posts by this author

Get blog posts as RSS feed

Related blog posts

  • Efficient review environments: Why we replaced Kubernetes with Virtual Machines
  • The Great Firewall – The challenges of hosting in China
  • Domain management (2): Domain administration in the company
  • Domain management (1): The ideal domain portfolio for companies

Please feel free to share this article.


Comments

No comments yet.

Write a comment.

I have been informed that the processing of my data is on a voluntary basis and that I can refuse my consent without detrimental consequences for me or withdraw my consent at any time to Marketing Factory Digital GmbH by mail (Marienstraße 14, D-40212 Düsseldorf) or e-mail (info@marketing-factory.de).

I understand that the above data will be stored for as long as I wish to be contacted by Marketing Factory. After my revocation my data will be deleted. Further storage may take place in individual cases if this is required by law.

  • Data privacy policy
  • Legal notice

© Marketing Factory Digital GmbH

Picture Credits
  1. Picture: Creator / Created with DALL·E, an AI system by OpenAI