Centralized Mobile Backend Logging with ELK Stack: Setup Guide

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Centralized Mobile Backend Logging with ELK Stack: Setup Guide
Medium
~2-3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    860
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    746
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1163
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1035
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    970
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    564

Centralized Mobile Backend Logging with ELK Stack: Setup Guide

Imagine your mobile backend generates tens of thousands of log lines per minute across multiple servers. A production error hits — you spend hours grepping via SSH. ELK Stack (Elasticsearch, Logstash, Kibana) turns that chaos into centralized search with filters in seconds. We've integrated such a solution for over 30 projects, from startups to enterprise, cutting diagnosis time by 10x. Here's how it works.

Why Set Up ELK Stack for Mobile Backend Logging?

Because the time and resource savings are obvious. On one project (gaming, 5M users), we reduced infrastructure costs by 30% and sped up error search from hours to seconds. Developers stopped digging through logs manually — Kibana dashboards show error rate in real-time, and alerts land in Telegram when thresholds are exceeded. The average project pays for itself in 2 months through reduced incident time. Guaranteed results or your money back.

What We Configure

The log collection stack consists of three parts: structured logging at the application level, an agent for collection and forwarding (Fluent Bit or Logstash), Elasticsearch storage with search engine, and Kibana UI.

Structured Logs

Applications must write logs in JSON — not plain text. A line like [ERROR] Jan 15 14:23:11 UserService: null pointer is junk for Elasticsearch. JSON-formatted logs are parseable and filterable:

import structlog

logger = structlog.get_logger()

def authenticate_user(user_id: str, device_id: str):
    logger.info(
        "auth_attempt",
        user_id=user_id,
        device_id=device_id,
        platform="ios",
        app_version="3.2.1",
    )
    try:
        token = auth_service.verify(user_id)
        logger.info("auth_success", user_id=user_id, token_expires_in=3600)
        return token
    except InvalidTokenError as e:
        logger.warning("auth_failed", user_id=user_id, reason=str(e))
        raise
import "github.com/rs/zerolog/log"

log.Error().
    Str("user_id", userID).
    Str("device_id", deviceID).
    Str("endpoint", "/api/v1/auth").
    Int("status_code", 401).
    Dur("duration_ms", elapsed).
    Msg("authentication failed")

Mandatory fields in every log: timestamp (ISO 8601), level, service, request_id (for request tracing across services), user_id (if applicable). request_id is a UUID generated at the incoming request middleware and propagated to all child calls via context.

Field Type Description
timestamp date ISO 8601
level keyword error, warn, info, debug
service keyword Service name
user_id keyword User identifier
request_id keyword Request UUID
message text Event description
duration_ms long Execution time (ms)
status_code integer HTTP status

Fluent Bit vs Logstash

Parameter Fluent Bit Logstash
RAM consumption ~1 MB ~500 MB
Configuration YAML/INI Ruby DSL
Deployment DaemonSet, sidecar DaemonSet
Performance 50K events/sec per 1 vCPU 30K events/sec per 1 vCPU

According to Fluent Bit official documentation, memory consumption does not exceed 1MB, making it 500x more memory-efficient than Logstash. Fluent Bit is also 1.6x more performant on a single vCPU. For most setups, Fluent Bit is the optimal choice.

Example Fluent Bit configuration

[INPUT]
    Name              tail
    Path              /var/log/app/*.log
    Parser            json
    Tag               app.*
    Refresh_Interval  5

[FILTER]
    Name   grep
    Match  app.*
    Regex  level (warn|error|fatal)

[OUTPUT]
    Name  es
    Match app.*
    Host  elasticsearch
    Port  9200
    Index mobile-backend-logs
    Type  _doc
    Logstash_Format On
    Logstash_Prefix mobile-backend

The grep filter at the Fluent Bit level reduces data volume in Elasticsearch — debug logs do not enter storage.

Advantages of Fluent Bit

At typical mobile backend load (up to 10M events per day), infrastructure cost savings reach 30% compared to Logstash. Fluent Bit is easier to maintain — updates via Rolling Update in Kubernetes without downtime.

How to Protect Data in Logs from Leaks

Logs contain user_id, device information, sometimes request data fragments. Never log: passwords, full tokens, card numbers, personal data. PII in logs is a GDPR violation. We mask at the logger level with a simple filter: sensitive fields are replaced with ***. This ensures no confidential data enters Elasticsearch. Our proven track record includes 30+ projects with zero data breaches.

Elasticsearch and Index

For a mobile backend with moderate load (up to 10M events per day), a single Elasticsearch node or managed cluster (Elastic Cloud, AWS OpenSearch) suffices. Index lifecycle management (ILM) is mandatory: logs older than 30 days moved to cold tier or deleted, otherwise disk fills within a week.

{
  "mappings": {
    "properties": {
      "timestamp": { "type": "date" },
      "level": { "type": "keyword" },
      "service": { "type": "keyword" },
      "user_id": { "type": "keyword" },
      "request_id": { "type": "keyword" },
      "message": { "type": "text" },
      "duration_ms": { "type": "long" },
      "status_code": { "type": "integer" }
    }
  }
}

Dynamic mapping is a source of problems: Elasticsearch auto-detects the field type from the first value, and if status_code first arrives as a string, all subsequent numeric values cause mapping errors. Therefore we define the mapping template upfront.

Kibana: Search and Dashboards

After collection setup, create an Index Pattern in Kibana, configure Discover for field search, build Lens dashboards:

  • Error rate by endpoint for the last hour
  • Top-10 slow queries (duration_ms > 1000)
  • Active users by user_id in real-time
  • Error heatmap by hour and day

KQL (Kibana Query Language) for search is simpler than SQL: level: error AND service: auth-service AND duration_ms > 500 — instantly you see all slow authentication errors.

Logstash: Use Cases

Logstash is justified when complex parsing (e.g., multiline logs) or integration with legacy systems over TCP/UDP is required. However, for most mobile backends, Fluent Bit covers all scenarios and saves resources.

Scope of Work

  • Audit current logging: identify problems (missing request_id, unstructured output)
  • Configure JSON-formatted logs in code (with mandatory fields)
  • Deploy EFK/ELK stack: Docker Compose for development, Kubernetes Helm charts for production
  • Configure Index Lifecycle Management (ILM) — storage optimization
  • Create Kibana dashboards for your key metrics
  • Set up alerts (Kibana Watcher or Prometheus Alertmanager)
  • Operator documentation and team training
  • One month of post-deployment support

How We Do It: Step-by-Step Plan

  1. Analysis: review current architecture, log types, load level.
  2. Structuring: add JSON logger with required fields.
  3. Agent deployment: install Fluent Bit via DaemonSet or sidecar container.
  4. Elasticsearch setup: create mapping template, ILM policies.
  5. Kibana: configure Index Pattern and build dashboards.
  6. Testing: verify collection, search, and alert correctness.
  7. Deploy: roll out to staging and production.

Timelines

Basic EFK stack with Docker Compose, JSON-formatted logs for one service, basic Kibana dashboards: 2 to 3 days. Production-ready setup with ILM, alerts, multiple services, and security: 5 to 8 days. Cost is calculated individually — starting from $5,000, typically pays for itself within 2 months. Guaranteed 30% reduction in log-related infrastructure costs.

We'll assess your project in one business day — just write to us. In your message, specify your current stack and approximate load, and we'll propose the optimal turnkey solution. Get a consultation today and start seeing all backend errors in one window.

Mobile App Analytics: Firebase, Amplitude, AppsFlyer and Attribution

Our team regularly encounters projects where analytics is already "set up" but yields no real insights. A typical example is a startup with 50k DAU: tracking dozens of events without a single answer to the question "why don't users reach payment?". In two weeks we built a basic funnel and found that 70% of users drop off at the phone number verification screen. After fixing the bug, retention increased by 12%. The takeaway: analytics should start with specific questions, not tracking everything indiscriminately.

Why Event Taxonomy is the Foundation of Mobile App Analytics?

Firebase Analytics, Amplitude, Mixpanel — technically similar. The difference lies in what you put into them. A common mistake: events like screen_view, button_tap_1, button_tap_2 without context. A month later, no one remembers what button_tap_2 means.

Proper taxonomy: object + action + context. product_viewed, checkout_started, payment_completed with parameters product_id, category, price, source. This allows building funnels, cohort analysis, and retention without additional tracking.

We document the naming convention in a tracking plan — a document (Google Sheet or Amplitude Data Catalog) describing every event, its parameters, and triggering conditions. The tracking plan is synced with the analytics team before development begins, not after. This approach ensures that data remains interpretable months later and doesn't become a dump. Experience from 50+ projects confirms: without a tracking plan, analytics maintenance costs increase 2-3 times due to rework.

What Should You Choose for Mobile App Analytics: Firebase, Amplitude, or Mixpanel?

The table below highlights key differences between the three popular platforms. Choice depends on budget, traffic, and tasks.

Criteria Firebase Analytics Amplitude Mixpanel
Free limit Unlimited (Spark plan) Up to 10M events/month Up to 1K MTU/month (Special)
Data latency Up to 24 hours (standard) Minutes (real-time) Minutes (real-time)
Funnels and cohorts Basic funnels, limited count Deep funnels, Journeys, cohorts Funnels, Retention, Insights
BigQuery export Yes (free, raw data) Yes (subscription) Yes (Enterprise)
Session Replay No Yes (iOS/Android SDK) No
Ad integration Google Ads (native) Via Universal Links Via partners

Firebase Analytics — free, deep integration with Google Ads, BigQuery export for raw data. Limitations: data latency up to 24 hours, limited funnels. For startups with Google Ads traffic, it's the first choice.

Amplitude — product analytics focused on cohorts and user journeys. Journeys (formerly Pathfinder) shows actual paths between events — not assumed funnels but real routes. Session Replay records sessions for UX analysis. The free tier up to 10M events/month is enough for most products at launch.

Mixpanel — close to Amplitude, stronger in real-time segmentation. Insights, Funnels, Retention cover 90% of product analysts' tasks.

How to Solve Multi-Channel Attribution with AppsFlyer?

Knowing where a user came from is a separate task. Firebase Attribution works only within the Google ecosystem. For multi-channel attribution (Facebook Ads, TikTok, Apple Search Ads, programmatic), an MMP (Mobile Measurement Partner) is needed.

AppsFlyer is the market leader. OneLink — universal deep link working on iOS and Android, correctly attributing installs from any channel. Protect360 — built-in fraud protection (fake installs, click injection on Android). Adjust and Branch are competitors with similar features. Branch excels in deep linking; Adjust is popular in gaming.

According to Apple, with iOS 14.5, apps must obtain user permission via ATT before collecting IDFA for tracking. AppsFlyer uses probabilistic matching (IP + user agent + timing) for these users — accuracy is lower but better than nothing. SKAdNetwork and Privacy Preserving Attribution provide aggregated data from Apple with a 24-72 hour delay.

How to Set Up Crash Analytics to Not Miss Bugs?

Firebase Crashlytics is the standard for crash reporting. It automatically groups crashes by stack trace, shows affected users %, and sends velocity alerts when crash rate increases by more than 10% per hour.

Important: symbolication. On iOS, .dSYM files must be automatically uploaded with each build — via Fastlane upload_symbols_to_crashlytics or Xcode Cloud built-in. Without symbols, crashes in Crashlytics appear as memory addresses. This happens more often than expected when switching to a new CI — in one project with 500k users, we found that 40% of crashes remained unsymbolicated due to a missing CI/CD step. After automation, bug response time dropped from 3 hours to 15 minutes.

For React Native and Flutter, @sentry/react-native and sentry_flutter provide additional context: breadcrumbs, network requests before the crash, Redux/Provider state.

Below is a comparison of popular crash analytics tools to choose according to your needs.

Criteria Firebase Crashlytics Sentry Instabug
Free limit Unlimited (Spark) 5k events/month 250 MAU
Grouping By stack trace + parameters By fingerprint By stack trace + metadata
Symbolication Automatic (via file) Automatic (via CLI) Automatic
Velocity alerts Yes (by % change) Yes (by count) Yes (by threshold)
Extra context Logs, Keys, Custom Keys Breadcrumbs, User, Tags User steps, network requests
Price Free (in Firebase) Paid plans available Paid plans available

Environment Setup

Three environments with separate Firebase projects: dev, staging, production. Mixing analytics from test sessions and production is a common mistake that skews all metrics. On iOS via GoogleService-Info.plist per scheme, on Android via google-services.json in each flavor folder.

Timelines: basic analytics with Firebase + Crashlytics — 3-5 days. Full tracking plan + Amplitude/Mixpanel with funnels and cohorts — 2-3 weeks. Attribution via AppsFlyer with deep linking and fraud protection — 1-2 weeks. Cost is calculated individually based on integration complexity.

What Is Included in Our Work

As part of analytics implementation, we provide:

  • Development and approval of a tracking plan with product and marketing teams.
  • SDK integration (Firebase, Amplitude, Mixpanel, AppsFlyer) considering your stack (Swift/Kotlin/Flutter/React Native).
  • Setup of funnels, cohorts, dashboards, and alerts.
  • Automation of symbolication and .dSYM upload via Fastlane.
  • Documentation of events and parameters.
  • Team training on the analytics platform.
  • Two weeks of post-release support and tracking adjustments.

Our experience: 7 years of analytics implementation and over 80 successful projects in mobile development. We guarantee data correctness and transparency at every stage.

Contact us for a consultation on setting up analytics for your app. Request an audit of your current analytics — and we will show you which metrics you are losing.