Hello,
I am trying to write a search query for responding byte sizes that is a catch all. Currently I have:
index=index 8.8.8.8
| stats sum(resp_bytes) as resp_bytes
| eval resp_bytes=if(resp_bytes=0, "0B",if(resp_bytes<1000000,resp_bytes/1024 . "KB",if(resp_bytes>1000000,resp_bytes/1024/1024 . "MB", null)))
I have tested this and it works, but now i am trying to add in a "round" to the 2nd decimal spot. and Im not sure where it would go.
Try something like this
| eval resp_bytes=if(resp_bytes=0, "0B",if(resp_bytes<1000000,round(resp_bytes/1024,2) . "KB",if(resp_bytes>1000000,round(resp_bytes/1024/1024,2) . "MB", null)))
that worked thank you!
Try something like this
| eval resp_bytes=if(resp_bytes=0, "0B",if(resp_bytes<1000000,round(resp_bytes/1024,2) . "KB",if(resp_bytes>1000000,round(resp_bytes/1024/1024,2) . "MB", null)))