# unix-dgram() Source/Destination Driver

### Important Information

Unix-dgram() is used on BSDs and uses SOCK\_DGRAM semantics: this may result in lost local messages if the system is overloaded.&#x20;

In the official documentation, `/dev/log` is the default entry for system logging. This, in fact, is a **socket**, not a regular file or a pipe. MacOS, however, uses `/var/run/syslog`  for the same. This needs to be kept in mind while referring to the documentation.

### Status

| x86 | Works |
| :-: | :---: |
| ARM | Works |

### How to Test

To test the unix-dgram() drivers, we will run two instances of syslog-ng. One where we are transmitting data to a socket using the unix-dgram() destination driver that needs to be tested. And another that will listen for the data on the socket using the unix-stream() source driver.

***Source Configuration File***

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

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

source s_dgram {
    unix-dgram("/var/run/syslog");
};

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

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

> **Note: We need to run the source driver first as it will open the socket to which the destination driver connects to.**&#x20;

***Destination Configuration File***

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

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

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

destination d_dgram {
    unix-dgram("/var/run/syslog");
};

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

### **Proof**&#x20;

![unix-dgram() drivers tested on macOS (x86)](https://3267548193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaZdBoDvCx_0JwOUICk%2F-Mc0kUmM_jBLggsRWHOP%2F-Mc0kxmVMeNVP1l6UeEI%2FScreenshot%202021-06-12%20at%2010.47.07%20PM.png?alt=media\&token=cb9ec55c-7c6a-4b4c-8198-69ab06470a8e)

![unix-dgram() drivers tested on macOS (ARM)](https://3267548193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaZdBoDvCx_0JwOUICk%2F-Mc0lfB7obySWfE_myhA%2F-Mc0mn64Vq6ljzhnzx0k%2FScreenshot%202021-06-12%20at%2010.54.15%20PM.png?alt=media\&token=3d837077-7d75-431b-aaac-6b65b6103c72)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://syslog-macos-testing.gitbook.io/syslog-macos-testing/modules/afsocket/unix-dgram-source-destination-driver.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
