# How to Send Logs to Multiple Outputs With Same Match Tags in Fluentd?

To direct logs matching a specific tag to multiple outputs in Fluentd, the [`@type copy` directive](https://docs.fluentd.org/output/copy) can be utilized. Here's an example configuration:

```text
[label /etc/fluent/fluentd.conf]

  <match pattern>
    @type copy
    <store>
      @type file
      path /var/log/myapp1
      ...
    </store>
    <store>
      ...
    </store>
    <store>
      ...
    </store>
  </match>
</label>
```
The `copy` plugin in Fluentd is designed to duplicate log events and send them to multiple destinations. The `<store>` section within the `<match>` block is where you define and configure the storage output for each duplicated log entry.

Suppose you have a source generating logs:

```text
[label /etc/fluent/fluentd.conf]
<source>
  @type dummy
  dummy '{"timestamp":"2024-01-27T08:33:17","severity":"ERROR"}'
  format json
  tag mylogs
</source>
```

To send these logs to both a file and standard output, you can configure it as follows:

```text
[label /etc/fluent/fluentd.conf]
  ...
  <match mylogs>
    @type copy
    <store>
      @type file
      path /var/log/mytestapp
      format json
    </store>
    <store>
      @type stdout
    </store>
  </match>
</label>
```

When running Fluentd, you will see the logs in the console:

```text
2024-01-28 19:26:29 +0000 [info]: #0 fluentd worker is now running worker=0
2024-01-28 19:26:30.071500553 +0000 mylogs: {"timestamp":"2024-01-27T08:33:17","severity":"ERROR"}
```

Simultaneously, a `/var/log/mytestapp` directory will be created, containing two files:

```text
[output]
buffer.<b6100691ab4b1f59fcafccef634b0b085>.log  buffer.b6100691ab4b1f59fcafccef634b0b085.log.meta
```

Viewing the file ending with `.log` will display the log contents:

```text
[label /var/log/mytestapp/buffer.<b61...085>.log]
{"timestamp":"2024-01-27T08:33:17","severity":"ERROR"}
```

## 🔭 Want to centralize and monitor your logs?
Go to [Logtail](https://betterstack.com/logtail/) and start your log management in 5 minutes.
[/summary]
![Better Uptime Dashboard](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/08b5b6cb-f57b-4ff4-cf1d-b303b8a94e00/public =1247x768)