In my scenario I have to consolidated cpu utlization of all application in one query.But i cannot get proper output because my cpu for linux used vmstat for unix mpstat used so my output is mismatch .i will attach below.How to frame a query to get all server cpu .
Used Query:
index=XXX* OR index=FFF* OR index=EEE* OR index="GGG*" OR index="HH*"source=cpu | rex field=_raw "CPUPctUsed=(?\d*)" | eval CPUPctUsed2=100-pctIdle | fillnull value="NA" CPUPctUsed1 CPUPctUsed2 | eval CPUPctUsed=if(CPUPctUsed1="NA",CPUPctUsed2,CPUPctUsed1) | stats avg(CPUPctUsed) as "Avg" max(CPUPctUsed) as "Max" by host index | eval Avg=round(Avg,2) | where Max > 95 | table index host Avg Max
Thanks in advance
@karthi2809 ,
Your search does not show how the raw events are stored. However, you could try extracting the output from vmstat and mpstat on two different variables and pick up the non empty value , something like
index=XXX* OR index=FFF* OR index=EEE* OR index="GGG*" OR index="HH*"source=cpu|eval mpstat="extraction logic for mpstat" |eval vmstat="extraction logic for vmstat" |eval CPUPctUsed=coalesce(mpstat,vmstat)|stats avg(CPUPctUsed) as "Avg" max(CPUPctUsed) as "Max" by host index | eval Avg=round(Avg,2) | where Max > 95 | table index host Avg Max