# Network bandwidth from firewall logs in timelion

**URL:** <https://discuss.elastic.co/t/network-bandwidth-from-firewall-logs-in-timelion/274637>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [June 1, 2021, 1:32pm UTC](https://discuss.elastic.co/t/network-bandwidth-from-firewall-logs-in-timelion/274637 "2021-06-01T13:32:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfs1](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@jfs1](https://discuss.elastic.co/u/jfs1)\
**Post date:** [June 1, 2021, 1:32pm UTC](https://discuss.elastic.co/t/network-bandwidth-from-firewall-logs-in-timelion/274637/1 "2021-06-01T13:32:18Z")

</div>

I configured timelion to graph network usage (in Mbps) for all HTTPS traffic. The timelion expression is :

```auto
.es(q="observer.ingress.interface.name:Untrust-4 and destination.port:443",index="fw-*",timefield="@timestamp",metric="sum:destination.bytes").divide(125000).scale_interval(1s).label("Mbps IN"),
.es(q="observer.ingress.interface.name:Untrust-4 and destination.port:443",index="fw-*",timefield="@timestamp",metric="sum:source.bytes").divide(125000).scale_interval(1s).label("Mbps OUT")

```

The "divide" is taking the bytes from the firewall, multiply by 8 (to get bits) and divides by 1000000 (to get the Megabits).

The graph looks nice, but the scale is completely off. Like : 80Gbps of bandwidth used where the size of the physical links is way less than that.

What can go wrong ?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [June 1, 2021, 2:57pm UTC](https://discuss.elastic.co/t/network-bandwidth-from-firewall-logs-in-timelion/274637/2 "2021-06-01T14:57:02Z")

</div>

HI @jfs1

Most the time Bytes In / Bytes Out are recorded as monotonically increasing counters so you would have to do a derivative to get a rate. Perhaps this is the issue. I am not a timelion expert so I can't help you there.

However both Lens and TSVB have a Counter Rate aggregations / derivatives built in to perform this operations perhaps take a look at them. Lens is a bit easier but TSVB provides more flexibility.

Here is an example in TSVB complete with scaling of the Bytes etc.

 ![Screen Shot 2021-06-01 at 7.54.59 AM](https://us1.discourse-cdn.com/elastic/original/3X/8/d/8dfab964ce45795814b1a4854634126e0af5018b.png)

 ![Screen Shot 2021-06-01 at 7.55.08 AM](https://us1.discourse-cdn.com/elastic/original/3X/f/b/fbd0398a22795987aa905432d2959b46d9a4afeb.png)

You can also apply filters in the Filter section with KQL syntax

Minor Oops. The Label I put Bytes In but I used the metric `bytes.out` I am sure you will be more careful 😉

---

<div class="post-metadata">

**Author:** ![jfs1](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@jfs1](https://discuss.elastic.co/u/jfs1)\
**Post date:** [June 7, 2021, 12:54pm UTC](https://discuss.elastic.co/t/network-bandwidth-from-firewall-logs-in-timelion/274637/3 "2021-06-07T12:54:52Z")

</div>

Hi @stephenb ,

In this case, my stats are coming from firewall logs, so the bytes in/out are for each TCP session and not monotonically increasing.

I keep on investigating.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2021, 12:55pm UTC](https://discuss.elastic.co/t/network-bandwidth-from-firewall-logs-in-timelion/274637/4 "2021-07-05T12:55:17Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
