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