Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgauditlogtofile only works with lc_messages set to en_US #25

Closed
hubiongithub opened this issue Nov 3, 2022 · 7 comments
Closed

pgauditlogtofile only works with lc_messages set to en_US #25

hubiongithub opened this issue Nov 3, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@hubiongithub
Copy link

Hello

logtofile sets some strings like
static const char * pgAuditLogToFileDisconnPrefixes[] = {
"disconnection: session time:",
};

Is there a chance to generate the suitable strings from the postgresql sources instead of hardcoding each language?

Nice tool nevertheless

@fmbiete fmbiete self-assigned this Nov 12, 2022
@fmbiete fmbiete added the enhancement New feature or request label Nov 12, 2022
@fmbiete
Copy link
Owner

fmbiete commented Nov 12, 2022

Yes, this is missing, I'll try to add it when I have some time

fmbiete added a commit that referenced this issue Nov 14, 2022
@fmbiete
Copy link
Owner

fmbiete commented Nov 14, 2022

That commit should implement the support for NLS and allow to filter the messages in a better way.
If you can test and confirm if this solve the issue for you it would be awesome.

@hubiongithub
Copy link
Author

Hello Francisco
I can try to build it (we normally use packages delivered by apt/yum.postgresql.org).
What requirements (beside the obvious "make") do we need?

@fmbiete
Copy link
Owner

fmbiete commented Nov 14, 2022

Something like this would be enough

dnf install postgresql15-server postgresql15-devel gcc make openssl-devel

make clean
make install

@hubiongithub
Copy link
Author

hubiongithub commented Nov 14, 2022

Hello Francisco
I tried it on a ubuntu maschine (installed build-essential and postgresql-server-dev-all) now it searches for:

In file included from logtofile.c:15:
/usr/include/postgresql/15/server/libpq/libpq-be.h:34:10: fatal error: gssapi/gssapi.h: No such file or directory
34 | #include <gssapi/gssapi.h>

apt-file search gssapi/gssapi.h delivers:
heimdal-multidev: /usr/include/heimdal/gssapi/gssapi.h
krb5-multidev: /usr/include/mit-krb5/gssapi/gssapi.h
libgssglue-dev: /usr/include/gssglue/gssapi/gssapi.h
libkrb5-dev: /usr/include/gssapi/gssapi.h

which of these is the correct one?

tested on Ubuntu 20.04 and 22.04 (later has moved to openssl-3 I wanted to see if that makes any difference, does not)
ldd /usr/lib/postgresql/12/lib/pgauditlogtofile.so
linux-vdso.so.1 (0x00007fffcbd80000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3e3df69000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3e3e1a2000)
(12 was the installed version on this machine, but that make no difference, other machine has pg14)
no libs with gss in name, libpq-be.h does mention win32 in that ifdef block

@fmbiete
Copy link
Owner

fmbiete commented Nov 14, 2022

libkrb5-dev is the one you need

@hubiongithub
Copy link
Author

Hello Francisco

On Ubuntu it needed
apt install postgresql-server-dev- # which dependencies also install compiler ...
apt install libkrb5-dev zlib1g-dev

make USE_PGXS=1
I copied the created pgauditlogtofile.so to /usr/lib/postgresql//lib/pgauditlogtofile.so to test it with

  • lc_messages = 'en_US.UTF-8' # still works
  • lc_messages = 'de_DE.UTF-8' # now send the german messages to the correct logfile

At least for the german settings it works.

@fmbiete fmbiete closed this as completed Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants