# Use Kapacitor to export data into various databases

**URL:** <https://community.influxdata.com/t/use-kapacitor-to-export-data-into-various-databases/15240>\
**Category:** Kapacitor\
**Tags:** telegraf, kapacitor\
**Created:** [July 14, 2020, 6:41am UTC](https://community.influxdata.com/t/use-kapacitor-to-export-data-into-various-databases/15240 "2020-07-14T06:41:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![teunvink](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/teunvink/32/4238_2.png) [@teunvink](https://community.influxdata.com/u/teunvink)\
**Post date:** [July 14, 2020, 6:41am UTC](https://community.influxdata.com/t/use-kapacitor-to-export-data-into-various-databases/15240/1 "2020-07-14T06:41:41Z")

</div>

We have a central InfluxDB server which receives measurements from numerous hosts in our network. We want to export measurements from specific hosts to a customer database and tag that with a customer ID. For this I tried to write a number of TICK scripts to fix this in Kapacitor. However, I can’t get the script to work: although the script loads, no data is written to the target database.

This is one of many attempts to get this to work:

```
dbrp "telegraf"."autogen"

stream
    |from()
        .database('telegraf')
        .retentionPolicy('autogen')
        .measurement('jitsi_stats')
        .where(lambda: ("host" =~ '/customer-hostname/'))
        .groupBy(*)
    |influxDBOut()
        .cluster('writer')
        .database('customer')
        .retentionPolicy('retention_30d')
        .measurement('jitsi_stats')
        .tag('customer_id', '12345')

```

If I try to query the Influx database, I get proper data:

```
> select bit_rate_download from "telegraf"."autogen".jitsi_stats where host =~ /customer-hostname/ and time > now() - 1m
name: jitsi_stats
time bit_rate_download
---- -----------------
2020-07-13T09:45:39Z 0
2020-07-13T09:45:40Z 0
(etc)

```

Any hints on what I’m doing wrong and how to get this to work would be appreciated!

---

<div class="post-metadata">

**Author:** ![teunvink](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/teunvink/32/4238_2.png) [@teunvink](https://community.influxdata.com/u/teunvink)\
**Post date:** [July 15, 2020, 3:40pm UTC](https://community.influxdata.com/t/use-kapacitor-to-export-data-into-various-databases/15240/2 "2020-07-15T15:40:24Z")

</div>

Turns out I forgot to add a correct subscription entry in my kapacitor config, so no data could be received. Now that I fixed that, everything works as designed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/3X/2/f/2feb065bdfd5e4b7728243aa3b9192ad3e8447c1.png) [@system](https://community.influxdata.com/u/system)\
**Post date:** [July 15, 2020, 4:40pm UTC](https://community.influxdata.com/t/use-kapacitor-to-export-data-into-various-databases/15240/3 "2020-07-15T16:40:31Z")

</div>

Closed on July 15, 2020, 4:40pm UTC

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.
