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.
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:
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.