Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iptables input plugins skips lines with empty target and "port" column #3229

Closed
lberruti opened this issue Sep 14, 2017 · 0 comments · Fixed by #3235
Closed

Iptables input plugins skips lines with empty target and "port" column #3229

lberruti opened this issue Sep 14, 2017 · 0 comments · Fixed by #3235
Labels
bug unexpected problem or unintended behavior regression something that used to work, but is now broken
Milestone

Comments

@lberruti
Copy link

Bug report

Iptables input plugin skips lines with empty target and "port" column

Relevant telegraf.conf:

[[inputs.iptables]]
   use_sudo = true
   table = "filter"
   chains = [ "accountfwd" ]

System info:

Telegraf 1.4.0-1 (telegraf_1.4.0-1_i386.deb), Debian 8.9

Steps to reproduce:

Having this rules:

# /sbin/iptables -nvL accountfwd -t filter -x
Chain accountfwd (1 references)
    pkts      bytes target     prot opt in     out     source               destination
32540119 10615137679            all  --  eth0   *       0.0.0.0/0            0.0.0.0/0            /* all_recv */
22882685 36949730032            all  --  *      eth0    0.0.0.0/0            0.0.0.0/0            /* all_sent */
     874   125870            tcp  --  eth0   *       0.0.0.0/0            66.177.8.49          multiport dports 80,443 /* serv_recv */
  352509 465079508            tcp  --  eth0   *       0.0.0.0/0            66.177.8.49          multiport dports 25,465,587 /* serv_recv */
  335261 22742238 RETURN     all  --  eth0   eth4    0.0.0.0/0            0.0.0.0/0            /* serv2_recv */
  379155 61104334 RETURN     all  --  eth4   eth0    0.0.0.0/0            0.0.0.0/0            /* serv2_sent */

then run:

telegraf --config telegraf.conf --input-filter iptables --test

Expected behavior:

All lines are parsed:

iptables,table=filter,chain=accountfwd,ruleid=all_recv pkts=32540119i,bytes=10615137679i 1505397710000000000
iptables,table=filter,chain=accountfwd,ruleid=all_sent pkts=22882685i,bytes=36949730032i 1505397710000000000
iptables,table=filter,chain=accountfwd,ruleid=serv_recv pkts=874i,bytes=125870i 1505397710000000000
iptables,chain=accountfwd,ruleid=serv_recv,table=filter pkts=352509i,bytes=465079508i 1505397710000000000
iptables,table=filter,chain=accountfwd,ruleid=serv2_recv pkts=335261i,bytes=22742238i 1505397710000000000
iptables,chain=accountfwd,ruleid=serv2_recv,table=filter pkts=379155i,bytes=61104334i 1505397710000000000

Actual behavior:

Lines with empty "target" and empty "port" column are skipped

iptables,table=filter,chain=accountfwd,ruleid=serv_recv pkts=874i,bytes=125870i 1505397710000000000
iptables,chain=accountfwd,ruleid=serv_recv,table=filter pkts=352509i,bytes=465079508i 1505397710000000000
iptables,table=filter,chain=accountfwd,ruleid=serv2_recv pkts=335261i,bytes=22742238i 1505397710000000000
iptables,chain=accountfwd,ruleid=serv2_recv,table=filter pkts=379155i,bytes=61104334i 1505397710000000000

Additional info:

Telegraf 1.3.5-1 works as expected

@danielnelson danielnelson added bug unexpected problem or unintended behavior regression something that used to work, but is now broken labels Sep 14, 2017
@danielnelson danielnelson added this to the 1.4.1 milestone Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior regression something that used to work, but is now broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants