Skip to main content
This guide shows how to forward Jenkins Audit Trail logs (already written to a file on the Jenkins controller) to Elastic Cloud (hosted Elasticsearch) using the Elastic Agent. The high-level flow:
  1. Use Elastic Cloud Observability onboarding to get the Elastic Agent installation command and API key.
  2. Install the Elastic Agent on the Jenkins controller.
  3. Update the Elastic Agent configuration at /opt/Elastic/Agent/elastic-agent.yml to stream the Audit Trail files.
  4. Verify logs in Kibana / Elastic Cloud Observability.
Recommended reading:

1. Create an Elastic Cloud trial and get onboarding details

In Elastic Cloud, open the Observability tab → Collect and analyze logs → choose the resource type to monitor (for a Jenkins controller, choose host system logs or stream log files). Elastic Cloud will produce an onboarding one-liner that downloads and installs the Elastic Agent and enrolls it with your cluster.
A screenshot of the Elastic/Kibana observability onboarding page showing tiles for selecting resource types to monitor — e.g., Stream host system logs, Stream log files, OpenTelemetry, and cloud providers (Azure, AWS, Google Cloud). A search bar and a "Setup guides" button are visible in the top navigation.
Example onboarding command (replace the API key and onboarding URL with the values provided):
Keep your onboarding API key secret. Do not check it into source control or share it publicly. Use the exact API key and onboarding endpoint provided by your Elastic Cloud Observability onboarding page.
When you run the script it will download and install the Elastic Agent, enroll it with your Elastic Cloud instance, and write a base configuration file to /opt/Elastic/Agent/elastic-agent.yml. Typical condensed output:

2. Confirm Jenkins Audit Trail files exist

Before configuring the agent, confirm the Audit Trail plugin writes logs somewhere accessible to the agent. Common location:
Example output:
Sample audit log lines:

3. Review the onboarding configuration

The onboarding script writes a base elastic-agent.yml. Important sections:
  • outputs — where the agent sends data (Elasticsearch cluster and API key).
  • inputs — what log files to collect.
Representative snippet (from onboarding):
You will add a logfile input for the Jenkins Audit Trail files under the inputs: list.

4. Add a logfile input for Jenkins Audit Trail

Edit /opt/Elastic/Agent/elastic-agent.yml and add a logfile input that targets the Audit Trail files. Use wildcards to capture rotated files and include multiline only if entries span multiple lines. Minimal example to add under inputs::
Key considerations:
  • Use paths with a wildcard (custom*.log*) to include rotated logs.
  • Only enable multiline if log entries span multiple lines; the pattern: '^\\s' + match: after treats indented lines as continuations.
  • Select a clear dataset (e.g., jenkins.audit) so logs are organized correctly in Elastic.

5. Restart the Elastic Agent

After saving elastic-agent.yml, restart the agent so it applies the new configuration:
Or, if the CLI is available:
Give it a minute to start shipping logs.

6. Verify logs in Kibana / Elastic Cloud

Open Kibana → Observability → Logs (or Discover). Look for events with the dataset you configured (for example jenkins.audit) and inspect parsed fields. If parsing or ingest issues occur, check:
  • Agent logs on host: /var/log/elastic-agent/ or journalctl -u elastic-agent.
  • That the paths: you configured match actual files and permissions allow the agent to read them.
  • The ingest pipeline used by Elastic for your dataset; default pipelines may expect a different timestamp/format.

Troubleshooting

Example parsing error you might see:
This indicates the pipeline expects a different timestamp or layout. Either modify the ingest pipeline or add a grok processor in the agent configuration to normalize the fields.
Make sure to use the exact API key and onboarding endpoint provided by your Elastic Cloud Observability onboarding page. After editing elastic-agent.yml, always restart the Elastic Agent so it reloads the configuration.

Summary checklist

That’s it — once the agent is reading the audit files and sending events to your Elastic Cloud cluster, you can build Discover queries, dashboards, or alerts based on the jenkins.audit dataset.

Watch Video