TCP-input Receiving an encoding error

Hello,
I have a TCP input and getting data with some special characters. How do I resolve this issue?

Here is my config


input {
    tcp {
        host => "0.0.0.0"
        port => "0000"
        mode => "server"
        type => "graphite-format-metrics"
        codec => graphite 
    }

}
filter {
     mutate{
        #gsub => ["message","\\u0000",""]
        #gsub => [ "message", "\x86", "" ]
        gsub => ["message", "\\u0018", ""]
        gsub => ["message", "¥",""]
        gsub => ["message", "[\[]",""]
        gsub => ["message", "[\]]",""]
        gsub => ["message", "[\\]", ""]
}
}
output {
    stdout { codec => rubydebug }

    elasticsearch {
            ndex => "logstash-graphite-%{+YYYY.MM.dd}"
        }
}

As you can see, I have tried to strip the unicode charecters with gsub in my filter. Getting the following so many times.

``` Received an event that has a different character encoding than you configured. {:text=>"ㆆq\u0002a.\u0000\u0000\u0000R\x80\u0002]q\u0001U3terminal.029666.top._opt_morpho_bin_hardmond.topcpuGA\xD8\xE6ݴ\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000\x99\x80\u0002]q\u0001(U#terminal.025930.top.._pweupl.topmemGA\xD8\xE6\xDD\xC2\xC0\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U>terminal.027151.df-mnt-configuration-lotsys.percent_bytes-usedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G?\xCA\u0015+?\xFF\xFF\xFD\x86\x86q\u0003e.\u0000\u0000\u0000H\x80\u0002]q\u0001U)terminal.029972.top.{chromium-bin}.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\b\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000n\x80\u0002]q\u0001(U\eTC.RDL027702.memory.freeRamGA\xD8\xE6ݥ@\u0000\u0000GA\u0016Q\xE0\u0000\u0000\u0000\u0000\x86\x86q\u0002U\eTC.RDL027702.memory.freeRamGA\xD8\xE6ݴ@\u0000\u0000GA\u0016M\xE0\u0000\u0000\u0000\u0000\x86\x86q\u0003e.\u0000\u0000\u0000A\x80\u0002]q\u0001U\"terminal.019628.cpu.percent-activeGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@<h\u0016\xD2J+~\x86\x86q\u0002a.\u0000\u0000\u0000f\x80\u0002]q\u0001(U\u0017TC.RDL031044.version.OSGA\xD8\xE6ݥ@\u0000\u0000G@\xB5\x87\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U\u0017TC.RDL031044.version.OSGA\xD8\xE6ݴ@\u0000\u0000G@\xB5\x87\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003e.\u0000\u0000\u0000ƀ\u0002]q\u0001(U\"terminal.024919.top.COMMAND.topmemGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U,terminal.024919.top.._pwedwnmgrtester.topmemGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003U(terminal.024919.top.[kworker_2.1].topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\b\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0004e.\u0000\u0000\u0000\x83\x80\u0002]q\u0001(U&terminal.024438.top.._pweuplmgr.topmemGA\xD8\xE6ݴ\u0000\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U%terminal.024438.memory.percent-cachedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@Ju\xB0\u000E\x8C۸\x86\x86q\u0003e.\u0000\u0000\u0000D\x80\u0002]q\u0001U%terminal.027777.top._usr_bin_X.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000K\x80\u0002]q\u0001U,terminal.027653.top.._pwedwnmgrtester.topmemGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000B\x80\u0002]q\u0001U#terminal.029972.top.collectd.topmemGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@(\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000=\x80\u0002]q\u0001U\u001Eterminal.028190.top.top.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000\x9C\x80\u0002]q\u0001(U;terminal.028867.df-mnt-configuration-lotsys.df_complex-usedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000GA^ \u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U)terminal.028867.top.{chromium-bin}.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0014\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003e.\u0000\u0000\u0000B\x80\u0002]q\u0001U#terminal.028190.top.._pwedwn.topmemGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0014\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000p\x80\u0002]q\u0001(U\u001CTC.RDL031259.memory.totalRamGA\xD8\xE6ݥ@\u0000\u0000GA/U\xA0\u0000\u0000\u0000\u0000\x86\x86q\u0002U\u001CTC.RDL031259.memory.totalRamGA\xD8\xE6ݴ@\u0000\u0000GA/U\xA0\u0000\u0000\u0000\u0000\x86\x86q\u0003e.\u0000\u0000\u0000ր\u0002]q\u0001(U-terminal.027151.top._usr_sbin_rsyslogd.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U&terminal.027151.top.._pwedwnmgr.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003U3terminal.019329.top._opt_morpho_bin_hardmond.topmemGA\xD8\xE6ݴ\x80\u0000\u0000G?\xF0\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0004e.\u0000\u0000\u0000ʀ\u0002]q\u0001(U(terminal.028949.top.[kworker_3.0].topcpuGA\xD8\xE6ݴ\u0000\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U(terminal.028949.memory.percent-slab_reclGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G?\xE7\xF8K\u0014u\xDA͆\x86q\u0003Uterminal.028949.memory.percent-slab_unreclGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G?\xEFz\u0002\xB9\xAB\xEC\x86\x86q\u0004e.\u0000\u0000\u0000T\x80\u0002]q\u0001U5terminal.020744.df-versions-active.percent_bytes-usedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@A\xF0E\x80\u0000\u0000\u0002\x86\x86q\u0002a.\u0000\u0000\u0000Q\x80\u0002]q\u0001U2terminal.028841.top._opt_app_LT_application.topmemGA\xD8\xE6ݴ\u0000\u0000\u0000G@Q@\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000W\x80\u0002]q\u0001U8terminal.024269.sensors-w83627uhg-isa-0290.fanspeed-fan1GA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\x9D\xF4\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000B\x80\u0002]q\u0001U#terminal.019628.top.._pweupl.topmemGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000Q\x80\u0002]q\u0001U2terminal.028022.top._opt_app_LT_application.topcpuGA\xD8\xE6ݴ@\u0000\u0000G@\u0014\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000Z\x80\u0002]q\u0001U;terminal.024438.df-mnt-configuration-lotsys.df_complex-usedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000GA^ \u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000[\x80\u0002]q\u0001U<terminal.028022.sensors-w83627uhg-isa-0290.temperature-temp2GA\xD8\xE6\xDD\xC3@\u0000\u0000G@F\x80\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000\x87\x80\u0002]q\u0001(U-terminal.029228.top._usr_sbin_rsyslogd.topcpuGA\xD8\xE6ݴ\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U\"terminal.029228.cpu.percent-activeGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@<G\xED\u0012th'\x86\x86q\u0003e.\u0000\u0000\u0000H\x80\u0002]q\u0001U)terminal.019329.top.{chromium-bin}.topmemGA\xD8\xE6\xDDÀ\u0000\u0000G@(\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000\x87\x80\u0002]q\u0001(U#terminal.020581.top.collectd.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U,terminal.022093.top.{cdu_web_server.}.topmemGA\xD8\xE6\xDD\xC2\xC0\u0000\u0000G?\xF0\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003e.\u0000\u0000\u0000[\x80\u0002]q\u0001U<terminal.023309.sensors-w83627uhg-isa-0290.temperature-temp2GA\xD8\xE6\xDD\xC3@\u0000\u0000G@G@\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000X\x80\u0002]q\u0001U9terminal.025496.top._usr_lib_chromium_chromium-bin.topmemGA\xD8\xE6ݴ\u0000\u0000\u0000G@C\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000l\x80\u0002]q\u0001(U\u001ATC.RDL027260.bcr.fwversionGA\xD8\xE6ݥ@\u0000\u0000GA|\xF2\xA1p\u0000\u0000\u0000\x86\x86q\u0002U\u001ATC.RDL027260.bcr.fwversionGA\xD8\xE6ݴ\x80\u0000\u0000GA|\xF2\xA1p\u0000\u0000\u0000\x86\x86q\u0003e.\u0000\u0000\u0000\x97\x80\u0002]q\u0001(U-terminal.025523.top._usr_sbin_rsyslogd.topmemGA\xD8\xE6ݴ\u0000\u0000\u0000G@\u0014\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U2terminal.024269.top._opt_app_LT_application.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@C\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003e.\u0000\u0000\u0000I\x80\u0002]q\u0001Uterminal.019950.df-data.percent_bytes-usedGA\xD8\xE6\xDD\xC3@\u0000\u0000G?\xE4.J\xFF\xFF\xFF\xFE\x86\x86q\u0002a.\u0000\u0000\u0000W\x80\u0002]q\u0001U8terminal.029228.sensors-w83627uhg-isa-0290.fanspeed-fan1GA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\x9F`\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000F\x80\u0002]q\u0001U'terminal.029600.memory.percent-bufferedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0004:\xAB\xF8\xB4\xD8\f\x86\x86q\u0002a.\u0000\u0000\u0000D\x80\u0002]q\u0001U%terminal.028841.top._usr_bin_X.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000\x8C\x80\u0002]q\u0001(U\"terminal.028958.top.COMMAND.topcpuGA\xD8\xE6\xDD\xC3@\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U2terminal.028958.top._opt_app_LT_application.topmemGA\xD8\xE6\xDD\xC3@\u0000\u0000G@P\x80\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003e.\u0000\u0000\u0000X\x80\u0002]q\u0001U9terminal.022285.top._usr_lib_chromium_chromium-bin.topcpuGA\xD8\xE6ݴ\u0000\u0000\u0000G@3\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000Ā\u0002]q\u0001(U#terminal.027524.top.collectd.topmemGA\xD8\xE6ݴ\u0000\u0000\u0000G@(\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U&terminal.027524.top.._pwedwnmgr.topcpuGA\xD8\xE6ݴ\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003U+terminal.027524.interface-eth0.if_octets.rxGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000GA9\u0018\xD6\u0000\u0000\u0000\u0000\x86\x86q\u0004e.\u0000\u0000\u0000\xE6\x80\u0002]q\u0001(U8terminal.029600.sensors-w83627uhg-isa-0290.fanspeed-fan2GA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\xA3b\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U&terminal.028949.top.._pweuplmgr.topmemGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003U8terminal.023398.sensors-w83627uhg-isa-0290.fanspeed-fan2GA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@\xA3\xF8\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0004e.\u0000\u0000\u0000G\x80\u0002]q\u0001U(terminal.023119.memory.percent-slab_reclGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G?\xE7\x8B\xD1\xDBHg\xA6\x86\x86q\u0002a.\u0000\u0000\u0000D\x80\u0002]q\u0001U%terminal.021456.memory.percent-cachedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@E\xC2\xDE\u0015\xB9J\u0004\x86\x86q\u0002a.\u0000\u0000\u0000ɀ\u0002]q\u0001(U%terminal.028022.top._usr_bin_X.topcpuGA\xD8\xE6\xDD\xC3@\u0000\u0000G@\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002U\"terminal.028022.top.COMMAND.topmemGA\xD8\xE6\xDD\xC3@\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003U2terminal.028022.top._opt_app_LT_application.topcpuGA\xD8\xE6\xDD\xC3@\u0000\u0000G@\u0018\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0004e.\u0000\u0000\u0000L\x80\u0002]q\u0001U-terminal.026482.top._usr_sbin_rsyslogd.topcpuGA\xD8\xE6ݴ\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000I\x80\u0002]q\u0001Uterminal.020504.df-data.percent_bytes-usedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G?\xC9\f\xA3\xFF\xFF\xFF\xF4\x86\x86q\u0002a.\u0000\u0000\u0000X\x80\u0002]q\u0001U9terminal.025725.sensors-radeon-pci-0008.temperature-temp1GA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@N\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000A\x80\u0002]q\u0001U\"terminal.029228.top.COMMAND.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000Q\x80\u0002]q\u0001U2terminal.019950.top._opt_app_LT_application.topcpuGA\xD8\xE6\xDD\xC3@\u0000\u0000G@\u0010\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000\xE0\x80\u0002]q\u0001(U5terminal.025496.df-versions-active.percent_bytes-usedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@A\xF0E\x80\u0000\u0000\u0002\x86\x86q\u0002U\"terminal.025496.top.COMMAND.topcpuGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0003U9terminal.025496.top._usr_lib_chromium_chromium-bin.topmemGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G@C\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0004e.\u0000\u0000\u0000B\x80\u0002]q\u0001U#terminal.027866.top.._pweupl.topcpuGA\xD8\xE6ݴ\u0000\u0000\u0000G\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000L\x80\u0002]q\u0001U-terminal.028487.top._usr_sbin_rsyslogd.topmemGA\xD8\xE6ݴ\u0000\u0000\u0000G@\u0014\u0000\u0000\u0000\u0000\u0000\u0000\x86\x86q\u0002a.\u0000\u0000\u0000I\x80\u0002]q\u0001Uterminal.020580.df-data.percent_bytes-usedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G?\xDD\f\xA5\xA0\u0000\u0000\u0005\x86\x86q\u0002a.\u0000\u0000\u0000I\x80\u0002]q\u0001Uterminal.029600.df-data.percent_bytes-usedGA\xD8\xE6\xDD\xC3\u0000\u0000\u0000G?\xE3", :expected_charset=>"UTF-8"}

Your message field does not contain \u0018, it contains a UTF-16 CANCEL character. \u0018 is just the representation of that when it is printed in the log.

Given how little the graphite codec does, you might be better off using a line or plain codec so that you can set the encoding correctly using the charset option, and then parse the line yourself.

1 Like

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