Let's break down the search piece by piece:
Search fragment |
Description |
index=main sourcetype=log4j perfType="MEMORY" |
In this example, we are searching for our application logs, which have the log4j sourcetype. We also select to view only memory-related events. |
| eval mem_used_pc=round ((mem_used/mem_total)*1 00) |
Using the eval command, we calculate the percentage of memory used from the mem_used and mem_total fields in our application log. |
| eval mem_remain_pc=(100- mem_used_pc) |
Using the eval command again, we calculate the remaining percentage of memory from the used percentage of memory that we just calculated in the previous step. |
| timechart span=15m avg(mem_remain_pc) avg(mem_used_pc) |
Using the ... |