Number : 049, Date: 2024-12-16

2024.12.09 ~ 2024.12.15

💡 ELK (ElasticSearch + Logstash + Kibana)


ELK stands for ElasticSearch, Logstash, and Kibana. It is an open-source stack for collecting, storing, analyzing, and visualizing log data and other types of data. Each component has the following roles:

  1. ElasticSearch: Handles data storage and search.This system is designed with a distributed structure, allowing it to process large amounts of data in real-time. ElasticSearch provides robust search and query features, forming a solid foundation for fast data analysis.
  2. Logstash: A data pipeline tool for collecting and processing data.It receives data from various sources (e.g., server logs, databases, application logs), filters or transforms it, and then stores it in ElasticSearch. This helps to structure the data or select only the required data.
  3. Kibana: A tool for visualizing data stored in ElasticSearch.Kibana enables users to create dashboards and analyze data in graphs or charts. It supports a variety of analysis tasks like searching, filtering, and generating reports, and is suitable for real-time data monitoring.

The reason I explored this topic was to understand how ElasticSearch can be used to analyze logs generated by the app.

🗓️ Handling Dates


To convert a date string into a Date type, DateFormatter can be used to transform the type from StringDate.

While working with date conversions, I discovered some important considerations:

  1. DateFormatter needs to know the format of the date string. For defining the year format, both yyyy and YYYY can be used, but there are differences:
    1. yyyy represents the calendar year, whereas YYYY is week-based. Errors can occur at the end of the year because a week-based year considers a week to belong to the next year if even a single day of the week falls in the new year.
    2. Related blog post
  2. When the TimeZone is set to Korea, there was an issue where a date string like 1956.05.20 was not correctly formatted. This seems related to Daylight Saving Time (DST). In the past, South Korea adopted the summer time policy, advancing the clock by 1 hour during summer. While this policy is no longer in use in Korea, some countries still use it, so it’s important to account for such policies when working with dates.
var formatter = DateFormatter()

formatter.dateFormat = "yyyy.MM.dd"
formatter.locale = Locale(identifier: "ko_KR")
formatter.timeZone = TimeZone(identifier: "Asia/Seoul")

let returnDate = formatter.date(from: "1956.05.20")
print(returnDate ?? "")

The following example shows that the returnDate becomes nil when the TimeZone is set to Seoul, but works correctly when set to other countries.

🍎 Hiding Emails in Apple Login


When using Apple Login, there is an option called “Hide My Email”. If this option is selected during sign-up, a random email address is generated with the domain privaterelay.appleid.com.

Additionally, the “Hide My Email” option is also available in iCloud, but it requires a paid iCloud+ subscription.

This service allows users to create random email addresses independently of Apple Login. It’s important not to confuse the two services.

🙋🏻‍♂️ Other Notes


  1. I found libraries that help in removing legacy code:
  2. While searching Medium, I came across a SwiftUI Extension recommendation post. It seemed useful, so I added the suggested code to my personal design system repository.