tableau / Logshark

A Tableau log file analysis utility
MIT License
112 stars 50 forks source link

Logshark 2.0 workbooks use <hostname> in datasource connection, instead of <localhost> #27

Closed til-jmac closed 6 years ago

til-jmac commented 7 years ago

As the title describes, I've just upgraded to Logshark 2.0 and noticed different behaviour. When opening a workbook generated by any of the default plugins, the data source connection to the Postgres DB now points at my computer's hostname rather than localhost. This is despite my logshark postgresconnection config looking like this:

`

<User username="logshark" password="logshark" />

`

Now because the connection is using my machines hostname, it's trying to resolve the hostname and giving me a pg_hba.conf error.

image

When I change the server name in the data source connection back to localhost, the connection works as expected.

jmangue commented 7 years ago

Hey @til-jmac , sorry to hear you're running into difficulties. This is indeed a behavior that was recently added; the problem was that Tableau Server rejects publishing of any workbook with a data source connection of "localhost", which was confusing to many users... so we updated Logshark to make a good-faith effort to resolve localhost to a DNS entry or IP to reduce the chances of this happening.

I'm going to mark this as a documentation bug to add this to the user guide for other users with a similar setup to yours. In the meantime, to get unblocked, you will need to add an entry to your pg_hba.conf file to allow connections from your local IPv6-style address. This file is located in your Postgres data directory (by default, C:\Program Files\PostgreSQL\<VERSION>\data\pg_hba.conf). A sample entry you can add to allow the user "logshark" to connect to your db from any localhost IPv6 address is:

host all logshark ::1/128 md5

Once you save the file you should be able to connect with the workbooks again. No database restart is required.

Hope that helps!

til-jmac commented 7 years ago

Thanks, I had already updated my pg_hba.conf but since I don’t regularly publish the workbooks to Tableau server, this looked like a bug to me. That makes sense now and agree it’s just the documentation that needs an update. Thanks for the quick reply!

EveryoneIsAnotherYou commented 6 years ago

Hello @jmangue,

I'm having a similar issue - I cannot successfully run Logshark when the Logshark.config file contains my FQDN machine name instead of 'localhost' for the Postgres connection info. Logshark returns the following error:

C:\Program Files\Logshark>logshark c:\logshark.zip Loading Logshark user configuration.. Failed to initialize Logshark request processor! Please check to make sure that the results database was configured correctly. (Failed to open connection to geaton-lap.tsi.lan:5433: Exception while reading from stream )

Alternatively, I also receive this error instead 50% of the time:

Please check to make sure that the results database was configured correctly. (Failed to open connection to geaton-lap.tsi.lan:5433: 28000: no pg_hba.conf entry for host "fe80::f8b4:b811:ef66:a71d%10", user "logshark", database "postgres", SSL off)

I've added this line to my hba.conf file but it didn't resolve the error:

host all logshark ::1/128 md5.

Any ideas would could be wrong?

EveryoneIsAnotherYou commented 6 years ago

Actually, @jmangue, I got Logshark partially working by adding the following line to my hba.conf file:

host all logshark fe80::f8b4:b811:ef66:a71d/10 md5

I needed to explicitly specify my IPv6 address for some strange reason, even though I had already attempted to allow all IP addresses:

host  all  all 0.0.0.0/0 md5
host  all  all ::1/128 md5
host all logshark ::1/128 md5
host    all             logshark       0.0.0.0/0       md5

However, publishing is still failing with this error (I'm also on v10.5, but had a similar issue with 10.4):

Failed to publish workbooks: Unable to initialize Tableau Server for publishing: Failed to authenticate user 'admin': Failed to retrieve successful response for POST request to 'http://geaton-lap.tsi.lan/api/2.2/auth/signin' after 3 attempts: The remote server returned an error: (401) Unauthorized.

Any idea what might be causing this? This is what the relevant section of my Logshark.config file looks like:

<TableauConnection protocol="http" publishingTimeoutSeconds="300">
    <Server address="geaton-lap.tsi.lan" port="80" site="Logshark" />
    <User username="admin" password="admin" />
  </TableauConnection>
EveryoneIsAnotherYou commented 6 years ago

I finally got this working; I had made a mistake and the Logshark site didn't exist like I thought it did. Instead, I published my workbooks to the default site and was successful.

  <TableauConnection protocol="http" publishingTimeoutSeconds="500">
    <Server address="geaton-lap.tsi.lan" port="80" site="Default" />
    <User username="admin" password="admin" />
  </TableauConnection>
jmangue commented 6 years ago

Hey @LivingAnExaminedLife, glad to hear you got it all working!!

jmangue commented 6 years ago

Resolving.