Centralized Logging with ELK Stack for Web Applications

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
Centralized Logging with ELK Stack for Web Applications
Complex
~5 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1250
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947

Centralized Logging with ELK Stack for Web Applications

After yet another production incident with 5xx errors, we spent 3 hours digging through logs on ten servers. This repeated every month. When a web application serves thousands of users, logs are generated in huge volumes—up to 50 GB per day on 10 servers. Without centralization, finding an error is like looking for a needle in a haystack. The ELK Stack solves this: all logs flow into a central storage with second-fast search. In our practice, incident response time drops by 70% after ELK adoption. Telegram alerts notify about 5xx, slow requests, application errors. We handle the full cycle: from Elasticsearch deployment to dashboards and alerts. Duration: 2 to 7 days depending on complexity.

How ELK Stack Solves Log Collection and Analysis Problems

ELK is a combination of Elasticsearch (storage and search), Logstash (parsing and transformation), and Kibana (visualization). Filebeat delivers logs from servers. The result is a single entry point for all logs, significantly simplifying log monitoring and error investigation.

Choosing a Scheme: ELK vs EFK vs Without Logstash

Scheme Complexity Performance Flexibility
ELK High Medium High
EFK Medium Higher Medium
Without Logstash Low High Low

Logstash excels in capabilities: it parses legacy log formats using grok, enriches data (geoip, useragent). We use it in 80% of projects. However, Elasticsearch Ingest Pipelines are faster: they process up to 15,000 events/s—3 times more than Logstash (5,000). But Logstash handles unstructured data where Ingest falls short.

How We Set Up ELK for Your Project

Docker Compose for a Test Environment

We use the following compose file:

version: '3.8'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.13.0
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=true
      - xpack.security.http.ssl.enabled=false
      - ELASTIC_PASSWORD=changeme
      - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
    volumes:
      - esdata:/usr/share/elasticsearch/data
    ports:
      - "9200:9200"
    ulimits:
      memlock:
        soft: -1
        hard: -1
  kibana:
    image: docker.elastic.co/kibana/kibana:8.13.0
    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
      - ELASTICSEARCH_USERNAME=kibana_system
      - ELASTICSEARCH_PASSWORD=changeme
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch
  logstash:
    image: docker.elastic.co/logstash/logstash:8.13.0
    volumes:
      - ./logstash/pipeline:/usr/share/logstash/pipeline
      - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml
    ports:
      - "5044:5044"
      - "5000:5000"
    depends_on:
      - elasticsearch
volumes:
  esdata:

Logstash Pipeline: Parsing Nginx Access and JSON Logs

input {
  beats { port => 5044 }
  tcp { port => 5000; codec => json_lines }
}
filter {
  if [fields][log_type] == "nginx_access" {
    grok { match => { "message" => '%{IPORHOST:client_ip} - %{DATA:user} \[%{HTTPDATE:timestamp}\] "%{WORD:method} %{DATA:request} HTTP/%{NUMBER:http_version}" %{NUMBER:status_code:int} %{NUMBER:bytes_sent:int} "%{DATA:referrer}" "%{DATA:user_agent}" %{NUMBER:request_time:float}' } }
    date { match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss Z"]; target => "@timestamp" }
    geoip { source => "client_ip"; target => "geoip" }
    useragent { source => "user_agent"; target => "ua" }
    mutate { remove_field => ["message", "timestamp"] }
  }
  if [fields][log_type] == "app_json" {
    json { source => "message"; target => "app" }
    mutate { remove_field => ["message"] }
  }
}
output {
  if [fields][log_type] == "nginx_access" {
    elasticsearch { hosts => ["http://elasticsearch:9200"]; user => "elastic"; password => "changeme"; index => "nginx-access-%{+YYYY.MM.dd}" }
  } else {
    elasticsearch { hosts => ["http://elasticsearch:9200"]; user => "elastic"; password => "changeme"; index => "app-logs-%{+YYYY.MM.dd}" }
  }
}

Sending Logs from Laravel

Through a custom Monolog handler:

class LogstashLogger
{
    public function __invoke(array $config): Logger
    {
        $handler = new SocketHandler("tcp://{$config['host']}:{$config['port']}");
        $handler->setFormatter(new JsonFormatter());
        return new Logger('app', [$handler]);
    }
}

Now Log::error(...) sends JSON directly to Logstash.

On one project with 10,000 RPS load, we configured a 3-node Elasticsearch cluster with ILM and Logstash with grok patterns for parsing specific application logs. As a result, error search time dropped from 40 minutes to 10 seconds. This allowed the team to respond faster to incidents and reduce MTTR by 65%.

Why ILM Is Mandatory

Without ILM, indices grow uncontrollably, filling the disk in a month. We configure a policy: hot (5 GB or 1 day) → warm (3 days) → cold (30 days) → delete (90 days). This is done via an index template. It's the foundation of cost-effective log storage. Additionally, you can set rollover by size or age to avoid node overload.

Elasticsearch Performance: Practical Tips

  • Heap: no more than 50% of RAM and never exceed 31 GB (due to compressed oops)
  • Number of shards: 1 shard ≈ 20–40 GB of data. Oversharding is a common mistake
  • Slow log: index.search.slowlog.threshold.query.warn: 2s
  • Disable swap: bootstrap.memory_lock: true

Comparison: Logstash vs Ingest Pipelines

Parameter Logstash Ingest Pipelines
Performance ~5k events/s ~15k events/s
Flexibility Grok, enrich, routing Only simple parsing
Complexity Requires server setup Built into ES

For complex transformations, Logstash is irreplaceable. Built-in pipeline processors handle typical tasks but cannot work with arbitrary text patterns.

What's Included in ELK Setup

  • Deploying an Elasticsearch cluster with optimal settings (shards, ILM, security)
  • Configuring Logstash to parse Nginx, PHP, and application logs
  • Connecting Filebeat on all servers
  • Creating Kibana dashboards for log monitoring (5xx, latency, traffic)
  • Setting up ILM to save disk space
  • Integrating alerts to Telegram or Email
  • Documentation for operation and team training

Workflow

  1. Analysis — we study your current logs, sources, and storage requirements
  2. Design — choose the scheme (ELK/EFK), outline ILM and dashboards
  3. Implementation — deploy the cluster, configure pipelines
  4. Testing — verify data ingestion, alerts, search speed
  5. Deployment — roll out to production, hand over documentation

We guarantee 99.9% SLA for the cluster. Our engineers have over 5 years of experience and have completed 30+ projects. Contact us to discuss your project and schedule an ELK implementation to reduce error search time. Pricing is determined after an infrastructure analysis.

Elasticsearch Guide

Setup Web Analytics: GA4, GTM, Yandex.Metrica, and Amplitude

We often see: conversion rate 1.2%, traffic grows, but conversion stays flat. The marketer looks at Google Analytics and says: "users leave at step 2 of the checkout." The developer opens the same step — no errors, Sentry is silent. So it's not a JS bug, but a UX issue or skewed data from analytics. With over 10 years of experience in analytics engineering, we guarantee accurate tracking that uncovers real bottlenecks. Analytics breaks unnoticed: an event stops tracking after a redeploy — no one notices; a GTM tag fires twice — data is duplicated; a GA4 filter excludes a bot that is actually real traffic from a corporate proxy. An audit of your current tags will find the cause within a week.

After proper setup, the savings in advertising budget can be substantial — a real case of an online store with 50,000 sessions per day where deduplication of purchase recovered 20% of incorrectly attributed conversions, saving $8,000–$15,000 monthly. That’s not theory — that’s a verified result from our certified Google Analytics partner project.

Why do GA4 events duplicate and how to fix it?

Universal Analytics is gone, replaced by GA4's event-based model. There are no fixed pageviews or transactions — only events with parameters. This is more flexible but requires proper event design. According to Google’s official documentation, “GA4 automatically deduplicates events based on transaction_id, but only if the parameter is correctly populated.” Many implementations miss this.

Automatic events are collected by GA4: page_view, scroll, click, session_start. Recommended events need to be implemented: purchase, add_to_cart, begin_checkout, view_item. Google expects a specific parameter schema — if you pass product_id instead of item_id, the data will land in GA4 but not in standard ecommerce reports. Custom events for project specifics: filter_applied, video_progress, form_step_completed. Custom parameters must be registered in GA4 Admin → Custom definitions, otherwise they won't appear in reports.

A common mistake is the purchase event being duplicated. Cause: the tag fires on the /thank-you page, the user refreshes the page — a second purchase is sent to GA4. Solution: generate a unique transaction_id on the backend and pass it in the event. In our experience, 80% of e-commerce stores have this issue. GA4 deduplicates based on it (in theory — verify with DebugView). Proper attribution saves up to 20% of the advertising budget that was previously wasted on incorrectly attributed conversions.

How to set up the data layer to avoid data loss?

GTM is a tool for managing tags without code deployment. But "no code" doesn't mean "no architecture." The data layer is the foundation. We pass data from the application to GTM via dataLayer.push(). Structure: event + contextual data. For e-commerce: before opening a product page — push with product data. GTM tag reads from the data layer, not from the DOM.

window.dataLayer = window.dataLayer || [];
dataLayer.push({
  event: 'view_item',
  ecommerce: {
    items: [{
      item_id: 'SKU-12345',
      item_name: 'Product name',
      price: 1990.00,
      currency: 'USD'
    }]
  }
});

Bad practice: GTM tag parses the DOM — looks for the price in span.price, the name in h1. This breaks with any layout change. Good practice: always use the data layer. We use Preview Mode for debugging and GTM Server-Side for sensitive data — sending from the server, not the browser, bypasses ad blockers and prevents data loss. A properly implemented data layer reduces tracking errors by 95%.

How does Yandex.Metrica complement web analytics?

For a Russian audience, Metrica is a must — especially Webvisor. Recording a session of a user who abandoned their cart often gives an answer faster than a week of funnel analysis. Goals in Metrica: event-based (via ym(COUNTER_ID, 'reachGoal', 'GOAL_NAME')) or automatic (button click, page visit). Integration with CRM via Metrica Plus — passing offline conversions. Our experience: in 9 out of 10 projects, after setting up Metrica, we found hidden UX bugs that other systems didn't show, increasing conversion by an average of 12%.

What does product analytics give in Amplitude?

Amplitude is a product tool, unlike marketing-oriented GA4 and Metrica. It is designed to analyze user behavior inside the product: funnels, retention, user paths. Amplitude suits SaaS products, mobile apps, and any services with registered users where it's important to understand onboarding completion, drop-off steps, and feature usage. Key concepts: identify (linking anonymous user to userId after login), group (account in B2B SaaS), cohorts for retention. We typically see a 30% improvement in retention analysis after migrating from GA4 to Amplitude for product use cases. Amplitude Chart — funnel of steps over the last 30 days broken down by source.

Monitoring Data Quality

Analytics without monitoring is a black box. We set up:

  • GA4 Realtime — check after every deploy that key events are coming in
  • Alerting in GA4 — anomaly in the number of purchase events (sharp drop = something broke)
  • GTM Preview in staging before production
  • Manual funnel tests once a week — simply go through the buyer journey and verify everything is tracked
What we check after each deploy
  • All recommended events present in DebugView
  • No duplicates (count purchase per 100 sessions)
  • Data layer structure unchanged after frontend update

What the work includes

Component Description
Audit of existing tags Check current GTM tags, data layer, duplicates, and errors
Event schema design Documentation: event list, parameters, triggers
GA4 + GTM setup Create configuration, tags, custom definitions
Yandex.Metrica Install counter, create goals, set up Webvisor
Amplitude (optional) Set up client and server SDK, cohorts
QA and monitoring Testing in Preview Mode, alerting
Training and handover Access, instructions for adding new events, console

Process and timeline

  1. Audit of existing tags and data (2 days)
  2. Event schema design (2 days)
  3. Data layer development and tag setup (3–5 days)
  4. QA in Preview Mode and staging (2 days)
  5. Deploy and dashboard setup (1 day)
Scenario Timeline
Basic GA4 + GTM setup 1 week
Full e-commerce tracking + Metrica 2–3 weeks
Server-side GTM + Amplitude 3–5 weeks

Cost is calculated individually. Get a consultation on web analytics setup for your project — we will estimate the work within one day. Contact us to get started with a free audit of your current tracking.