Displaying subinterface statistics

To display statistics for a specific subinterface, enter the context for the subinterface and use the info from state command.

--{ candidate shared default }--[  ]--
# info from state interface ethernet-1/2 subinterface 1
    interface ethernet-1/2 {
        subinterface 1 {
            type routed
            admin-state enable
            ip-mtu 1500
            name ethernet-1/2.1
            ifindex 32770
            oper-state up
            last-change "a minute ago"
............linecard 1
............forwarding-complex 0
            ipv4 {
                admin-state enable
                allow-directed-broadcast false
                address 192.168.12.2/30 {
                    origin static
                    primary
                    status preferred
                }
                arp {
                    duplicate-address-detection true
                    timeout 14400
                    learn-unsolicited false
                    proxy-arp false
                    neighbor 192.168.12.1 {
                        link-layer-address 00:01:01:FF:00:01
                        origin dynamic
                        expiration-time "3 hours from now"
                        datapath-programming {
                            status success
                        }
                    }
                }
            }
            ipv6 {
                admin-state enable
                address 2001:1::192:168:12:2/126 {
                    origin static
                    primary
                    status preferred
                }
                address fe80::201:3ff:feff:2/64 {
                    origin link-layer
                    status preferred
                }
                neighbor-discovery {
                    duplicate-address-detection true
                    reachable-time 30
                    stale-time 14400
                    learn-unsolicited none
                    proxy-nd false
                    neighbor 2001:1::192:168:12:1 {
                        link-layer-address 00:01:01:FF:00:01
                        origin dynamic
                        is-router true
                        current-state stale
                        next-state-time "3 hours from now"
                        datapath-programming {
                            status success
                        }
                    }
                    neighbor fe80::201:1ff:feff:1 {
                        link-layer-address 00:01:01:FF:00:01
                        origin dynamic
                        is-router false
                        current-state stale
                        next-state-time "3 hours from now"
                        datapath-programming {
                            status success
                        }
                    }
                }
                router-advertisement {
                    router-role {
                        admin-state disable
                        current-hop-limit 64
                        managed-configuration-flag false
                        other-configuration-flag false
                        max-advertisement-interval 600
                        min-advertisement-interval 200
                        reachable-time 0
                        retransmit-time 0
                        router-lifetime 1800
                    }
                }
            }
            statistics {
                in-packets 45
                in-octets 5457
                in-discarded-packets 0
                in-forwarded-packets 0
                in-forwarded-octets 0
                in-matched-ra-packets 0
                out-forwarded-packets 0
                out-forwarded-octets 0
                out-originated-packets 43
                out-originated-octets 5357
                out-discarded-packets 0
                out-packets 43
                out-octets 5357
            }
            qos {
                input {
                    classifiers {
                        default-forwarding-class fc0
                        default-drop-probability low
                        dscp-policy default
                    }
                }
                output {
                    rewrite-rules {
                        dscp-policy default
                    }
                }
            }
        }
    }

Clearing subinterface statistics

You can clear the statistics counters for a specified subinterface.

# tools interface ethernet-1/2 subinterface 1 statistics clear
/interface[name=ethernet-1/2]/subinterface[index=1]:
    subinterface ethernet-1/2.1 statistics cleared