Skip to content

Instantly share code, notes, and snippets.

@LukeMurphey
Created February 22, 2015 00:12
Show Gist options
  • Select an option

  • Save LukeMurphey/145b0903cd44498a9c75 to your computer and use it in GitHub Desktop.

Select an option

Save LukeMurphey/145b0903cd44498a9c75 to your computer and use it in GitHub Desktop.
Splunk readable duration macro Tags: #splunk
# readable_duration
# -----------------------------
# makes a human readable description of a duration
#
[readable_duration(2)]
args = sourceField,destField
definition = eval $destField$ = case( $sourceField$ > (2*86400), round(($sourceField$) / (86400)) . " days", $sourceField$ > (2*3600), round(($sourceField$) / (3600)) . " hours", $sourceField$ > (2*60), round(($sourceField$) / (60)) . " minutes", $sourceField$ > 0, $sourceField$ . " seconds" )
iseval = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment