Analyzing web server access logs in OpenSearch

Turn nginx and Apache access logs into OpenSearch dashboards, Security Analytics detections and error-spike alerts, with parsing, access control and retention planned in infrastructure you control.

On this page

Analyzing web server access logs in OpenSearch: when teams need it

A team with nginx or Apache access logs spread across several hosts usually feels the problem first during an incident: someone has to log into each machine, grep files that rotate on different schedules, and reconstruct which clients hit which endpoints when the error rate climbed. Self-hosted OpenSearch fits when you want those logs in one searchable store, with dashboards, detections and error alerts running on infrastructure you control. The pieces that matter for this topic are Data Prepper, which parses and routes log events into indices, OpenSearch Dashboards for visualization, Security Analytics with an Apache access log type for detections, and the alerting features that watch for error spikes.

Self-hosting makes sense when the access logs contain data you cannot send to a third-party logging service, such as client IP addresses, session identifiers in URLs or authenticated paths. It also makes sense when the same logs must feed a security team's detections and an operations team's dashboards under one set of roles. OpenSearch is released under the Apache License, Version 2.0, and the OpenSearch FAQ does not describe a paid edition, so the software cost question is simpler than with many commercial products. The recurring costs are the infrastructure, the people who run the cluster and the upgrades, which you should plan for before you commit.

Before you start, confirm three things in your own environment: how many hosts produce access logs and how much volume they generate per day, which OpenSearch version your team will standardize on and how long that version stays under maintenance, and whether your security team needs Security Analytics detections or only dashboards and alerts. Those answers decide the node layout, the retention settings and the scope of any quote. Check the current release and maintenance details on the OpenSearch releases page rather than relying on older notes.

How access logs flow from web servers to dashboards, detections and alerts

The flow starts on the nginx and Apache hosts, where a log shipper forwards each access log line to Data Prepper, which parses it into fields before writing to OpenSearch indices. Dashboards reads those indices for charts, while Security Analytics detectors run Apache access log rules against the same data and hand matches to alerting. The trust boundary around the cluster is the point to check: web hosts send logs in, and only authenticated users and roles with read access should reach the dashboards and alerts.

Access log path from web hosts through parsing, storage, dashboards and detections.

Setting up access log ingestion step by step

This sequence takes nginx or Apache access logs from raw files to parsed, typed documents, dashboards, Security Analytics detections and error-spike alerts, with a check at each stage so you can tell when each part works.

  1. Confirm the access log format on each server

    Before writing any parsing rules, check the exact log format on every nginx or Apache host that will send logs. Read the log_format directive in the nginx configuration or the LogFormat directive in Apache, and note whether the format is the default combined format or a custom one with added fields such as response time or upstream address. Record the field order, the timestamp format and whether the logs include a trailing user agent or forwarded-for field. Your platform or web team owns this step. It is done when you have one written format per server group and a few real lines copied from each, so every later parser is built from observed data rather than assumptions.

  2. Define the Data Prepper pipeline for parsing

    Write a Data Prepper pipeline that reads the log source, parses each line into named fields and sends the results to OpenSearch. Map the parsed fields to the format you confirmed, set the timestamp field explicitly and route parse failures to a separate index or dead-letter path so they are visible. Keep the pipeline definition in version control next to the web server configuration it depends on. Data Prepper's common use cases include log analytics, so the parsing stage is the place to shape the data for dashboards and detections. The step is done when a test log line passes through the pipeline and appears as one structured document with the expected fields and no parse-failure entry.

  3. Verify a sample document is parsed correctly

    Send a known test request to the web server, then find the resulting document in OpenSearch Dashboards. Compare each field with the raw line: client address, method, path, status code, bytes sent and timestamp should all match. Check that the timestamp is stored as a date and that the status code and byte count are numeric, not text. Run a sample of several hundred lines through the pipeline as well to find any format variants that fail. This check closes the parsing stage. If a field is text when it should be a number, fix the pipeline before you create dashboards on top of it.

  4. Create index or data stream mappings

    Create the index template or data stream that will hold access logs, and set explicit mappings for the fields you verified. Use keyword fields for values you filter on exactly, such as method and host, and numeric or date types for status, byte counts and timestamps. Set the retention policy and naming pattern now, because changing them later means reindexing. Confirm that the template applies to the index name your pipeline writes to. The step is complete when a newly written document shows the same field types as the mapping and no field is dynamically mapped to an unintended type. Ask your platform team to confirm the retention period against your log policy before you apply it.

  5. Load access log dashboards

    Import or build the Dashboards views that answer your operational questions: request volume over time, status code distribution, the top paths returning 5xx responses and latency if your format includes it. Build each visualization on the index pattern or data view that uses the mapping from the previous step. Save the dashboards and set their access to the teams that need them, since access logs can contain client addresses. The check is that each visualization shows data from the test traffic, and that counts on the status code panel match a count you run directly against the index for the same time range.

  6. Enable the Apache access log type in Security Analytics

    In Security Analytics, select the Apache access log type for the data source, then create or enable detectors for the log source that feeds your index. The supported log types reference lists the Apache access log type, which lets you apply its detection rules to the events in your index. Confirm that the field names your pipeline produces match what the log type expects, because a mismatch means a detector sees no matching events. Coordinate with the team that owns detection content, since enabling detectors changes what generates alerts. The step is done when the detector shows as active and its field mapping lists no unmapped required fields.

  7. Test a detector with a controlled request

    Send a request from a test host that matches a rule you enabled, such as a request pattern the detector is designed to flag, and confirm that a finding appears in Security Analytics within the detector's run cycle. Use a request against a test path so you do not generate false alarms for real users. Check that the finding carries the source address, path and timestamp from the original line. If nothing fires, compare the event fields with the rule conditions before changing the rule. Record which rules you tested and which did not fire, so the detection coverage is documented for your team.

  8. Configure error-spike alerts

    Create an alerting monitor on the access log index that counts 5xx responses over a short window and triggers when the count crosses a threshold you set from your normal traffic. Choose the threshold, window and notification channel with the service owners, and send the alert to a channel that someone watches. Set the monitor to exclude expected maintenance periods if your team uses them. The step is complete when a controlled burst of test 5xx responses triggers the monitor and the notification arrives at the intended destination, and when a normal request set does not trigger it.

Choosing parsing and detection options for access logs

Parsing can happen in a Data Prepper pipeline after logs reach OpenSearch, or at the shipper before they leave the web server host. A Data Prepper pipeline keeps parsing rules in one place that the platform team controls, so a change to the log format is made once and applies to every source. Parsing at the shipper pushes work to each host, which can reduce what travels over the network but spreads configuration across the fleet.

  • Data Prepper pipeline: Suits teams that want one parsing definition for nginx and Apache logs. Data Prepper's common use cases include log analytics, so the documented pipeline approach is the natural starting point.
  • Shipper-side parsing: Suits environments where hosts already run a collector with parsing support and the network path to OpenSearch is constrained. Expect per-host configuration and version management.
  • Effort drivers: Custom log formats, multi-line entries and the number of distinct server types raise effort in either location.
  • Ongoing cost: Pipeline changes need review and redeployment; shipper configs need fleet-wide rollout and testing.
  • Mixed approach: Some teams ship raw lines and parse centrally, keeping only minimal normalization on the host.

Before choosing, confirm with your platform team which collectors you already operate and whether your log format is a standard combined format or a custom one. Check the Data Prepper documentation for the current pipeline options that match your sources.

How Data Prepper parses nginx and Apache log lines

A Data Prepper pipeline turns each raw access log line into a structured event before anything reaches OpenSearch. The pipeline reads log lines from a source, runs processors that parse fields, enrich them and normalize timestamps, then writes the result to an OpenSearch index or data stream. The first decision is the log format. Apache's default combined format and nginx's default combined format are close but not identical, and nginx is configured through log_format directives in its configuration, so the pattern your parser expects must match the format your servers actually emit. Choose one format per server group, document it, and change nothing on the web tier without updating the parser. Confirm the grok or pattern syntax and the processor names against the Data Prepper documentation for the release you deploy, since processor options change between versions. Start with Data Prepper documentation and test the pattern on sample lines from each server before building dashboards on it.

Field naming is where dashboards and detections either line up or quietly break. Apache and nginx both record the client address, request method, path, status code, response size and user agent, but they do not name them the same way and may not record every field the same way by default. Pick one schema for the whole platform, such as the names used by the Security Analytics Apache access log type, and map both sources to it in the pipeline, so one dashboard query and one detection rule cover both servers. Keep the original raw line in a field such as message so that a parsing mistake can be found and reprocessed later. Record the schema in a short document that the detection and dashboard owners both review.

Timestamp handling deserves its own check. Access logs carry a timestamp in a format that includes a time zone offset, and the pipeline must convert it into the field OpenSearch uses for time-based queries and index rollover. If the offset is dropped or misread, error spikes will appear at the wrong time and correlation across hosts will fail. Confirm which field the index template treats as the time field, confirm the date format string against a log line that spans a daylight saving change, and decide whether to keep the original server time as a separate field for audit. Test with a log file that contains lines from several time zones before any alert threshold is set.

Securing access log data and who can see it

Access logs carry client IP addresses, user identifiers and the full request path, so they need the same access discipline as other sensitive data. The cards below cover the OpenSearch Security plugin controls, the audit trail and the transport protections that keep the pipeline from becoming an open window into your web traffic.

Role-based access to log indices

Create roles that map to who actually investigates web traffic, such as an on-call engineer who needs error spikes, a security analyst who needs detections, and a product owner who needs aggregate traffic. Grant each role read access only to the index patterns it needs, for example one pattern for nginx-access-* and another for apache-access-*. Check that no role grants wildcard index access by default, and confirm which roles can change Dashboards saved objects, since a shared dashboard can expose data that the underlying index role would hide.

Security docs

Document-level security for tenants

Document-level security limits a role to the subset of access log documents it may see, for example only the hostnames or virtual hosts owned by one application team. This is useful when one cluster holds logs for several sites or customers. Define the filter on fields that are reliably populated by your parser, such as a host field added in the pipeline, and test it with a non-admin account because a mistyped field name can silently return no results or, in some configurations, more than intended.

Field-level security and field masking

Field-level security hides whole fields from a role, while field masking shows a role a transformed value. Use masking for the client IP address and the remote user field, so analysts can still count unique clients or spot an attacker's subnet without reading full identifiers. Decide which fields are never needed outside the security team, such as the remote_user value from basic authentication, and hide them entirely. Verify masking on the search API and in Dashboards visualizations, since both paths must enforce the same rule.

Sensitive URL paths and query strings

The request line in an access log can contain session tokens, password reset codes, email addresses and search terms typed by customers. Decide before ingestion whether the query string is stored, truncated or dropped, and whether any path segments are replaced with placeholders. Limit who can read the raw request field, and keep the parsed path and status fields available to wider teams. Ask the application owners which routes accept personal data in the URL, because that list determines the parsing rules more than any default setting.

Audit logs for search and admin activity

The Security plugin audit log records authentication events and, depending on configuration, read and write requests against indices. Turn it on for the log cluster itself so you can answer who searched for which client IP range and when, which matters when an investigation or a privacy request depends on it. Decide where audit records are stored, who can read them, and how long they are kept. Keep the audit store separate from the access log indices so that users who can query web traffic cannot edit their own trail.

TLS for collection traffic

Logs move from the web servers through a shipper, through Data Prepper, and into the cluster, and each hop can expose client IPs and request paths in transit. Enable TLS for node-to-node and client traffic, and require certificates on the connection from Data Prepper to the cluster. Confirm which hops run on the same host and which cross a network boundary, and encrypt the ones that cross. Plan certificate issuance and rotation as part of the build, because an expired certificate stops ingestion and can create gaps in the logs you need for detections.

Keeping error-spike alerts reliable over time

Error-spike alerts drift as traffic and server configuration change, so plan their upkeep before the first alert fires. Set thresholds per site or upstream rather than one global number, and review them against normal daily and weekly traffic curves. Any change to the nginx or Apache log_format directive, or to the Data Prepper grok pattern that parses it, can silently stop fields such as the status code from matching. Treat the parser as versioned configuration, store it in Git with the server configuration, and run a saved sample of raw lines through the pipeline after each server change. Confirm with your team how a parser failure surfaces: a missing status field should trigger its own alert rather than producing zero errors.

Rotation is the other silent failure. Confirm that the Data Prepper or Fluent Bit collector tracks rotated files correctly, including compressed rotations, so a rotation does not drop or duplicate lines and skew the error rate. For retention, give access logs their own index pattern or data stream, and apply an Index State Management policy that moves older indices out of the hot tier and deletes them on a schedule your compliance team has signed off. Keep the alerting monitors pointed at the data stream alias, not at dated index names, so lifecycle changes do not break them. Ask your security or compliance lead which retention period applies to access logs before setting it.

Plan upgrades around the release and maintenance facts. OpenSearch targets a new minor version about every eight weeks, and a version stays in maintenance until the next major version enters maintenance or one year passes, whichever is longer. During maintenance it receives bug fixes and security patches but no new features. Keep a dated test environment that replays a sample of access logs, and check the Dashboards visualizations, Alerting monitors and Security Analytics detectors after each minor upgrade. Major upgrades need their own plan, and the OpenSearch releases page is the place to confirm current support dates before you commit to a version.

Questions teams ask before analyzing access logs in OpenSearch

What drives the cost of analyzing web server access logs in OpenSearch?

The main cost drivers are parser design, the number and variety of log sources, detection tuning and the storage volume the logs generate. A single nginx or Apache host with a standard combined log format is a small parsing job. Many virtual hosts, custom log formats, load balancers in front of the servers and retention periods measured in months add parser work, index size and tuning time. Ask any partner to price these items separately, so you can see which ones your environment actually triggers. Software licensing is not a cost driver, because OpenSearch is Apache 2.0 licensed.

How long does a web server access log project take?

Duration depends on how many log sources need parsing, how many dashboards and alerts are in scope, and how quickly your team can provide log samples, environment details and approvals. A narrow scope covering one or two servers, one dashboard and one error-spike alert is much shorter than a multi-site rollout with custom fields and detection tuning. Agree the timeline in writing as part of a fixed scope, and ask what each milestone depends on from your side.

What does our team need to provide before the work starts?

Plan for four inputs. First, read access to representative nginx or Apache access logs, including the exact log format configuration files, so the parser matches what the servers write. Second, environment details such as the OpenSearch version and deployment method, network paths from the web servers to the pipeline, and the hosting location of the cluster. Third, a named owner for the dashboards and detections. Fourth, a list of alert recipients and the channels they use. Missing any of these usually adds delay rather than cost.

Can our own engineers build this without a partner?

Yes, if they have experience with OpenSearch Dashboards, a log shipper and a parsing pipeline. The work is well documented, and Data Prepper and Security Analytics both support Apache access log handling. The harder parts are usually the ones teams underestimate: writing parsers that survive log format changes, tuning detections so they do not flood the alert channel, and keeping the cluster secured and sized as volume grows. A partner is most useful when your team lacks that bench time or wants the work reviewed against your security and retention requirements.

Is OpenSearch licensed under Apache 2.0 with no paid edition?

Yes. All software in the OpenSearch project is released under the Apache License, Version 2.0, and the OpenSearch FAQ does not describe any paid edition. This means the parsing pipeline, dashboards, Security Analytics and alerting features are available without a per-node license fee. Your costs will come from infrastructure, storage, staff time and any services you buy. Confirm current licensing terms with the project's own documentation before you finalize a budget, since your legal team may need to review them.

What happens to the setup when nginx or Apache log formats change?

A parser written against one log format will fail or silently drop fields when someone adds a field, changes a separator or enables a new module. Plan a sample-based test that runs whenever the web server configuration changes, and a dashboard or alert that flags a rise in unparsed events. Ask any partner how the parser will be versioned and who approves changes. This question matters more than the initial build, because it determines whether the dashboards stay accurate after the first year.

Do access logs contain data that needs extra protection?

They can. Access logs often include client IP addresses, user agents, request paths and sometimes query strings that carry tokens or personal data. Before you index them, decide which fields to keep, which to mask or drop, and who can see each field. OpenSearch Security provides role-based access control, field-level security and field masking, so you can limit access to sensitive fields. Check these controls against your own data classification and any regulatory obligations that apply to your organization.

How DeployOpen scopes access log analytics engagements

Before any build starts, DeployOpen puts the scope of the access log work in writing, because the scope decides almost everything else: how many log sources feed the cluster, which formats must be parsed, which dashboards and detections are delivered, and who receives each alert. The written scope lists each nginx or Apache host, the access.log and error.log files or syslog paths to collect, the log format strings in use (combined, custom or JSON), and the Data Prepper pipeline that will parse them. It also names the dashboards, the Security Analytics detections based on the Apache access log type, and the alert conditions for error-rate spikes, with the owner who acts on each alert. Ask your team to confirm the log formats on every server before scoping, since a single custom format changed on one host is a common source of parsing gaps.

The deployment is planned inside your own infrastructure, with access controls designed in from the first index. The scope should state which OpenSearch Security roles can read raw access logs, since client IP addresses, request paths and user agents may be personal data under your policies. Document-level and field-level security can restrict sensitive fields, and audit logging and TLS for node and client traffic should be covered in the same review. Identity source, such as SAML, OpenID Connect or LDAP, is agreed up front so that dashboard access follows your existing directory. Confirm with your security team which of these controls they require before the build, and record the answer in the scope document.

Log traffic and detection rules change after go-live, so many clients ask for a retainer alongside the fixed-scope build. A retainer can cover tuning of parsing rules when a web application changes its log format, adjustment of error-spike thresholds after traffic patterns shift, review of new detections, and OpenSearch upgrades. The quote should separate the one-time build from the recurring retainer, and it should name who performs upgrades and how the work is tested before production. Ask DeployOpen to state the retainer scope in writing, including response expectations, so the cost of ongoing tuning is visible before you commit.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.