Olivier Tilmans <notifications@github.com> writes:

> I am running on a pretty-much bare host, where I have
> ```bash
> $ ss -V
> ss utility, iproute2-ss191125
> ```
>
> It turns out that when `ss_iterate.sh` runs `ss -ntp [...]`, `ss` does
> not output a new line at the very end. This causes `ss_iterate.sh` to
> collate the output with the `Time` field, resulting in the socket stat
> records being all empty as the runner fails to parse a timestamp.

Thank you for the report! I seems this was already fixed in iproute2 -
see commit:

9eee92a41ae6 ("ss: fix end-of-line printing in misc/ss.c")

This is dated Dec 4th, 2019, so I guess it's just after the version
you're running.

> I resolved this locally by tweaking `ss_iterate.sh` to output a new
> line between w/e output ss prints, and the timestamp, i.e., I changed
> the command string generation to:
>
> ```diff
> command_string=$(cat <<EOF
> for i in \$(seq $count); do
> ss -t -i -p -n state connected "dst $target $filter"
> + echo ''
> date '+Time: %s.%N';
> echo "---";
> sleep $interval || exit 1;
> done
> EOF
> )
> ```
>
> I don't have the time to test whether this would have any impact on
> hosts where `ss` prints a proper ouput, hence why this is not a PR. An
> alternate way could be to put the timestamp generation _before_ the
> invocation of `ss`. In both cases, the only issue would be if the
> output was parsed without regex--which did not seem to be the case
> from a quick glance.

Yeah, the Flent parser for Ss output is entirely regex-based, so it just
needs the timestamp at the beginning of a line. So I'm fine with adding
your change as well :)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.