Docs
DocumentationQuery ReferenceAPI Reference
Open Console→→
DocumentationQuery ReferenceAPI Reference

Introduction

Query reference overview

APL

IntroductionSample queriesAll features
Functions
Scalar functions
Array functions
Overview
array_concat
array_extract
array_iff
array_index_of
array_length
array_reverse
array_rotate_left
array_rotate_right
array_select_dict
array_shift_left
array_shift_right
array_slice
array_sort_asc
array_sort_desc
array_split
array_sum
bag_has_key
bag_keys
bag_pack
bag_zip
isarray
len
pack_array
pack_dictionary
strcat_array
Conditional functions
Overview
case
iff
Conversion functions
Overview
dynamic_to_json
ensure_field
isbool
toarray
tobool
todatetime
todouble, toreal
todynamic
tohex
toint, tolong
tostring
totimespan
Datetime functions
Overview
ago
datetime_add
datetime_diff
datetime_part
dayofmonth
dayofweek
dayofyear
endofday
endofmonth
endofweek
endofyear
format_datetime
getmonth
getyear
hourofday
monthofyear
now
startofday
startofmonth
startofweek
startofyear
unixtime_microseconds_todatetime
unixtime_milliseconds_todatetime
unixtime_nanoseconds_todatetime
unixtime_seconds_todatetime
week_of_year
GenAI functions
Overview
genai_concat_contents
genai_conversation_turns
genai_cost
genai_estimate_tokens
genai_extract_assistant_response
genai_extract_function_results
genai_extract_system_prompt
genai_extract_tool_calls
genai_extract_user_prompt
genai_get_content_by_index
genai_get_content_by_role
genai_get_pricing
genai_get_role
genai_has_tool_calls
genai_input_cost
genai_is_truncated
genai_message_roles
genai_output_cost
Hash functions
Overview
hash
hash_md5
hash_sha1
hash_sha256
hash_sha512
IP functions
Overview
format_ipv4
format_ipv4_mask
geo_info_from_ip_address
has_any_ipv4
has_any_ipv4_prefix
has_ipv4
has_ipv4_prefix
ipv4_compare
ipv4_is_in_range
ipv4_is_in_any_range
ipv4_is_match
ipv4_is_private
ipv4_netmask_suffix
ipv6_compare
ipv6_is_in_any_range
ipv6_is_in_range
ipv6_is_match
parse_ipv4
parse_ipv4_mask
Mathematical functions
Overview
abs
acos
asin
atan
atan2
cos
cot
degrees
exp
exp2
exp10
gamma
isfinite
isinf
isint
isnan
log
log2
log10
loggamma
max_of
min_of
not
pi
pow
radians
rand
range
round
set_difference
set_has_element
set_intersect
set_union
sign
sin
sqrt
tan
Metadata functions
Overview
column_ifexists
cursor_current
ingestion_time
Pair functions
Overview
find_pair
pair
parse_pair
Rounding functions
Overview
bin
bin_auto
ceiling
floor
String functions
Overview
base64_decode_toarray
base64_decode_tostring
base64_encode_fromarray
base64_encode_tostring
coalesce
countof
countof_regex
extract
extract_all
format_bytes
format_url
gettype
indexof
indexof_regex
isascii
isempty
isnotempty
isnotnull
isnull
parse_bytes
parse_csv
parse_json
parse_path
parse_url
parse_urlquery
quote
regex_quote
replace
replace_regex
replace_string
reverse
split
strcat
strcat_delim
strcmp
string_size
strlen
strrep
strip_ansi_escapes
substring
tolower
totitle
toupper
translate
trim
trim_end
trim_end_regex
trim_regex
trim_space
trim_start
trim_start_regex
unicode_codepoints_from_string
unicode_codepoints_to_string
url_decode
url_encode
SQL functions
Overview
parse_sql
format_sql
Time series functions
Overview
series_abs
series_acos
series_add
series_asin
series_atan
series_ceiling
series_cos
series_cosine_similarity
series_divide
series_dot_product
series_equals
series_exp
series_fft
series_fill_backward
series_fill_const
series_fill_forward
series_fill_linear
series_fir
series_floor
series_greater
series_greater_equals
series_ifft
series_iir
series_less
series_less_equals
series_log
series_magnitude
series_max
series_min
series_multiply
series_not_equals
series_pearson_correlation
series_pow
series_sign
series_sin
series_stats
series_stats_dynamic
series_subtract
series_sum
series_tan
Type functions
Overview
isimei
ismap
isreal
iscc
isstring
isutf8
Aggregation functions
Overview
arg_min
arg_max
avg
avgif
avgw
count
countif
countw
dcount
dcountif
histogram
histogramif
histogramw
make_list
make_list_if
make_set
make_set_if
max
maxif
min
minif
percentile
percentileif
percentilew
percentiles_array
percentiles_arrayif
percentilesw_array
phrases
presence
rate
spotlight
stdev
stdevif
stdevw
sum
sumif
sumw
take_any
take_anyif
topk
topkif
topkw
variance
varianceif
variancew
Operators
Tabular operators
Overview
count
datatable
distinct
extend
extend-valid
externaldata
getschema
join
limit
lookup
make-series
mv-expand
order
parse
parse-kv
parse-where
print
project
project-away
project-keep
project-rename
project-reorder
redact
sample
search
sort
summarize
take
top
union
where
Scalar operators
Set membership operators
Overview
in
!in
in~
!in~
Logical
Numerical
String
Reference
Entity names
Map fields
Null values
Scalar data types
Declare query_parameters
Let statement
Set statement
Special field attributes
Migrate
Splunk SPL
SQL
Sumo Logic

MPL

Language featuresHistograms and summariesSample queriesMigrate
APL/Functions

hash_sha512

This page explains how to use the hash_sha512 function in APL.

Introduction

The hash_sha512 function returns the SHA-512 hash of a scalar value as a 128-character hexadecimal string. Use it when your security policy or compliance requirements demand the strongest standard hash available, or when you need a longer digest than SHA-256 provides.

SHA-512 produces a 512-bit digest, making it the most collision-resistant of the SHA hash functions available in APL. It's well suited for high-security fingerprinting, long-term integrity verification, and compliance use cases. For most everyday hashing tasks, hash_sha256 is sufficient.

Usage

Syntax

APL
hash_sha512(source)

Parameters

NameTypeRequiredDescription
sourcescalarYesThe value to hash. APL converts it to a string before hashing.

Returns

The SHA-512 hash of source as a 128-character lowercase hexadecimal string.

Use case examples

Anonymize user IDs with a maximum-strength hash before publishing compliance-sensitive usage summaries.

Query

APLRun in Playground
['sample-http-logs']
| extend hashed_id = hash_sha512(id)
| summarize request_count = count() by hashed_id
| top 5 by request_count

Output

hashed_idrequest_count
0878a61b503dd5a9fe9ea3545d6d3bd41c3b50a47f3594cb8bbab3e47558d68fc8fcc409cd0831e91afc4e609ef9da84e0696c50354ad86b25f2609efef6a834128
95c6eacdd41170b129c3c287cfe088d4fafea34e371422b94eb78b9653a89d4132af33ef39dd6b3d80e18c33b21ae167ec9e9c2d820860689c647ffb725498c497
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e85

The query uses SHA-512 to produce maximum-strength anonymized user keys before aggregating request counts.

Fingerprint span IDs with SHA-512 for use in high-security audit trails.

Query

APLRun in Playground
['otel-demo-traces']
| extend hashed_span = hash_sha512(span_id)
| project _time, ['service.name'], hashed_span, duration
| take 10

Output

_timeservice.namehashed_spanduration
2024-01-15 10:23:01frontend0878a61b503dd5a9fe9ea3545d6d3bd41c3b50a47f3594cb8bbab3e47558d68f...320ms
2024-01-15 10:23:02checkout95c6eacdd41170b129c3c287cfe088d4fafea34e371422b94eb78b9653a89d41...875ms
2024-01-15 10:23:03cartcf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce...140ms

The query outputs SHA-512 fingerprints of span IDs for external audit systems that require maximum-length digests.

List of related functions

  • hash_sha256: Returns a 64-character SHA-256 hex digest. Use hash_sha256 when SHA-256 strength is sufficient and you prefer shorter digests.
  • hash_sha1: Returns a 40-character SHA-1 hex digest. SHA-1 is deprecated for security use; prefer hash_sha512.
  • hash_md5: Returns a 32-character MD5 hex digest. Not cryptographically safe; use hash_sha512 for security contexts.
  • hash: Returns a signed 64-bit integer hash. Use hash when you need a compact numeric key rather than a hex string.

Other query languages

Was this page helpful?
Suggest edits on GitHub
Previoushash_sha256NextIP functions
On this page
IntroductionUsageSyntaxParametersReturnsUse case examplesList of related functionsOther query languages