close
test_template

Logging Application

download print

About this sample

About this sample

close

Words: 1191 |

Pages: 3|

6 min read

Published: Dec 18, 2018

Words: 1191|Pages: 3|6 min read

Published: Dec 18, 2018

Logs are a critical part of any system, they give you deep insights about your application, what your system is doing and what caused the error, when something wrong happens. Virtually every system generates logs in some form or another, these logs are written to files on local disks. When you’re building enterprise level application, your system goes to multiple hosts, managing the logs across multiple hosts can be complicated. Debugging the error in the application across hundreds of log files on hundreds of servers can be very time consuming and complicated.

'Why Violent Video Games Shouldn't Be Banned'?

A common approach to this problem is building a centralized logging application which can collect and aggregate different types of logs in one central location.There are many tools available to which can solve some part of the problem but we need to build a robust application using all these tools.There are total four parts in centralized logging application — Collect logs, transport, store and analyse. We are going to look at each of this parts in depth and see how we can build an application.

Flow of Logging ApplicationCollectionAll the applications create logs in different ways, some applications log through syslogs and other logs directly in files. When you see a typical web application running on a Linux server, there will be a dozen of more log files in /var/log and also a few application-specific logs in the home directories and other locations. Basically, there will be logs generated by different applications at a different place.Now, consider you have a web application running on the server and if something goes down, your developers or operations team need to access log data quickly in order to troubleshoot live issues, you would need a solution which can monitor the changes in the log files in almost real-time. To solve this issue, you can follow replication approach,

Replication Approach: In the replication approach, files are replicated to a central server on a fixed schedule. You will setup a cron job that will replicate your files on Linux server to your central server. A one-minute cron job might not be fast enough to troubleshoot when your site is down and you will be waiting for the relevant log data to be replicated.Replication approach would be good for analytics, if you need to analyze log data offline for calculating metrics or other batch related work, replication approach might be a good fit.TransportIf you have multiple hosts running then logs data can accumulate quickly. There should be an efficient and reliable way to transport this data to the centralized application and ensure data is not lost.

There are many frameworks available to transport log data. One way is directly plug input sources and framework can start collecting logs and another way is to send log data via API, application code is written to log directly to these sources it reduces latency and improves reliability.If you want to provide a number of input sources you can use: Logstash — Open Source Log collector, written in RubyFlume — Open Source Log collector, written in Javaand, Fluentd — Open Source, written in RubyThese frameworks provide input sources but also support natively tailing files and transporting them reliably. These frameworks are a better fit for more general application.To log data via APIs, which is generally a more preferred way to log data to a central application, these are following frameworks that can be used.Scribe — Open Source Software by Facebook, written in C++nsq — Open Source, Written in Goand,Kafka — You would have heard about Kafka, highly used, Open Source Software by Apache, written in JavaSo this was about the transport, now let’s what would be the efficient way to store such a large amount logs data.

StorageNow we have transport in place, logs will need a destination, a storage where all the log data will be saved. The system should be highly scalable as the data will keep on growing and it should be able to handle the growth over time. Logs data will depend on the how huge your applications are if your application is running on multiple servers or in many containers it will generate more logs.There are a couple of things, that we need to keep in mind while deciding the storage.Time — For How long should it be stored?: Storage system depends on how long you would like to store your data. If the logs are for long-term and do not require immediate analysis, it can be archived and saved on S3or AWS Glacier as they provide a relatively low cost for a large amount of data. If you only need a few days or months of logs you can use distributed storage system like — Cassandra, MongoDB, HDFS or ElasticSearch also works well. And, lastly, if you want to store just a few hours of data, you can use Redis as well.Volume — How huge your data would be?: Google and Facebook create a much more large volume of data in a day compared to a week’s data of a simple NodeJs application. The storage system you choose should be highly scalable and scale horizontally as your data increases.

Access — How will you access the logs?: Storage system you choose also depends on how you access the logs. Some storage systems are not suitable for real-time analysis, for example — AWS Glacier can take hours to load a file. AWS Glacier or Tape Backup won’t work if you need to access data for troubleshooting analysis. ElasticSearch or HDFS is a good choice for interactive data analysis and working with raw data more effectively.AnalysisLogs are meant for analysis and analytics. Once your logs are stored in a centralized location, you need a way to analyze them. There are many tools available for log analysis, if you need a UI for analysis, you can parse all the data in ElasticSearch and use Kibana or Greylog to query and inspect the data. Grafana and Kibana can be used to show real-time data analytics

AlertingThis is the last component in the centralized logging application. It’s nice to have an alerting system which will alert us to any change in the log patterns or calculated metrics.Logs are very useful for troubleshooting errors. It’s far better to have some alerting build in the logging application system which will send an email or notify us then to have someone keep watching logs for any changes. There are many error reporting tools available, you can use Sentry or Honeybadger. These aggregates repetitive exceptions which give you an idea of how frequently an error is happening.Alerting is also useful for monitoring hundreds of servers, logs will be sending the status of different applications and you can setup alert system to check whether your system is up or down.

Get a custom paper now from our expert writers.

Alerting is really useful in error troubleshooting, monitoring and threshold reporting. Riemann is very good software for monitoring and alerting.That’s it.So in part 1, we talked about all the available softwares and components we need to build a centralized logging application, we will start building our application, starting with Transport, we will see how to setup Transport component for a simple NodeJS application which will send logs to a central system

Image of Alex Wood
This essay was reviewed by
Alex Wood

Cite this Essay

Logging Application. (2018, December 17). GradesFixer. Retrieved April 16, 2024, from https://gradesfixer.com/free-essay-examples/logging-application/
“Logging Application.” GradesFixer, 17 Dec. 2018, gradesfixer.com/free-essay-examples/logging-application/
Logging Application. [online]. Available at: <https://gradesfixer.com/free-essay-examples/logging-application/> [Accessed 16 Apr. 2024].
Logging Application [Internet]. GradesFixer. 2018 Dec 17 [cited 2024 Apr 16]. Available from: https://gradesfixer.com/free-essay-examples/logging-application/
copy
Keep in mind: This sample was shared by another student.
  • 450+ experts on 30 subjects ready to help
  • Custom essay delivered in as few as 3 hours
Write my essay

Still can’t find what you need?

Browse our vast selection of original essay samples, each expertly formatted and styled

close

Where do you want us to send this sample?

    By clicking “Continue”, you agree to our terms of service and privacy policy.

    close

    Be careful. This essay is not unique

    This essay was donated by a student and is likely to have been used and submitted before

    Download this Sample

    Free samples may contain mistakes and not unique parts

    close

    Sorry, we could not paraphrase this essay. Our professional writers can rewrite it and get you a unique paper.

    close

    Thanks!

    Please check your inbox.

    We can write you a custom essay that will follow your exact instructions and meet the deadlines. Let's fix your grades together!

    clock-banner-side

    Get Your
    Personalized Essay in 3 Hours or Less!

    exit-popup-close
    We can help you get a better grade and deliver your task on time!
    • Instructions Followed To The Letter
    • Deadlines Met At Every Stage
    • Unique And Plagiarism Free
    Order your paper now