> For the complete documentation index, see [llms.txt](https://syslog-macos-testing.gitbook.io/syslog-macos-testing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://syslog-macos-testing.gitbook.io/syslog-macos-testing/modules/affile/file-destination-driver.md).

# file() Destination Driver

The file driver is one of the most important destination drivers in syslog-ng. It allows to output messages to the specified text file, or to a set of files.

### Status

| Architecture | Status |
| :----------: | :----: |
|      x86     |  Works |
|      ARM     |  Works |

### How to Test

File() drivers are at the very core of syslog-ng. Chances are you are already using them for displaying output to your console. To test the file destination driver, we will use it to store a custom message in a file and then checking the contents of the file.

File() destination driver is also used to display any output on the console. The code snippet is shown below.&#x20;

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

#### Configuration File Used

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

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

destination d_file{
    file("/Users/yash/Documents/test.txt" perm(0755));
};

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

#### Proof

![file() destination driver tested on macOS (x86)](https://3267548193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaZdBoDvCx_0JwOUICk%2F-Mc91YnylUcmWQQX3CCj%2F-Mc93cUaa0VohOmnstBt%2FScreenshot%202021-06-14%20at%201.30.12%20PM.png?alt=media\&token=9d22178e-a86d-431f-ac17-5012dcebcf26)

![file() destination driver tested on macOS (ARM)](https://3267548193-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MaZdBoDvCx_0JwOUICk%2F-MhXfp6utMsNE9_-xfVe%2F-MhXimrMdA6q952tjePl%2FScreen%20Shot%202021-08-20%20at%2011.42.33%20AM.png?alt=media\&token=8c47dc85-76af-4efa-a3d2-9d8ab238efdc)
