pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
custom log. variable %h reports [unknown]
4+ messages / 4 participants
[nested] [flat]

* custom log. variable %h reports [unknown]
@ 2016-01-26 17:51  Artem Tomyuk <admin@leboutique.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Artem Tomyuk @ 2016-01-26 17:51 UTC (permalink / raw)
  To: pgsql-admin

Hi All!

og_connections = on

log_disconnections = on

log_line_prefix = '===========> %h %u %t %p %x: [%l-1]'

log_hostname = off

But in logs i see:

===========>  [*unknown*] 2016-01-26 17:07:46 UTC 1664 0: [1-1]LOG:
connection received: host=192.168.112.181 port=50321

===========> 192.168.112.181 postgres 2016-01-26 17:07:46 UTC 1664 0:
[2-1]LOG:  connection authorized: user=postgres database=lb_upr

===========>  [*unknown*] 2016-01-26 17:08:27 UTC 1665 0: [1-1]LOG:
connection received: host=192.168.112.181 port=50330

The off. docs says that variable %h stands for Remote hostname or IP.

Any ideas?


PS

DNS server configured to NOT answer on r-lookup queries, because he does
not have reverse zone for  my network.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [MASSMAIL]custom log. variable %h reports [unknown]
@ 2016-01-26 18:17  Gilberto Castillo <gilberto.castillo@etecsa.cu>
  parent: Artem Tomyuk <admin@leboutique.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Gilberto Castillo @ 2016-01-26 18:17 UTC (permalink / raw)
  To: Artem Tomyuk <admin@leboutique.com>; +Cc: pgsql-admin


> Hi All!
>
> og_connections = on
>
> log_disconnections = on
>
> log_line_prefix = '===========> %h %u %t %p %x: [%l-1]'
>
> log_hostname = off
>
> But in logs i see:
>
Hello Artem,

Use this: log_line_prefix = '%t [%p]: [%l-1] [%r]: user=%u ' --'%t [%p]:
[%l-1] user=%u,db=%d '




> ===========>  [*unknown*] 2016-01-26 17:07:46 UTC 1664 0: [1-1]LOG:
> connection received: host=192.168.112.181 port=50321
>
> ===========> 192.168.112.181 postgres 2016-01-26 17:07:46 UTC 1664 0:
> [2-1]LOG:  connection authorized: user=postgres database=lb_upr
>
> ===========>  [*unknown*] 2016-01-26 17:08:27 UTC 1665 0: [1-1]LOG:
> connection received: host=192.168.112.181 port=50330
>
> The off. docs says that variable %h stands for Remote hostname or IP.
>
> Any ideas?
>
>
> PS
>
> DNS server configured to NOT answer on r-lookup queries, because he does
> not have reverse zone for  my network.
>


Saludos,
Gilberto Castillo
ETECSA, La Habana, Cuba



-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: custom log. variable %h reports [unknown]
@ 2016-01-26 18:19  Jerry Sievers <gsievers19@comcast.net>
  parent: Artem Tomyuk <admin@leboutique.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Jerry Sievers @ 2016-01-26 18:19 UTC (permalink / raw)
  To: Artem Tomyuk <admin@leboutique.com>; +Cc: pgsql-admin

Artem Tomyuk <admin@leboutique.com> writes:

> Hi All!
>
> og_connections = on
>
> log_disconnections = on
>
> log_line_prefix = '===========> %h %u %t %p %x: [%l-1]'    
>
> log_hostname = off
>
> But in logs i see:
>
> ===========>  [unknown] 2016-01-26 17:07:46 UTC 1664 0: [1-1]LOG:  connection received: host=192.168.112.181 port=50321

Postmaster.

You should get something similar for AutoVac activity and/or anything
else not originated from a particular backend.

> ===========> 192.168.112.181 postgres 2016-01-26 17:07:46 UTC 1664 0: [2-1]LOG:  connection authorized: user=postgres database=lb_upr
>
> ===========>  [unknown] 2016-01-26 17:08:27 UTC 1665 0: [1-1]LOG:  connection received: host=192.168.112.181 port=50330
>
> The off. docs says that variable %h stands for Remote hostname or IP.
>
> Any ideas?
>
> PS 
>
> DNS server configured to NOT answer on r-lookup queries, because he does not have reverse zone for  my network.
>

-- 
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 312.241.7800


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: custom log. variable %h reports [unknown]
@ 2016-01-26 19:43  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jerry Sievers <gsievers19@comcast.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2016-01-26 19:43 UTC (permalink / raw)
  To: Jerry Sievers <gsievers19@comcast.net>; +Cc: Artem Tomyuk <admin@leboutique.com>; pgsql-admin

Jerry Sievers <gsievers19@comcast.net> writes:
> Artem Tomyuk <admin@leboutique.com> writes:
>> log_line_prefix = '===========> %h %u %t %p %x: [%l-1]'    
>> But in logs i see:
>> ===========>  [unknown] 2016-01-26 17:07:46 UTC 1664 0: [1-1]LOG:  connection received: host=192.168.112.181 port=50321

> Postmaster.

Good guess, but actually that log entry is emitted in the new backend
process.  We do know the remote IP at that point (obviously, because
we show it in the message).  But we haven't told elog about it quite
yet.  This seems just dumb.  I think we should switch the order of
these two stanzas in BackendInitialize():

    if (Log_connections)
    {
        if (remote_port[0])
            ereport(LOG,
                    (errmsg("connection received: host=%s port=%s",
                            remote_host,
                            remote_port)));
        else
            ereport(LOG,
                    (errmsg("connection received: host=%s",
                            remote_host)));
    }

    /*
     * save remote_host and remote_port in port structure
     */
    port->remote_host = strdup(remote_host);
    port->remote_port = strdup(remote_port);


BTW, the [unknown] bit is actually coming from %u, and that's
correct because we've not yet identified the user.  AFAICS,
elog just prints nothing for %h when the port->remote_host is
not set yet.

			regards, tom lane


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2016-01-26 19:43 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-26 17:51 custom log. variable %h reports [unknown] Artem Tomyuk <admin@leboutique.com>
2016-01-26 18:17 ` Gilberto Castillo <gilberto.castillo@etecsa.cu>
2016-01-26 18:19 ` Jerry Sievers <gsievers19@comcast.net>
2016-01-26 19:43   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox