Seatext library / BotRefund evidence
What infrastructure do I need to store and query historical traffic data for bot analysis?
You need a storage and query stack that matches your daily log volume, query speed needs, and team skills. For under 100 GB/day, a local ELK stack (Elasticsearch, Logstash, Kibana) with Grafana works well....
✓ Built for advertisers who need clear, refund-ready traffic evidence.

What infrastructure do I need to store and query historical traffic data for bot analysis?
To store and query historical traffic data for bot analysis, you need a system that can ingest, store, and let you search through large volumes of web server logs, CDN logs, and application event data. The right choice depends on three things: how much data you generate each day, how fast you need queries to run, and how much your team can manage.
For most teams, the decision comes down to three main options: a local ELK stack (Elasticsearch, Logstash, Kibana) with Grafana for smaller volumes, a cloud data lake using S3 and Athena or BigQuery for medium to large volumes, or a managed SIEM like Splunk or Datadog for enterprise needs. Regardless of which you pick, always store data in a columnar format like Parquet and partition by date and IP address. This keeps storage costs low and queries fast.
Why the right infrastructure matters
Without proper infrastructure, you cannot run the long-range queries needed to spot bot patterns. Bots often operate over weeks or months, slowly testing your defenses. If you can only look at the last 24 hours of data, you will miss slow-moving attacks. Good infrastructure lets you compare traffic from today against the same day last month, or spot a sudden spike from a single IP range that started three weeks ago.
Ignoring this can cost you money. Bot clicks on ads, fake signups, and content scraping all drain budgets. With the right storage and query setup, you can build evidence dossiers to request refunds from ad platforms. Without it, you are flying blind.
How it works: the basic pipeline
Every historical bot analysis pipeline has four stages:
- Ingestion – Collect logs from web servers, CDNs, WAFs, and application servers. Use tools like Logstash, Fluentd, or cloud-native agents.
- Storage – Store raw logs in a durable, cost-effective system. Object storage (S3, GCS) is cheap and scalable. For faster queries, use a columnar format like Parquet.
- Indexing and partitioning – Organize data so queries scan only the relevant files. Partition by date and IP range. Index key fields like timestamp, IP, user agent, and URL.
- Query and visualization – Use SQL or a query language to search the data. Build dashboards in Grafana, Kibana, or a SIEM tool to spot trends and anomalies.
Main options and trade-offs
Option 1: Local ELK stack + Grafana
Best for teams generating under 100 GB of logs per day. You run Elasticsearch, Logstash, and Kibana on your own servers or VMs. Grafana adds flexible dashboards. This gives you full control and no per-query costs, but you must manage hardware, scaling, and backups. It works well for small to medium sites with a dedicated engineer.
Option 2: Cloud data lake (S3 + Athena, BigQuery)
Best for 100 GB to 10 TB per day. You store logs as Parquet files in S3 or Google Cloud Storage. Query them with Athena (serverless Presto) or BigQuery. You pay only for storage and the data scanned by each query. This scales nearly infinitely and requires no server management. The trade-off: query speed is slower than a dedicated database, and costs can add up if you run many large scans.
Option 3: Managed SIEM (Splunk, Datadog)
Best for enterprise teams with large volumes (10+ TB/day) and a need for real-time alerts. These platforms ingest, index, and store logs, and provide built-in dashboards and alerting. They are expensive but reduce the need for in-house engineering. They also include compliance features and integrations with other security tools.
Decision framework: how to choose
Use this simple rule to pick your starting point:
- Under 100 GB/day and you have a DevOps person? Start with ELK + Grafana.
- 100 GB to 10 TB/day and you want low maintenance? Use S3 + Athena or BigQuery.
- Over 10 TB/day or you need built-in alerting and compliance? Go with a managed SIEM.
If you are unsure, start with the cloud data lake option. It is the most flexible and scales with you. You can always add a SIEM layer later for alerting.
Trade-off table
| Criterion | ELK + Grafana | Cloud data lake (S3+Athena/BigQuery) | Managed SIEM (Splunk, Datadog) |
|---|---|---|---|
| Best fit | Small to medium sites, <100 GB/day | Medium to large sites, 100 GB–10 TB/day | Enterprise, >10 TB/day, compliance needs |
| Setup effort | High – you manage servers, scaling, backups | Medium – configure ingestion and partitioning | Low – vendor handles infrastructure |
| Query speed | Fast on indexed data | Moderate – slower on large scans | Fast with pre-indexing |
| Cost model | Fixed hardware cost, no per-query fees | Pay per GB stored + per TB scanned | High monthly license + ingestion fees |
| Control | Full control over schema and retention | High – you define partitioning and format | Limited to vendor's schema |
| Limitations | Hard to scale past 1 TB/day | Query cost can surprise if not optimized | Expensive at scale, vendor lock-in |
Practical scenarios
Scenario 1: Small e-commerce site (50 GB/day)
You run a Shopify store with a few thousand visitors a day. You want to check if a sudden drop in conversions is due to bot traffic. Set up ELK on a single server. Ingest your CDN logs. Partition by day. Query for spikes from single IPs or unusual user agents. This costs you only server time and a few hours of setup.
Scenario 2: Mid-size SaaS company (500 GB/day)
You have a web app with millions of requests daily. You need to analyze bot behavior over the last 6 months. Use S3 to store logs as Parquet, partitioned by date and hour. Query with Athena. Build a Grafana dashboard on top. This keeps storage cheap and lets you run complex SQL queries without managing a cluster.
Scenario 3: Large publisher (5 TB/day)
You run a news site with heavy ad traffic. You suspect click fraud from botnets. Use a managed SIEM like Splunk. Set up alerts for unusual click patterns. Use their built-in dashboards to visualize traffic sources. The cost is high, but you get real-time detection and compliance-ready reports.
Limitations and when this advice does not apply
This advice assumes you have some technical ability to set up and maintain the pipeline. If you have no one on your team who can write a SQL query or configure a log shipper, you should start with a fully managed service like Datadog or a bot detection platform that includes storage and analysis.
Also, if you need real-time blocking (not just historical analysis), you need a different setup. Real-time detection requires a reverse proxy or edge script that can inspect traffic before it reaches your server. Historical analysis is for investigation and evidence gathering, not for stopping attacks as they happen.
Finally, if your data is already in a platform like Cloudflare or Akamai, check if they offer built-in bot analytics. You may not need to build your own pipeline at all.
Key facts
| Fact | Detail |
|---|---|
| Bot traffic share | Non-human traffic typically consumes 15% to 25% of paid advertising budgets. |
| Detection accuracy | BotRefund uses 110+ forensic signals and cross-checks to achieve 99% accuracy. |
| Refund window | Google limits claims to the past 60 days, so timely data storage is critical. |
| Evidence needed | Compliance-ready dispute logs require timestamps, IPs, user agents, and behavioral data. |
| Storage format | Columnar formats like Parquet reduce storage costs and speed up queries. |
Frequently asked questions
How much historical data should I keep?
Keep at least 12 months for annual pattern analysis. For refund claims, you need at least 60 days of data. Storage costs drop significantly with columnar formats, so keeping a year is affordable.
What is the cheapest option?
Using S3 with Parquet files and querying with Athena is usually the cheapest for medium volumes. You pay only for what you store and scan. For very small volumes, a single-server ELK stack can be nearly free if you already have the hardware.
Do I need a separate database for bot data?
Not necessarily. You can store bot analysis data in the same system as your other logs, as long as you partition and index properly. Many teams use a separate S3 bucket or Elasticsearch index to keep things clean.
How do I handle real-time vs. historical analysis?
Use a real-time detection tool (like BotRefund's edge script) to block bots immediately. Use historical infrastructure to investigate patterns and build refund evidence. They complement each other.
What if I use Cloudflare or another CDN?
Many CDNs offer built-in bot analytics dashboards. Check if they provide historical data export. If they do, you can skip building your own pipeline and just query their API.
How do I avoid high query costs in cloud data lakes?
Partition aggressively by date and IP range. Use columnar formats. Limit queries to specific time ranges. Use cost controls in Athena or BigQuery to cap spending per query.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
How BotRefund can help
BotRefund provides a lightweight edge script that evaluates traffic on your site with zero access to your margins or bids. It uses 110+ forensic signals to detect bots with 99% accuracy. The platform automatically captures click IDs and behavioral evidence, generating compliance-ready refund reports for Google and Meta. This means you do not need to build your own storage and query infrastructure from scratch. BotRefund handles the evidence collection and platform negotiation, with an 83% approval rate on refund claims. The setup takes about two minutes and requires no ad account logins.
Ready to Take the Next Step?
See how our verified tools and services help you put this guide into practice.