# Using syslog()

### TLS-encryption using syslog() driver

#### Configuration Files Used

To test the TLS-encryption using syslog() driver, we will run two instances of syslog-ng. One where we are transmitting data using the public key. And another that will listen for the data on the TLS-encrypted network pipeline and decrypt the same.

***Destination Configuration File (Client)***

```
@version: 3.31
@include "scl.conf"

options {
    stats-freq(10);
    time-reopen(10);
};

source custom
{
    example-msg-generator(
        num(20)
        freq(5)
        template("TLS Message")
    );
};

destination tls_destination {
    syslog(
        "0.0.0.0" port(1999)
        transport("tls")
        tls( 
            ca_dir("/usr/local/etc/ssl/clientSSL/ca.d")
            )
    );
};

log {
    source(custom);
    destination(tls_destination);
};
```

***Source Configuration File (Server)***

```
@version: 3.31
@include "scl.conf"

options {
    stats-freq(10);
    time-reopen(10);
};

destination console{
    file(/dev/stdout);
};

source tls_source {
    syslog(
        ip(0.0.0.0) port(1999)
        transport("tls")
        tls(
            ca_dir("/usr/local/etc/ssl/ca.d")
            key-file("/usr/local/etc/ssl/key.d/privkey.pem")
            cert-file("/usr/local/etc/ssl/cert.d/cacert.pem")
            peer-verify(optional-untrusted)
        )
    );
};

log {
    source(tls_source);
    destination(console);
};
```

### Proof

![TLS-encryption tested on syslog() driver on macOS (x86)](https://3267548193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaZdBoDvCx_0JwOUICk%2F-MdvaFXRziyUwoifuHKA%2F-MdvuAPgsWYpjeo7_kkj%2FScreenshot%202021-07-06%20at%204.01.08%20PM.png?alt=media\&token=bed90738-4189-4690-832e-eb27e7db4939)

![TLS-encryption testing on the network() driver on macOS (ARM)](https://3267548193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaZdBoDvCx_0JwOUICk%2F-Meb0Q0HGVB0Vb4hziSt%2F-Meb4QfQ0uPPtDXOKLlN%2FScreen%20Shot%202021-07-15%20at%201.13.41%20AM.png?alt=media\&token=d658e130-7905-4a14-89d3-dac5d8166e24)
