Hi
I need to convert these 2 counters from KB to MB
TotalSpaceKB=486757372
FreeSpaceKB=435455092
Do I have to divide this by 1024000?
thanks
yes to convert KB to MB divide by 1024-
...| eval TotalSpaceMB=TotalSpaceKB/1024
and similarly,
...| eval FreeSpaceMB=FreeSpaceKB/1024
yes to convert KB to MB divide by 1024-
...| eval TotalSpaceMB=TotalSpaceKB/1024
and similarly,
...| eval FreeSpaceMB=FreeSpaceKB/1024
Ok thanks
And if i want to convert the MB in GB i divise by 1000?
I have done this, is it ok??
index="perfmon" sourcetype=WinHostMon
| eval TotalSpace = TotalSpaceKB/1024
| eval FreeSpace = FreeSpaceKB/1024
| eventstats first(TotalSpace) as TotalSpace,first(FreeSpace) as FreeSpace
| eval FreeSpace = round(FreeSpace/1000,1)
| eval TotalSpace = round(TotalSpace/1000,1)
| eval FreePerc = round((FreeSpace/TotalSpace)*100,1)
| eval DiskSpace = TotalSpace." GB". " (Total) ". FreeSpace." GB". " (Free) ". FreePerc." %". " (Free %) "
| table host DiskSpace
to convert MB to GB , divide by 1024
and I don't think you will require to use eventstats
command
@jip31, you can keep this formula handy for future calculations:
1Terabytes = 1024Gigabytes
1Gigabytes = 1024Megabytes
1Megabytes = 1024Kilobytes
1Kilobytes = 1024Bytes
1Byte = 8Bits
You go downwards, you multiply by the number on the right side.
You go upwards, you divide by the number on the right side.
eg: 1
10 GB = 10*1024 MB
10 MB = 10/1024 GB
makes sense? Just keep in mind that people round it off to 1000 but in reality the number is 1024