When something breaks in production, the clock starts immediately. Teams without centralized visibility spend that time hunting for the log line that explains what happened—and the cost adds up fast. More than half of organizations say their most recent major outage cost over $100,000, and one in five say it topped $1 million. Application logging closes that gap.

An application log is a structured record of events inside your software: errors, user actions, HTTP requests, and system-level activity. Each entry carries a timestamp and details about what happened, giving you the raw material to understand how your application is behaving and why it broke. Logs also support auditing, compliance, and performance monitoring, but their most immediate value is speed: the faster you can read what a log is telling you, the faster you can fix the problem.

This guide walks through the application log lifecycle (creation, collection, aggregation, storage, analysis, archival, and deletion) along with the best practices and tools that make each stage work in 2026.

Key takeaways: Application logging

  • Application logs are structured records of events, errors, and user activity, but they only deliver value when they're centralized, consistently formatted, and easy to query.
  • Every stage of the log lifecycle—creation, collection, aggregation, storage, analysis, archival, and deletion—has its own failure mode, and skipping one undermines the rest.
  • Compliance requirements are stage-specific: HIPAA-related logs need six years of retention, PCI DSS requires at least 12 months, and SOC 2 auditors typically expect around 12 months of security-relevant log history.
  • Logs are most useful when they're connected to the rest of your telemetry. New Relic's Logs Intelligence adds AI-assisted analysis on top of your log data, and Federated Logs lets you query logs at the source, without paying to move or duplicate them first.

The application log lifecycle

Logs are only useful if you're managing them correctly in the context of the application, and that means handling each stage in the log management lifecycle. Each stage fails in its own way—a gap in creation means there's nothing to analyze later, and a gap in storage means you lose evidence you'll need for an audit. The stages are:

  • Creation
  • Collection
  • Aggregation
  • Storage
  • Analysis, querying, visualization, and alerts
  • Archival
  • Deletion

In this article, you'll learn the basics of handling each step in the log management process.

Let's take a look at each stage.

Log creation

The first step is to generate logs for each service in your application. Before deciding how, it's worth deciding what shape those logs will take. Unstructured logs, or plain text lines, are easy to write but hard to query at scale. Structured logs, typically in JSON, attach key-value pairs to every entry, which makes them far easier to search, filter, and correlate later. So how do you generate logs? There are several options:

  • Some services and platforms automatically create logs for you.
  • You can implement custom logging, often at the code level.
  • You can instrument your services with an observability platform like New Relic. Instrumentation is the process of installing agents in your code that collect data and send it to a log management solution.

Let's briefly go over each option.

Automatic log generation

Many services and technologies automatically generate logs. For instance, if you use an MVC platform like Rails, Django, or .NET, logs are automatically outputted to the terminal in development. Cloud services like AWS and Azure also provide logs by default. You'll need to check the documentation for each service to determine whether logs are provided by default, whether they need to be turned on, and whether you need to configure them further.

Custom logging implementation

If you're creating custom frontends and backends, you'll need to take a closer look at the documentation for the frameworks and programming languages you're using. For example, both Ruby and Python have a Logger class you can implement to add custom log messages. As a coding best practice, you should implement error handling within your applications, and you can add custom log messages whether or not the application successfully handles those application errors.

Using an observability platform

Finally, if you're using a log management solution like New Relic, you can automatically instrument your applications by installing agents in your code that send telemetry data to the platform you're using.

You can also standardize on OpenTelemetry, the vendor-neutral open standard for collecting metrics, logs, and traces. It's now the recommended approach for teams that want to avoid locking their instrumentation to a single vendor.

If you're starting from scratch, don't reinvent the wheel. Use a solution that can instrument your services for you, and use the logs your services already provide.

Log collection

After your services are creating logs, either by default or because you've configured them to do so, you should collect them in one place where they can be analyzed, queried, and stored. It's extremely important to centralize your logs. Otherwise, you'll have a difficult time troubleshooting issues and understanding how your services interact with each other. For example, a problem in an upstream service may cause an error in a downstream service, but if the logs for those services are going to different places, you won't be able to correlate the data to find the root cause.

Recommended approach: Logs in context 

The most reliable way to collect logs is to skip manual forwarding wherever you can. New Relic's logs in context automatically attaches logs to the relevant trace, span, and application, without you installing or maintaining separate forwarding software for each service.

Setting up your log collection

If you're using a platform that provides instrumentation, agents automatically collect and send log data for you. For services that aren't automatically instrumented, you'll need to set up log forwarding yourself. This can be a real headache, especially if you're forwarding logs from a lot of services. You'll need to review documentation for each one, configure forwarding, and confirm logs are landing in your centralized location. 

Considering services that shouldn't be logged

There's one other very important thing to consider: do any of your services produce events that absolutely shouldn't be logged? An example is protected health information, which needs to be HIPAA-compliant. The safer approach is to exclude or mask PII and PHI before it's ever written to a log, rather than scrubbing it out afterward. Filtering at the point of collection is more reliable than filtering after the fact—Pipeline Control lets you filter and redact data at ingest, before it's stored. You may need additional configuration to ensure sensitive data isn't logged.

Log aggregation

Technically, aggregation includes both collecting and consolidating logs, but this article treats it as a separate step because it's an important part of the process. It's not enough to simply collect incoming data—that data needs to be made consistent. Think of it as the difference between throwing papers in a box versus filing them away. You can't easily find what you're looking for if it's stacked somewhere in a random pile. If logs are properly organized and stored, they're easier—and more efficient—to query.

That means formatting your logs so they're consistent and provide the information you need. That includes:

Standardizing logs

You can do this by converting logs to JSON format or ensuring each log has certain key-value pairs. Different services might format timestamps differently, use different keys to store data, or not use key-value pairs at all.

Adding context to logs

This includes information about the service a log originated from. For instance, if you're collecting logs from many different servers, you'll want additional fields in the log data to differentiate them, such as an ID, server name, and server location.

One of the most useful fields you can add is a correlation ID—a unique identifier attached to a request as it moves through multiple services. When every service logs the same correlation ID for a given request, you can reconstruct that request's full path across your system, even when the services that handled it are logging to different places. 

Once again, if you're using an observability platform or another log management solution and you're installing agents and instrumenting your services, your solution may do a lot of the consolidation for you. If you're not using an external solution, you'll need to create a custom code-level solution that standardizes and contextualizes log data as it's collected.

Log storage

After you've organized the data, you need to store it, whether that's in a custom database or an external solution. If you're using a log management solution or an observability platform to store data, make sure you fully understand how long each type of data is stored. For example, New Relic retains key metric application performance data ndefinitely, allowing you to visualize changes in your application over time. Log data itself can be retained for up to 30 days by default, with shorter 8- or 15-day options available and longer-term retention available for compliance needs.

Storing logs without a retention policy gets expensive fast—every log you never plan to use is still costing you storage and query overhead. A retention policy forces the question up front: how long does this data actually need to be queryable, and when can it move to cheaper storage or be deleted? Teams that skip this step tend to find out the cost only after their storage bill does—and that's on top of the cost of the outage itself. Uptime Institute's 2026 outage analysis found that more than half of organizations put their most recent major outage above $100,000, a number that only gets worse the longer it takes to find the cause. 

Log analysis, querying, and visualization

Your log data is only useful if you can make sense of it. That's where automatic analysis and visualization help. If you're simply storing and collecting logs, you won't be able to pick up patterns in your application. You can still use logs to troubleshoot reactively, but it's harder to proactively detect issues and fix them before they affect your users.

Data visualization gives you a high-level view of key metrics in your application. To visualize your data, you can use an observability platform or an open source tool like Grafana.

This view highlights patterns like error spikes, log volume over time, and outlier events, so you can spot problems as they start instead of after a user reports them.

AI-assisted analysis takes this further. New Relic's Logs Intelligence can summarize log alerts, apply no-code parsing to unstructured logs, and query at petabyte scale, so instead of manually scanning for the pattern that explains an incident, you get a head start on what changed and where. For more on pairing log data with distributed systems tracing to pin down performance issues, see our page on optimizing application performance with tracing and logging.

Making application logging simpler with an observability platform

With an observability platform, you can query your data to get more detailed visualizations or examine specific transactions. New Relic includes NRQL, and you can use the query builder to query specific logs and build custom dashboards.

It's also a good idea to set up alerts based on your incoming telemetry data. That way, you can notify your teams when a metric crosses a critical threshold.

Log archival and deletion

Log data tends to be most useful for solving problems that are happening right now. While it also provides a useful historical record of what happened in your application in the past, at some point, you may want to archive or delete old log data.

Archiving your logs

Archiving is the process of moving data from "hot" into "cold" storage. Data in "hot" storage is queryable and can be accessed immediately, but it needs fast—and more expensive—storage. Data in "cold" storage is cheaper but takes longer to access and query. How long you keep data in "hot" storage depends on your organization's needs. A range of 30–90 days is typical, and New Relic stores log data for 30 days by default. For data you need to keep much longer, New Relic's Live Archives store log data for up to seven years at roughly a quarter of the cost of hot storage, while still supporting compliance queries. 

Deleting your log data

Deleting log data is the final part of the log management lifecycle. When, or even if, you delete your logs depends on your organizational needs. Long-term cold storage is cheaper than hot storage, but storing log data indefinitely, especially as it grows year after year, comes with a cost. So the primary reason to delete logs eventually is to save on storage costs.

Some types of logs do have minimum storage requirements. For instance, security incident logs and HIPAA-compliant logs need to be stored for a minimum of six years. PCI DSS sets its own floor: audit logs need at least 12 months of retention, with the most recent three months immediately queryable. SOC 2 doesn't mandate a fixed period, but auditors typically expect around 12 months of security-relevant log history to support the audit.

Application logging best practices

A few habits separate teams that can actually use their logs from teams that are just storing them:

  • Log in a structured format, like JSON. Structured logs are far easier to query, filter, and correlate than free-text lines.
  • Attach a correlation ID to every request. This is what lets you trace a single request across multiple services instead of piecing it together by hand.
  • Be disciplined about log levels. Reserve ERROR and WARN for things that need attention—overusing them trains your team to ignore alerts.
  • Centralize before you try to analyze. Logs scattered across services can't be correlated, no matter how well each one is formatted.
  • Redact sensitive data at the source. Filtering personally identifiable information (PII) and protected health information (PHI) before ingestion is more reliable than cleaning it up after storage.
  • Set a retention and deletion policy before you need one. Decide up front how long each log type has to stay queryable and which compliance requirements—HIPAA, PCI DSS, SOC 2—apply to it.

The best application log management tools

Here's how five widely used platforms stack up on the criteria that matter most once you're logging at scale.

Tool

Ingest scale

Structured log support

AI analysis

Trace/metric correlation

Retention flexibility

Pricing model

New Relic

Petabyte-scale querying via Logs Intelligence and Federated Logs

Native, plus no-code parsing of unstructured logs

Logs Intelligence—AI alert summarization and pattern context

Native—logs in context ties logs to trace, span, and app

8/15/30-day default; Live Archives to 7 years

Usage-based; 100GB/month free, then per-GB

Datadog Log Management

High, priced per GB ingested

Structured logs supported

Watchdog Insights on indexed logs

Correlated via APM integration

Flexible via indexing tiers, priced separately from ingest

Two-part: ingest fee plus per-million-event indexing fee

Splunk

High, enterprise scale

Strong query language (SPL)

AI Assistant for query building and guided troubleshooting

Available via Splunk Observability Cloud

Configurable; longer retention raises cost significantly

Ingest-volume-based, list pricing scales with daily GB

Elastic (ELK Stack)

High, self-managed or Elastic Cloud

Strong structured and unstructured querying, plus AI-assisted auto-parsing

AI Assistant with retrieval-augmented search over logs

Requires separate APM integration

Retention scales with compute/storage tier, not ingest volume

Resource-based (compute plus storage), tiered subscriptions

Coralogix

High via in-stream processing architecture

Structured and unstructured, parsed in-stream

ML-powered anomaly alerts across logs, metrics, and traces

Native across logs, metrics, and traces

Data lands in your own S3 bucket; you set retention independently

Tiered per-GB pricing, no per-host fees

New Relic

Logs are correlated with traces, metrics, and errors by default, and Logs Intelligence adds AI parsing and alert summarization on top.

Datadog Log Management

Broad integrations and a mature UI, but a two-part pricing model: pay to ingest, then pay again to index and search, which can get costly at scale.

Splunk

Established query language and enterprise tooling, with an AI Assistant for query building. Ingest-based pricing is typically the most expensive of the group at high volumes.

Elastic (ELK Stack)

AI-powered auto-parsing (Streams) and resource-based pricing that doesn't penalize ingest volume directly, but trace/metric correlation requires separate APM tooling.

Coralogix

In-stream processing can lower costs on high-volume, lower-priority logs. Data lands in your own S3 bucket, so you control retention and its upkeep.

How to evaluate application log management tools

Beyond the table, weigh vendors against these five criteria before you commit.

Ingest volume and scalability

Know how much log data you generate today and how fast it's growing. Per-gigabyte pricing gets expensive fast at scale, so model cost at 2x and 5x current volume, not just today's number.

Structured log support and query flexibility

Confirm the tool parses structured formats like JSON natively and is easy to query once logs are centralized. A strong query language doesn't help if getting logs into shape takes manual pipeline work.

Correlation with traces, metrics, and errors

A log that can't be tied to its trace or transaction forces you back into manual correlation. Look for native correlation, not an integration you have to build yourself.

AI-assisted analysis and pattern detection

AI features should shorten the path from "something broke" to "here's why," with alert summarization, anomaly detection, or auto-parsing. Ask vendors for a concrete example, not just a features list.

Retention, archival, and cost management

Map retention options against your actual compliance requirements—HIPAA, PCI DSS, SOC 2—before you commit, and confirm what archival costs relative to hot storage. 

The best way to learn more about logging is to get hands-on experience with a log management solution. Sign up for the forever free tier of New Relic to get started, then take a deeper dive into New Relic's log management documentation.

Bringing it all together

Application logging works when you treat it as a full lifecycle, not a single tool. That means generating structured logs, collecting and aggregating them with consistent context and correlation IDs, storing them under a retention policy that matches your compliance requirements, and analyzing them, ideally with AI assistance, before an incident becomes a multi-hour investigation.

The tools you choose for each stage matter less than whether they connect. A log that can't be correlated with a trace or a metric is still just a line of text.

See how New Relic connects application logs with traces, metrics, and errors in one platform. Request a demo → 

FAQs about application logging

What's the difference between application logging and log management?

Application logging is the act of generating records inside your software—like error logs, requests, and events. Log management is everything that happens afterward, including collecting, aggregating, storing, analyzing, archiving, and deleting those logs. You can log without managing your logs well, as log management is what turns raw logs into something you can actually use.

How can I reduce log storage costs without losing diagnostic value?

Set a retention policy that matches each log type to its actual requirement: short hot-storage windows for routine logs, longer cold or archival storage for compliance-critical ones. Filter noisy, low-value logs at the source instead of indexing everything by default, and use structured logging so you're not paying to store redundant text.

What is logs in context, and why does it matter?

Logs in context automatically attaches your log entries to the trace, span, and application they came from, without manual forwarding setup. Instead of jumping between separate logging and tracing tools during an incident, you see the log line next to the transaction it happened in, which is usually the fastest way to find a root cause.