Ideas2IT rewards key players with 1/3rd of the Company in New Initiative.  Read More >
Back to Blogs

How to Solve the Logging Problem for Offline Mobile Apps

As anyone knows, logs are extremely useful for debugging end-user issues and monitoring the health of the application. Logs generated in the Mobile App should be shipped to a server for future processing. Moreover, other considerations need to be made when we are dealing with an offline mobile app.

Background

We were building a companion offline mobile app for one of our existing web applications. For any application, it is very important that there is one single strategy in place to handle all the logs, be it from the web side or the mobile app side. In our case, the log data from the existing web application was being sent to Logstash for processing and can be visualized using Kibana and Grafana. To leverage the existing logging strategy, we decided that the Mobile logs should also be sent to Logstash.To achieve mobile logging, the following approach was used:

Mobile

The user logs are stored in the device in the form of a database or a file. All the operations are performed in the device’s native layer. The stored logs are processed and split into chunks of predetermined size. The chunks of logs are sent to the server periodically. The chunks are deleted from the device once they are successfully transmitted to the server.

logging_offline_apps Architecture Diagram

Back EndProcessing such log data from mobile should not impact other web application service requests. We hence implemented two new micro-services to process the mobile logs.

  • Mobile Logger Service and Mobile Logger Worker
  • Mobile Logger Service:
  1. API will be exposed to capture logs through Basic / Token Based Authentication process.
  2. Uploads the log data received to S3 bucket as a file.
  3. Enqueues Uploaded S3 file URL to SQS
  • Mobile Logger Worker:
  1. Dequeues the S3 URL from SQS.
  2. Fetches the log file from the particular S3 location.
  3. Processes the log file and sends to Logstash.
logging_offline_apps Architecture Diagram

About Ideas2IT,Are you looking to build a great product or service? Do you foresee technical challenges? If you answered yes to the above questions, then you must talk to us. We are a world-class custom .NET development company. We take up projects that are in our area of expertise. We know what we are good at and more importantly what we are not. We carefully choose projects where we strongly believe that we can add value. And not just in engineering but also in terms of how well we understand the domain. Book a free consultation with us today. Let’s work together.

Ideas2IT Team

Connect with Us

We'd love to brainstorm your priority tech initiatives and contribute to the best outcomes.