Good morning, I have issues with GELF output, and ...
# fluent-bit
d
Good morning, I have issues with GELF output, and for some messages I get that short_message is missing, or
Unrecognized character escape 'C' (code 67)
and I have no idea .. which messages, because Graylog dropping them. So I need a way to get the exact output, which the Graylog gets. I tried TCPdump, but because the host gets so many messages, that I can't see, which one is the problematic one.
Question is, which one is the best, to debug GELF messages.
a
Sadly, but I think they will direct you to raise an issue in GitHub just like they advised me in my topic above (link here). So quick clone of the suggestion of @Eric D. Schabell : Issues can be raised here: https://github.com/fluent/fluent-bit/issues (green New Issue button at the top). Good luck!
🎯 1
fluent bit 1
🙌 1
d
Hi found a way .. netcat:
Copy code
#!/bin/bash
while [ true ];
do
    nc -lp 12201 -w 0
    echo ------------------- 
done
and then configure a 2nd GELF output with 127.0.0.1 address and start the script and restart fluent-bit
and here .. I guess, found the issue: it seems, fluent-bit is cutting messages
and it looks like .. then fluent-bit is cutting messages
I have one .. which ends just with ...
Copy code
ugins/iCheck/icheck.min.js\\\\\\\"></script><script src=\\\\\\\"<https://use.fontawesome.com/581d5d54d2.js>\\\\\\\"></script><script src=\\\\\\\"/c3650cdf-216a-4ba2-80b0-9d6c540b105e58d2670b-ea0f-484e-b88c-0e2c1499ec9bd71e4b42-8570-44e3-89b6-845326fa43b6\\\\\\\" type=\\\\\\\"text/javascript\\\\\\\"></script><script>!function(e){function r(r){for(var n,p,l=r[0],a=r[1],f=r[2],c=0,s=[];c<l.length;c++)p=l[c],Object.prototype.hasOwnProperty.call(o,p)&&o[p]&&s.push(o[p][0]),o[p]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(i&&i(r);s.length;)s.shift()();return u.push.apply(u,f||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=p(p.s=t[0]))}return e}var n={},o={1:0},u=[];function p(r){if(n[r])ret
and then I see the next message
I can see the same message in Victoria-Logs
p
you can get the contents of the records from Fluent Bit with a stdout output
with regards to "cutting a message" you need to really provide your config and sample input
d
Sure ..
Copy code
service:
  # -----------------------------------------------------------
  # Grundkonfiguration
  # -----------------------------------------------------------
  daemon:        Off
  log_level:     error
  http_server:   On
  http_listen:   0.0.0.0
  http_port:     2020

  # -----------------------------------------------------------
  # Konfigurationsquellen
  # -----------------------------------------------------------
  parsers_file:  parsers.conf
  plugins_file:  plugins.conf
  hot_reload:    On

  # -----------------------------------------------------------
  # Speicher und Stabilität
  # -----------------------------------------------------------
  storage.path:               /var/log/flb-storage/
  storage.sync:               normal
  storage.checksum:           off
  storage.max_chunks_up:      512
  storage.backlog.mem_limit:  256M

  # -----------------------------------------------------------
  # Performance-Tuning
  # -----------------------------------------------------------
  flush:          1.0
  grace:          5
  coro_stack_size: 24576
  workers:        4
...
#######################################################################
# INPUTS
#######################################################################
pipeline:
  inputs:
    - name: syslog
      listen: 127.0.0.1
      port: 5140
      parser: syslog_rfc3339
      tag: syslog
      mode: udp
      buffer_chunk_size: 32000
      buffer_max_size: 64000
      receive_buffer_size: 512000

    - name: forward
      port: 24224
      tag: container
      listen: 127.0.0.1

...

    - name: gelf
      match: ns.*
      host: <http://fc-r01-graylog.inatec.com|fc-r01-graylog.inatec.com>
      port: 12201
      mode: tcp
      tls: false
      Gelf_Short_Message_Key: log
      Gelf_Timestamp_Key: timestamp
      Gelf_Host_Key: host
      Gelf_Level_Key: level
I've added for debug:
Copy code
- name: gelf
      match: ns.*
      host: 127.0.0.1
      port: 12201
      mode: tcp
      tls: false
      Gelf_Short_Message_Key: log
      Gelf_Timestamp_Key: timestamp
      Gelf_Host_Key: host
      Gelf_Level_Key: level
and had my netcat listen on localhost:12201 and try to find the messages which have broken JSON or missing fields.
p
broken how, what does the input look like?
is your syslog input chunking things up?
d
Input is from Nomad (Docker -> forward via 24224) , not Syslog.
p
Right, and again what's the actual input?
If you use a dummy input to generate known data does that get split or not?
Is the input split already when it arrives basically?
You can use a stdout filter to show that
if it's split then you'll need to recombine with a multiline parser
d
hmm, you mean splitted via TCP in two half JSON parts?
p
Or split at the source
d
but then I would also see issues on Victoria-Logs ... or VL is discarding messages and I don't see any logs
hmm
is there a limit on GELF output?
nxlog has an option to set a higher limit for GELF output
p
My gist is to simplify things: you have a pipeline with various components and stacks involved, trying to debug where or what is going wrong by looking at the end is very hard plus almost impossible for anyone remote to help with. You can use stdout to see what the output is at in each stage of the pipeline to confirm your assumptions and ideally identify where it is going wrong. You can easily add stdout without impacting the current setup, just as another filter or output to see.
🎯 1
d
ok, will do it 🙂
I guess, I can use instead stdout also file?
I need something, where I can find broken JSON out of the of lines
p
I mean if you know what to look for you can just use stdout with a grep processor:
Copy code
outputs:
  - name: stdout
    match: '*'
    processors:
      logs:
        - name: grep
          regex: XXX
https://docs.fluentbit.io/manual/data-pipeline/processors/filters
âž• 1
d
uhh, that is cool
p
you can either include or exclude via regex so pick something where it flags lines that are broken
d
right now, I'm using file and have
tail -f debug.log | jq
.. so if I have a broken json, jq will tell me
I have it running since 5min .. and no exceptions ... but right now; i don't see exceptions for this Ip address also on graylog host. So I guess, I need to wait