github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/log.mdx (about) 1 --- 2 page_title: log - Functions - Configuration Language 3 description: The log function returns the logarithm of a given number in a given base. 4 --- 5 6 # `log` Function 7 8 `log` returns the logarithm of a given number in a given base. 9 10 ```hcl 11 log(number, base) 12 ``` 13 14 ## Examples 15 16 ``` 17 > log(50, 10) 18 1.6989700043360185 19 > log(16, 2) 20 4 21 ``` 22 23 `log` and `ceil` can be used together to find the minimum number of binary 24 digits required to represent a given number of distinct values: 25 26 ``` 27 > ceil(log(15, 2)) 28 4 29 > ceil(log(16, 2)) 30 4 31 > ceil(log(17, 2)) 32 5 33 ```