---
title: Syslog-ng
description: Configure Syslog-ng to gather logs from your host, containers, & services.
breadcrumbs: Docs > Integrations > syslog_ng
---

# syslog_ng
Supported OS 
{% callout %}
# Important note for users on the following Datadog sites: us2.ddog-gov.com

{% alert level="info" %}
To find out if this integration is available in your organization, see your [Datadog Integrations](https://app.datadoghq.com/integrations) page or ask your organization administrator.

To initiate an exception request to enable this integration for your organization, email [support@ddog-gov.com](mailto:support@ddog-gov.com).
{% /alert %}

{% /callout %}

## Overview{% #overview %}

Configure Syslog-ng to gather logs from your host, containers, & services.

## Setup{% #setup %}

### Log collection{% #log-collection %}

1. Collect system logs and log files in `/etc/syslog-ng/syslog-ng.conf` and make sure the source is correctly defined:

   ```
   source s_src {
   system();
   internal();
   
   };
   ```

If you want to monitor files, add the following source:

   ```
   #########################
   # Sources
   #########################
   
   ...
   
   source s_files {
   file("path/to/your/file1.log",flags(no-parse),follow_freq(1),program_override("<program_name_file1>"));
   file("path/to/your/file2.log",flags(no-parse),follow_freq(1),program_override("<program_name_file2>"));
   
   };
   ```

1. Set the correct log format:

   ```
   #########################
   # Destination
   #########################
   
   ...
   
   # For Datadog platform:
   destination d_datadog {
     http(
         url("https://http-intake.logs.<YOUR_DATADOG_SITE>/api/v2/logs?ddsource=<SOURCE>&ddtags=<TAG_1:VALUE_1,TAG_2:VALUE_2>")
         method("POST")
         headers("Content-Type: application/json", "Accept: application/json", "DD-API-KEY: <DATADOG_API_KEY>")
         body("<${PRI}>1 ${ISODATE} ${HOST:--} ${PROGRAM:--} ${PID:--} ${MSGID:--} ${SDATA:--} $MSG\n")
     );
   };
   ```

1. Define the output in the path section:

   ```
   #########################
   # Log Path
   #########################
   
   ...
   
   log { source(s_src); source(s_files); destination(d_datadog); };
   ```

1. Restart syslog-ng.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
