log10 function in APL to compute the common (base-10) logarithm of a positive numeric value. The function returns null for zero or negative inputs.
log10 is useful for order-of-magnitude analysis. Because each unit increase in log10(x) represents a tenfold increase in x, you can use it to compare values that span multiple orders of magnitude, build decibel-scale metrics, or bucket data by powers of ten. It’s also the basis for recovering values with exp10.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.Splunk SPL users
Splunk SPL users
In Splunk SPL,
log10() works identically: it returns the base-10 logarithm.ANSI SQL users
ANSI SQL users
In ANSI SQL,
LOG10() is a standard function in SQL Server and PostgreSQL with the same behavior as APL’s log10.Usage
Syntax
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
x | real | Yes | A positive real number (x > 0). |
Returns
- The base-10 logarithm of
x. nullifxis negative, zero, or cannot be converted to a real value.
Example
Uselog10 to express request durations on a base-10 log scale where each integer step represents an order of magnitude.
Query
| _time | id | req_duration_ms | log10_duration |
|---|---|---|---|
| 2024-11-14 10:00:00 | user-1 | 1.0 | 0.0000 |
| 2024-11-14 10:01:00 | user-2 | 100.0 | 2.0000 |
| 2024-11-14 10:02:00 | user-3 | 10000.0 | 4.0000 |
List of related functions
- exp10: Returns 10^x. Use it as the inverse of
log10to recover original values. - log: Returns the natural logarithm. Use it when you want the mathematically natural base rather than base-10.
- log2: Returns the base-2 logarithm. Use it for binary-scale analysis.
- pow: Raises a value to a power. Use it to compute powers of 10 directly as an alternative to
exp10. - round: Rounds a value. Use it after
log10to bucket values by integer order of magnitude.