How to modify and format numbers

Answered

Comments

1 comment

  • Official comment
    Avatar
    Kevin Keech

    Hi Steve,

    The following query should work and should get you the result your looking for.

    | sum(obytes) as outboundbytes by \_timeslice, application  
    | outboundbytes/1024/1024 as outboundMB  
    | format("%.2f MB",outboundMB) as outboundMB  
    | fields - outboundbytes 
    

    We use the "format" operator to drop the extra decimals from the MB value, created from the conversion of bytes to MB, and also use this to add some text (MB) to the returned value. More help on the Format operator can be found via the following link.

    https://help.sumologic.com/Search/Search-Query-Language/Search-Operators/format

    This query should result in a formatted field value like "11.05 MB"

     

Please sign in to leave a comment.