tableau / Logshark

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

Postgres writer always defaults to 5423 no matter what Port value you specify in the DB connection string. #174

Open 0101binary0101 opened 1 year ago

0101binary0101 commented 1 year ago

When using the Postgres Writer to connect and write data to a different Postgres port the DB Connection String Port= is being over written by the default value of 5432, and therefore I was seeing 'Connection refused' messages.

e.g. User ID=postgres;Password=*****;Host=mypostgresbox;Port=5434;Database=logshark;Pooling=true;

I found a workaround to select a different port looking at the code of this bit, where it extracts the port from the db hostname.

https://github.com/tableau/Logshark/blob/c6a53bda09189f1aad10e7d02854c4bece3f30bd/LogShark/Writers/Sql/PostgresWriterFactory.cs#L95

I modified my connection string as follows: e.g. User ID=postgres;Password=*****;Host=mypostgresbox:5434;Port=5434;Database=logshark;Pooling=true;

After this the Postgres Writer was able to write data to my postgres instance listening on a different port.