Log
less than a minute
The Log converter calculates the natural logarithm (base e) of a value.
Syntax: Log(value)
- value: a numeric field to calculate the logarithm of
Input
{
"_type": "log",
"body": "Performance metrics calculated",
"resource": {...},
"attributes": {
"response_time": 2.718,
"error_rate": 10,
"throughput": 100
}
}
Statement
set(attributes["log_response"], Log(attributes["response_time"]))
set(attributes["log_error"], Log(attributes["error_rate"]))
set(attributes["log_throughput"], Log(attributes["throughput"]))
Output
{
"_type": "log",
"body": "Performance metrics calculated",
"resource": {...},
"attributes": {
"response_time": 2.718,
"error_rate": 10,
"throughput": 100,
"log_response": 1.0,
"log_error": 2.302585093,
"log_throughput": 4.605170186
}
}
The natural logarithm was calculated for each numeric value.