Question
What's the query to show user, IP and hostname?
I see that many datasets use the following to pull in a user:
select coalesce(nullifna(`user`), nullifna(`unauthuser`), ipstr(`srcip`)) as user_srcIf the user isn't available it shows the IP address. One of our clients wants to see both the user and IP address and where possible the internal hostname of the computer. We have enabled resolving hostnames in the log settings and I have verified that there are reverse zones where needed.
How can columns for user, ip address and hostname be shown? If any of the values are missing then the field can be blank. I tried:
select user, srcipHowever the user column is populated with "postgres" in all rows. And I don't know what value to query to pull in hostnames.
Any help is much appreciated!
