# Influxdb ( Victoria Metrics ) Error + Filtering Logstash ( remove - split )

**URL:** https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994
**Category:** Logstash
**Created:** [November 19, 2020, 1:46pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994 "2020-11-19T13:46:53Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![recepbalibey](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@recepbalibey](https://discuss.elastic.co/u/recepbalibey)
#### Post date: [November 19, 2020, 1:46pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/1 "2020-11-19T13:46:53Z")

</div>

Here is only one example from my JSON file \>\>

`{"host":"ABCDEFASD","groups":["ABVD","TEST"],"applications": ["NETWORK"],"itemid":143172,"name":"Operational status of interface Se0/1/0:17","clock":1604283792,"ns":926563322,"value":2}`

AND I want to change this json file to metrics format:

`metrics{host="ABCDEFASD", groups="ABVD",groups="TEST",applications="NETWORK",name="Operational status of interface Se0/1/0:17", "itemid":143172}`

Can you help me with this? What should I follow with my config file?  
1-Problem : Remove \> value, ns, clock  
2-Problem : Separate \> `"groups":[ABVD","TEST"] groups="ABVD",groups="TEST" `  
3-Problem : metrics { }  
4-Problem : Influxdb, saving it on Victoria Metrics

I am connecting to SSH server with putty \>\> CentOS8 Linux Machine

`  
filter {

```
    mutate {

            remove_field => ["value", "ns", "clock"]

    }

    mutate {

            split => { "groups" => "," }

    }
      ruby {

            code =>"

            event.set("[metrics][host]",event.get("host"));

            event.remove("host")"

    }

   }

```

output {

```
    stdout {

            codec => rubydebug

            }

    influxdb {

            host => "10.92.161.1"

            port => 4288

            db => "metrics"

            codec => "json"

            }

    }

```

`

---

<div class="post-metadata">

### Author: ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)
#### Post date: [November 19, 2020, 2:26pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/2 "2020-11-19T14:26:16Z")

</div>

[influxdb output plugin](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-influxdb.html#plugins-outputs-influxdb) is not bundled by default with logstash,  
it is easy to install by running `bin/logstash-plugin install logstash-output-influxdb`

---

<div class="post-metadata">

### Author: ![recepbalibey](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@recepbalibey](https://discuss.elastic.co/u/recepbalibey)
#### Post date: [November 19, 2020, 2:34pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/3 "2020-11-19T14:34:03Z")

</div>

This command doesn't work for CentOS 8.

---

<div class="post-metadata">

### Author: ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)
#### Post date: [November 19, 2020, 2:37pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/4 "2020-11-19T14:37:20Z")

</div>

1. May be you should run it from `/usr/share/logstash`  
Check it [here](https://www.elastic.co/guide/en/logstash/current/dir-layout.html#deb-layout) the structure of directory of logstash

2. If you use codec =\> "json" when you need to tranform your json to metrics format  
You can simply remove unecessary fields and then send the json directly

---

<div class="post-metadata">

### Author: ![recepbalibey](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@recepbalibey](https://discuss.elastic.co/u/recepbalibey)
#### Post date: [November 19, 2020, 2:40pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/5 "2020-11-19T14:40:12Z")

</div>

What should I change with my configuration file for the metrics part? [{host=...} to metrics{host=..}]  
And remove - separating part is correct, do you think?  
Because of influxdb problem, I am not able to check the output.

---

<div class="post-metadata">

### Author: ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)
#### Post date: [November 19, 2020, 2:45pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/6 "2020-11-19T14:45:23Z")

</div>

Continue with your example, install the influxdb output plugin and remove this

```auto
mutate { split => { "groups" => "," }}

```

Try and share your feedback

---

<div class="post-metadata">

### Author: ![recepbalibey](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@recepbalibey](https://discuss.elastic.co/u/recepbalibey)
#### Post date: [November 19, 2020, 2:49pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/7 "2020-11-19T14:49:49Z")

</div>

I just installed influxdb and solved the one of the output problem.  
Now I am getting this error :  
`Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console`

Why did you offer to remove that filtering part?  
I want this with that \>\>  
"groups":["ABVD","TEST"]"  
groups="ABVD",groups="TEST"

---

<div class="post-metadata">

### Author: ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)
#### Post date: [November 19, 2020, 3:29pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/8 "2020-11-19T15:29:12Z")

</div>

Sorry, I'm not aware of the format that should be used by influxdb  
I see that the influxdb ouput plugin have a parameter called codec that can be setted to plain or json and you are using codec =\> "json", that let me think that influxDB will accept directly the json payload sent by logstash ... so in my opinion you can try to send json without splitting it 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 17, 2020, 3:29pm UTC](https://discuss.elastic.co/t/influxdb-victoria-metrics-error-filtering-logstash-remove-split/255994/9 "2020-12-17T15:29:14Z")

</div>

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