Parze log TSV ignore some line

26 views
Skip to first unread message

Vazel

unread,
Feb 8, 2021, 9:39:22 AM2/8/21
to Fluentd Google Group
Hi guys can you help me I'm trying to parse zeek logs that are in tsv format, but the problem is that it reads the first and end fields of the log (the one with the #), making me crash the insertion in the database in the match section
<source>
@type tail
format tsv
keys ts,uid,id.orig_h,id.orig_p,id.resp_h,id.resp_p,proto,service,duration,ori, etc....
path /usr/jail/jail_suri_zeek/usr/local/etc/zeek/spool/logger/conn.log
pos_file /var/lib/google-fluentd/pos/zeek-conn.pos
read_from_head true
null_value_pattern ^(-|null|NULL)$
tag zeek_conn
</source>

log
#separator \x09
#set_separator  ,
#empty_field    (empty)
#unset_field    -
#path   conn
#open   2021-02-08-12-25-10
#fields ts      uid     id.orig_h       id.orig_p       id.resp_h       id.resp_p       proto   service duration        orig_bytes      resp_bytes      conn_state      local_orig      local_resp   missed_bytes    history orig_pkts       orig_ip_bytes   resp_pkts       resp_ip_bytes   tunnel_parents  vlan    inner_vlan      orig_l2_addr    resp_l2_addr
#types  time    string  addr    port    addr    port    enum    string  interval        count   count   string  bool    bool    count   string  count   count   count   count   set[string] int      int     string  string
1612783509.989868       C3gBS52fs6cEp1uwK2      192.168.1.61    62679   169.254.169.254 80      tcp     -       -       -       -       S0      T       F       0       S       1       60  00       -       -       -       de:69:86:bc:c9:9d       c6:74:03:f1:12:7e
1612783509.903626       Ch2kELdUkzNCvQ7Oi       192.168.1.61    45664   169.254.169.254 80      tcp     -       -       -       -       S0      T       F       0       S       1       60  00       -       -       -       de:69:86:bc:c9:9d       c6:74:03:f1:12:7e
1612783509.903626       Cf2a6KtNYc3Z8uYy        192.168.1.61    42117   169.254.169.254 80      tcp     -       -       -       -       S0      T       F       0       S       1       60  00       -       -       -       de:69:86:bc:c9:9d       c6:74:03:f1:12:7e
1612783509.903626       C0znHV1boHcPv0Gozh      192.168.1.61    29171   169.254.169.254 80      tcp     -       -       -       -       S0      T       F       0       S       1       60  00       -       -       -       de:69:86:bc
#close

Kentaro Hayashi

unread,
Feb 8, 2021, 8:49:32 PM2/8/21
to Fluentd Google Group
Hi,

If the comment line is problematic, how about filtering the record?

<filter zeek_conn>
  @type grep
  <exclude>
     key ts
     pattern /^#.*/
  </exclude>
</filter>

Adding the above filter in your configuration may solve.

Regards,


2021年2月8日月曜日 23:39:22 UTC+9 Vazel:

Vazel

unread,
Feb 9, 2021, 5:03:41 AM2/9/21
to Fluentd Google Group

Thanks kentaro works
Reply all
Reply to author
Forward
0 new messages