---
title: "Coding Appendix: Linux event Source Example"
description: "Linux Event Source ExampleLinux Event Source Example\nThis section shows sample input, filters and output configuration to collect system and audit ev"
---

[Skip to content](https://mydev.netwitness.com/knowledge-base/codingappendix-linuxeventsourceexample#main-content)

![NW Logo](https://mydev.netwitness.com/hs-fs/hubfs/Portal-Partner%20Program/AssetFiles/NW%20Logo%20(2).png?width=180&height=32&name=NW%20Logo%20(2).png)

- [Home](https://mydev.netwitness.com/home)
- Integrations
  
  Show submenu for Integrations

    - [Netwitness Platform Integrations](https://mydev.netwitness.com/netwitnessplatformintegrations)
    - [Third Party Integrations](https://mydev.netwitness.com/thirdpartyintegrations)
- [Knowledge Center](https://mydev.netwitness.com/knowledge-base)
- Community
  
  Show submenu for Community

    - [Blogs](https://mydev.netwitness.com/netwitness-security-llc-blog)
    - Discussions
- Customers
  
  Show submenu for Customers

    - [Manage Products and Licenses](https://mydev.netwitness.com/nwportal)
    - Downloads
- Partners
  
  Show submenu for Partners

    - [Partner Program](https://mydev.netwitness.com/partner)
    - [Partner Resources](https://mydev.netwitness.com/partnerresources)
    - [Submit a New Deal Registration](https://mydev.netwitness.com/dealregistration)
    - [Become a Partner](https://mydev.netwitness.com/becomeapartner)
    - [Update Your Partner Locator Profile](https://www.netwitness.com/partner-locator/?utm_source=pardotnewsletter&utm_medium=email&utm_campaign=partner_march)
    - [NetWitness LinkedIn Partner Hub](https://linkedin.com/showcase/netwitnesspartners/)
- Education
  
  Show submenu for Education

    - [Instructor Led Training Schedule](https://mydev.netwitness.com/instructorledtrainingschedule)
    - [NetWitness Training Catalog](https://mydev.netwitness.com/netwitnesstrainingcatalog)
    - [Security Awareness Training](https://mydev.netwitness.com/securityawarenesstraining)
    - [New Product Readiness](https://mydev.netwitness.com/newproductreadiness)
    - [On-Demand Virtual Labs](https://mydev.netwitness.com/ondemandvirtuallabs)
    - [Additional Training Information](https://mydev.netwitness.com/additionaltraininginformation)
    - [Frequently Asked Questions](https://mydev.netwitness.com/educationfaq)
    - [Contact NetWitness Education Team](https://mydev.netwitness.com/contact-netwitness-education-team)
- Support
  
  Show submenu for Support

    - [Contact Support](https://mydev.netwitness.com/contact-support)
    - [Create a New Case](https://mydev.netwitness.com/create-support-case)
    - [View My Cases](https://mydev.netwitness.com/viewmycase)
    - [Product Version Life Cycle](https://mydev.netwitness.com/product-version-life-cycle)
    - [Warranty & Replacement Parts](https://mydev.netwitness.com/warranty-and-replacement-parts)
    - [Community Support Forum](https://mydev.netwitness.com/community-support-forum)
    - [Technical Support Guide](https://mydev.netwitness.com/technical-support-guide)

Open main navigation

Close main navigation

- [Home](https://mydev.netwitness.com/home)
- Integrations
  
  Show submenu for Integrations

    - [Netwitness Platform Integrations](https://mydev.netwitness.com/netwitnessplatformintegrations)
    - [Third Party Integrations](https://mydev.netwitness.com/thirdpartyintegrations)
- [Knowledge Center](https://mydev.netwitness.com/knowledge-base)
- Community
  
  Show submenu for Community

    - [Blogs](https://mydev.netwitness.com/netwitness-security-llc-blog)
    - Discussions
- Customers
  
  Show submenu for Customers

    - [Manage Products and Licenses](https://mydev.netwitness.com/nwportal)
    - Downloads
- Partners
  
  Show submenu for Partners

    - [Partner Program](https://mydev.netwitness.com/partner)
    - [Partner Resources](https://mydev.netwitness.com/partnerresources)
    - [Submit a New Deal Registration](https://mydev.netwitness.com/dealregistration)
    - [Become a Partner](https://mydev.netwitness.com/becomeapartner)
    - [Update Your Partner Locator Profile](https://www.netwitness.com/partner-locator/?utm_source=pardotnewsletter&utm_medium=email&utm_campaign=partner_march)
    - [NetWitness LinkedIn Partner Hub](https://linkedin.com/showcase/netwitnesspartners/)
- Education
  
  Show submenu for Education

    - [Instructor Led Training Schedule](https://mydev.netwitness.com/instructorledtrainingschedule)
    - [NetWitness Training Catalog](https://mydev.netwitness.com/netwitnesstrainingcatalog)
    - [Security Awareness Training](https://mydev.netwitness.com/securityawarenesstraining)
    - [New Product Readiness](https://mydev.netwitness.com/newproductreadiness)
    - [On-Demand Virtual Labs](https://mydev.netwitness.com/ondemandvirtuallabs)
    - [Additional Training Information](https://mydev.netwitness.com/additionaltraininginformation)
    - [Frequently Asked Questions](https://mydev.netwitness.com/educationfaq)
    - [Contact NetWitness Education Team](https://mydev.netwitness.com/contact-netwitness-education-team)
- Support
  
  Show submenu for Support

    - [Contact Support](https://mydev.netwitness.com/contact-support)
    - [Create a New Case](https://mydev.netwitness.com/create-support-case)
    - [View My Cases](https://mydev.netwitness.com/viewmycase)
    - [Product Version Life Cycle](https://mydev.netwitness.com/product-version-life-cycle)
    - [Warranty & Replacement Parts](https://mydev.netwitness.com/warranty-and-replacement-parts)
    - [Community Support Forum](https://mydev.netwitness.com/community-support-forum)
    - [Technical Support Guide](https://mydev.netwitness.com/technical-support-guide)

 How can we help you?

- There are no suggestions because the search field is empty.

1. [NetWitness Knowledge Base](https://mydev.netwitness.com/knowledge-base?hsLang=en)
2. [Documentation](https://mydev.netwitness.com/knowledge-base/documentation?hsLang=en)

April 28, 2026

# Coding Appendix: Linux event Source Example

## Linux Event Source ExampleLinux Event Source Example

This section shows sample input, filters and output configuration to collect system and audit events from CentOS.

## Input PluginInput Plugin

An input plugin enables a specific source of events to be read by Logstash. The following code represents an example input plugin.

Copy

input-beats.conf

`# Below input block collects events using beats plugins (e.g filebeats, auditbeats) # Skip this block if it's already defined in another pipeline. input { beats { port => 5044 } }`

Make sure that port 5044 is open on the Logstash machine. As an example, if Logstash is on a CentOS system, run the following commands to open port 5044:

firewall-cmd --add-port=5044/tcp  
firewall-cmd --add-port=5044/tcp --permanent  
firewall-cmd --reload

## Output PluginOutput Plugin

An output plugin sends event data to a particular destination. Outputs are the final stage in the event pipeline.

Copy

output-netwitness-tcp.conf

`# Below is tcp output plugin with netwitness codec to tranform events in syslog and send it to LogDecoder # Only one of these configurations can be within the same pipeline. output { #if [@metadata][nw_type] { # Only targeted NetWitness items tcp { id => "netwitness-tcp-output-conf-output" host => "10.10.100.100" ## LogDecoder IP port => 514 ssl_enable => false #ssl_verify => true #ssl_cacert => "/path/to/certs/nw-truststore.pem" #ssl_key => "/path/to/certs/privkey.pem" #ssl_cert => "/path/to/certs/cert.pem" codec => netwitness { # Payload format mapping by nw_type. # If nw_type is absent or formatting fails, JSON event is used as the payload payload_format => { "apache" => "%APACHE-4-%{verb}: %{message}" } # Failover format, if above format fails # If nw_type is absent or formatting fails, JSON event is used as the payload payload_format_failover => { "apache" => "%APACHE-4: %{message}" # When verb is missing } } } #} }`

## Filter PluginFilter Plugin

A filter plugin performs intermediary processing on an event. Below is a filter plugin configuration for system events collected from linux using the Filebeat plugin.

Copy

linux-system.conf

`# Filters are often applied conditionally depending on the characteristics of the events. # Requires these additional configurations within the same pipeline: # input-beats.conf # output-netwitness-tcp.conf filter { if ![@metadata][nw_type] { if [ecs][version] and [host][hostname] and [agent][type] == "filebeat" { if [event][module] == "system" { mutate { add_field => { "[@metadata][nw_type]" => "linux" "[@metadata][nw_msgid]" => "LOGSTASH001" "[@metadata][nw_source_host]" => "%{[host][hostname]}" } } } } } }`

Below is filter plugin configuration for audit events collected from linux using the Auditbeat plugin.

Copy

linux-audit.conf

`filter { if ![@metadata][nw_type] { # Update Once if [ecs][version] and [host][hostname] and [agent][type] == "auditbeat" { if [event][module] == "audit" { mutate { add_field => { "[@metadata][nw_type]" => "linux" "[@metadata][nw_msgid]" => "LOGSTASH002" "[@metadata][nw_source_host]" => "%{[host][hostname]}" } } } } } }`

## Create a PipelineCreate a Pipeline

It is recommended to have one pipeline for each input type. For example, all beats collection should be in the same pipeline. To run collection as separate pipeline, create a directory and add above input, filters, and output configuration files to it.

Copy

Example Pipeline for Beats

`/etc/logstash/pipeline1/ /etc/logstash/pipeline1/input-beats.conf /etc/logstash/pipeline1/output-netwitness-tcp.conf /etc/logstash/pipeline1/linux-system.conf /etc/logstash/pipeline1/linux-audit.conf`

Modify /etc/logstash/pipeline.yml and add the following entries:

Copy

Add to pipeline.yml

`- pipeline.id: my-sample-pipeline-1 path.config: "/etc/logstash/pipeline1/*.conf"`

[![Netwitness Logo](https://mydev.netwitness.com/hs-fs/hubfs/Quote%20Template%20-%20NW%20Logo/Netwitness%20Logo.png?width=158&height=42&name=Netwitness%20Logo.png "Netwitness Logo")](https://mydev.netwitness.com/?hsLang=en)

<https://www.linkedin.com/company/netwitness-platform/> <https://www.youtube.com/@netwitness>

Copyright © 2026, NetWitness LLC. All rights reserved.

[NetWitness Platform](https://www.netwitness.com/)

[Acceptable Use Policy](https://www.netwitness.com/wp-content/uploads/Acceptable-Use-Policy-092022.pdf) [Privacy Statement](https://www.netwitness.com/wp-content/uploads/NetWitness-Privacy-Statement-07292024.pdf)

![NetWitness Logo](https://mydev.netwitness.com/hubfs/Portal-Partner%20Program/netwitness-logo-RGB-white%201.png)

[![LinkedIn](https://mydev.netwitness.com/hubfs/Portal-Partner%20Program/linkedin.png)](https://www.linkedin.com/company/netwitness-platform/) [![YouTube](https://mydev.netwitness.com/hubfs/Portal-Partner%20Program/Youtube.jpg)](https://www.youtube.com/@netwitness)

© 2026 NetWitness LLC. All rights reserved.