Build an end to end JSON logging system for clients apps

Pinterest Engineering
5 min readadvanced
--
View Original

Overview

This article discusses the development of an end-to-end JSON logging system for client applications at Pinterest, highlighting the challenges faced with existing logging methods and the design decisions made to enhance visibility and real-time monitoring. It outlines the architecture, implementation details, and use cases that demonstrate the system's effectiveness in providing actionable insights for developers.

What You'll Learn

1

How to implement an end-to-end JSON logging system for client applications

2

Why real-time logging is critical for monitoring application performance

3

How to visualize logs using OpenSearch for better insights

4

When to utilize log-based metrics for real-time alerting

Prerequisites & Requirements

  • Understanding of logging concepts and JSON format
  • Familiarity with OpenSearch and SQL querying(optional)

Key Questions Answered

What are the main challenges with existing logging systems?
Existing logging systems often lack flexibility, visualization capabilities, and real-time monitoring. Developers face issues with log categorization, and current tools do not provide adequate means for aggregating or monitoring logs effectively, leading to difficulties in troubleshooting and performance analysis.
How does the new JSON logging system improve client visibility?
The new JSON logging system allows for flexible, schemaless log payloads that can be easily queried and visualized. This enhances client visibility by providing real-time insights into networking metrics, crash reports, and performance data, enabling developers to monitor application health more effectively.
What technologies are integrated into the logging architecture?
The logging architecture integrates OpenSearch for real-time visualization and querying, Kafka for log processing, and Hive for data persistence. This combination allows for efficient log handling and supports SQL-based queries, making it easier for developers to analyze log data.
When should developers use log-based metrics?
Developers should use log-based metrics when they need to summarize log data from the entire ingest stream efficiently. This method allows for generating counts of logs matching specific queries, enabling real-time alerting and monitoring of application performance across different dimensions.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Implement a JSON logging system to enhance visibility across client applications.
This system allows developers to capture flexible log data that can be easily queried and visualized, improving the ability to monitor application performance and troubleshoot issues.
2
Utilize OpenSearch for real-time log visualization and analysis.
By leveraging OpenSearch, developers can create dashboards that provide insights into application performance metrics, helping to identify issues before they impact users.
3
Adopt log-based metrics for proactive monitoring and alerting.
Log-based metrics can help teams quickly identify trends and anomalies in application performance, enabling faster response times to potential issues.

Common Pitfalls

1
Failing to categorize logs properly can lead to confusion and ineffective monitoring.
Without clear categorization, developers may struggle to find relevant log data, making it difficult to troubleshoot issues or gain insights into application performance.
2
Neglecting real-time alerting can result in delayed responses to critical issues.
If teams do not set up real-time alerts based on log data, they may miss important signals that indicate performance degradation or failures, leading to a poor user experience.

Related Concepts

Logging Best Practices
Real-time Monitoring Techniques
Data Visualization Strategies