DevOps.com

Where the world meets DevOps

  • Latest
    • Articles
    • Features
    • Most Read
    • News
    • News Releases
  • Topics
    • AI
    • Continuous Delivery
    • Continuous Testing
    • Cloud
    • Culture
    • DevSecOps
    • Enterprise DevOps
    • Leadership Suite
    • DevOps Practice
    • ROELBOB
    • DevOps Toolbox
    • IT as Code
  • DevOps Chats
  • Webinars
    • Upcoming
    • On-Demand Webinars
  • Library
  • Events
    • Virtual Summits
    • Conferences
  • Sponsored Communities
    • CloudBees
    • IT as Code
  • Related Sites
    • MediaOps
    • Container Journal
    • Security Boulevard
    • SweetCode.io
    • Digital Anarchist
    • DevOps TV on YouTube
    • DevOps Chat on SoundCloud
    • DevOps Connect
    • DevOps Dozen
  • Media Kit
  • Follow Us
    • Twitter
    • Google News
    • LinkedIn
    • Facebook
    • DevOps TV on YouTube
    • Email
MENUMENU
  • AI
    • OpsRamp Adds Synthetic Monitoring to AIOps Platform

      OpsRamp Adds Synthetic Monitoring to AIOps Platform

      Micro Focus AI

      Micro Focus Extends AI Testing Tools Reach

      Blue Medora

      VMware’s Blue Medora Buy Advances AIOps

      Eggplant testing

      Eggplant Injects AI Into Application Testing

      Eggplant testing

      Appian Infuses Low-Code Platform With AI

  • Cloud
    • cloud predictions

      Revisiting 2020 Cloud Predictions in Light of COVID-19

      cloud COVID-19

      Cloud Is Red Hot in the COVID-19 Era

      AWS machine learning

      AWS Brings Machine Learning to Code Optimization

      Oracle on-premises

      Cloud Foundry Foundation Updates CLI to Extend DevOps Processes

      ServiceNow Sweagle

      ServiceNow Acquires Sweagle to Advance DevOps Agenda

  • Continuous Delivery
    • microservices

      How to Use Microservices To Evolve DevOps Pipelines

      JFrog platform

      JFrog Extends Reach and Scope of CI/CD Platform

      CD Foundation

      CD Foundation Touts Spinnaker CD Progress

      Atlassian DevOps

      Atlassian Unfurls Bevy of DevOps Updates

      CircleCI

      CircleCI Extends Core CI/CD Platform

  • Continuous Testing
    • Shift-Right Testing - TestOps

      Shift-Right Testing: The Emergence of TestOps

      What Developers Should Take Away from the Iowa Caucus App Debacle

      What Developers Should Take Away from the Iowa Caucus App Debacle

      survey testing

      Survey Sees Little Progress in Drive to Shift Testing Left

      DevOps Software Testing

      DevOps Places Software Testing in the Crosshairs

      testing

      DevOps Chats: Enterprise Continuous Testing With a Shift-Right Mindset

  • DevSecOps
    • open source

      Snyk Tool Prioritizes Open Source Vulnerabilities

      IoT privacy

      Balancing UX and Privacy With IoT

      DevSecOps

      How to Make DevSecOps a Reality

      RunSafe

      RunSafe Allies With JFrog to Secure Applications

      distributed tracing

      Traceable Secures Apps Using Distributed Tracing

  • Leadership Suite
    • transformation

      Jump Over the Hidden Barriers to Digital Transformation

      teams scale

      Designing Engineering Teams for Scale

      DevOps

      Has the Pandemic Made DevOps Tougher or Easier?

      project management

      Product vs. Project: Balancing Management Roles for Success

      data people

      Data and Tools Don’t Solve Problems, People Do

  • Practices
    • Vercel

      Vercel Makes Front End Applications Faster

      APIs

      APIs: The Secret Sauce for Low-Code Platforms?

      IoT privacy

      Balancing UX and Privacy With IoT

      GraphQL

      Apollo GraphQL Brings Caching to Client Software

      GitLab OverOps

      OverOps Partners With GitLab to Analyze Code Earlier

  • ROELBOB
    • repo-actions

      Repo Actions

      history-of-qualitry-assurance

      History of Quality Assurance

      a-benefit-of-incompetence

      A Benefit of Incompetence

      stars-n-status

      Stars and Status

      email-marketing

      Email Marketing Recipients in the Real World

  • Toolbox
    • DevOps

      Solving the DevOps Dilemma in the COVID Era 

      Puppet Relay

      Puppet Launches Relay to Simplify Automating DevOps Workflows

      Pinpoint

      Pinpoint Dives Deeper into Software Delivery Analytics

      Checkmarx, survey, DevOps, AppSec

      Participate in the Checkmarx 2020 Survey

      debugging

      Rookout Extends Reach of Debugging Platform to On-Prem

  • IT as Code
  • More Topics
    • Application Performance Management/Monitoring
    • Culture
    • Enterprise DevOps

Home » Blogs » IT as Code » Cloud Management » How to Overcome Challenges With AWS Lambda Logging

AWS Lambda

How to Overcome Challenges With AWS Lambda Logging

Ariel AssarafBy Ariel Assaraf on June 29, 2020 1 Comment

Monitoring AWS Lambda can be a complex and potentially costly endeavor. Here’s what you need to know to stay on track and on budget

Recent Posts By Ariel Assaraf
  • The Top 5 Challenges to Overcome with Heroku Logging
  • Why DevOps are Keen on Open Source Logging
Ariel Assaraf More from Ariel Assaraf
Related Posts
  • How to Overcome Challenges With AWS Lambda Logging
  • Should You Go ‘Serverless’? The Pros and Cons
  • Instana Delivers Automated Node.js Tracing for AWS Lambda Functions With Zero Code Modification
    Related Categories
  • Blogs
  • Cloud Management
  • IT as Code
    Related Topics
  • AWS
  • AWS Lambda
  • cloud monitoring
  • cloud services
  • public cloud
  • serverless architecture
Show more
Show less

Organizations are already experiencing a shift toward serverless cloud computing. According to the O’Reilly “Serverless Survey 2019,” around 40% of respondents said they had implemented serverless architecture. Forrester “Global Business Technographics” Developer 2019 found that 49% of companies are using it or planning to use it in the next 12 months.

AWS leads the way in this space. According to Serverless.com, 96% of respondents choose AWS Lambda over Azure Functions and Google Cloud Functions. AWS Lambda helps us to design a lightweight and robust application architecture that can be built and deployed without any hassle. However, nothing comes for free. There are several, potentially costly, complexities when monitoring AWS Lambda. Fortunately, there is an array of solutions.

Logging

By default, AWS Lambda’s stdout and stderr messages are sent to CloudWatch Logs, where every function has its log group. A log group is a collection of log streams (sequence of log events) that can be stored as long as you want. Storage of logs costs USD 0.03/GB and data ingestion costs around USD 0.50/GB.

It is common practice to break up your Lambdas into single responsibility functions. This means, for example, if you need one Lambda to read a certain object and another to write it, you’re setting up two separate functions. However, this also means two log groups.

This creates a challenge when you want to analyze your application’s output log. There is no direct way to log queries across multiple log groups. In response to this, AWS enabled CloudWatch Log Insights to conduct cross-log querying. While this brought many of the improvements users wanted and needed, analyzing multiple log groups together meant a higher cost for queries. This prohibitive cost model encouraged many to look to external services.

Tracing

AWS X-Ray enables you to trace the underlying components of your application and helps you to dig out the fundamental reason behind distributed issues. It has quickly become an essential troubleshooting and optimization tool for engineers.

For example, cold start latency can be problematic for AWS Lambda functions with slow startup times. Although you can counter this by enabling Provisioned Concurrency, you will need to pay extra.

If you have budget constraints and still want to resolve the issue, X-Ray might help you eliminate or at least optimize your application by removing the bottleneck. It lets you know, among other things, if your application is consuming more time during initialization or invocation. You can find X-Ray SDK on AWS Lambda for Go, Java, Node.js, Python and .NET.

Debugging

Traditional architecture and serverless architectures are as different as day and night. Serverless requires changes across the software engineering spectrum, including debugging.

A serverless application is a combination of various services or resources within infrastructure, which can include tools such as AWS API Gateway, CloudWatch and SNS. Such distribution of web services helps avoid a single point of failure (SPOF), but this design creates a problem. Debugging or replicating an issue on a local machine is not always feasible, and debugging a production application is always a dangerous proposition.

Moreover, the abstraction of AWS Lambda makes debugging complicated, as you don’t have direct access to the underlying OS. Hunting down dispersed logs adds to this overhead. As your serverless infrastructure scales, it becomes difficult to identify the root cause.

To combat this, developers can use AWS native tools such as CloudWatch, X-Ray or Serverless Application Model (also known as SAM). Any of these tools on their own can be difficult to use; together, however, they form a powerful debugging suite.

Outside of the AWS-native toolset, some tools provide further assistance with debugging. For example, the Serverless framework, which is an open source tool to develop and deploy serverless applications over AWS, lets you see your live application’s function log, for example:

Monitoring

Robust monitoring ensures the smooth operation of an application and helps to detect issues quickly. In traditional infrastructure, metrics only appear from a handful of sources, so collecting them together is less of a challenge. In a serverless architecture, this problem is much more complex.

AWS gives you the freedom of converting CloudWatch Logs to metrics. These metrics can be filtered, measured and, when a threshold is crossed, alerted on. You can define a metric filter by choosing a log group created by your serverless function and target the log stream. This enables you to create a visual reference for your log events. Every custom metric you create will cost $0.30/10000 metrics per month.

Metric filters can be a powerful tool, but it can also be a bit overwhelming to set up everything, and there are certain bottlenecks as well. For instance, you can’t parameterize metric names, which forces you to create a filter for every custom metric you want to track. There is also a hard limit of 100 metric filters per log group, which restricts you as your application evolves.

Other than this, AWS resources are tightly coupled with each other, which makes AWS-native monitoring tools a fine choice when you need to monitor individual AWS resources or Lambda functions. To get an infrastructure-wide view and to monitor other third-party tools, a centralized logging approach is necessary to take full advantage of the log data.

Conclusion

There is no denying that serverless tooling quickly unlocks high availability, scalability and cost optimization. To make the most of this new paradigm, engineers need to build a robust and reliable monitoring system. The ability to manage log data streaming from many components, detect and trace issues on the fly, and deliver accurate insights to keep on improving the application is crucial to remain online and competitive.

While serverless solutions give access to many of the technical features we need, the dangers of vendor lock-in and the power of third-party providers must be considered if you want to scale your organization and its infrastructure smoothly.

Filed Under: Blogs, Cloud Management, IT as Code Tagged With: AWS, AWS Lambda, cloud monitoring, cloud services, public cloud, serverless architecture