pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Timestamps in outputs
4+ messages / 3 participants
[nested] [flat]

* Timestamps in outputs
@ 2023-12-19 23:08  Murthy Nunna <mnunna@fnal.gov>
  0 siblings, 1 reply; 4+ messages in thread

From: Murthy Nunna @ 2023-12-19 23:08 UTC (permalink / raw)
  To: pgsql-admin

Hi,

I am running pg_restore on a large (~20TB) database. I am using -V flag. Is there a way I can get timestamps in front of each line that is logged in the output.

pg_restore: launching item 5470 INDEX ....
pg_restore: creating INDEX ....
pg_restore: finished item 6131 TABLE DATA ...

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

* Re: Timestamps in outputs
@ 2023-12-20 06:14  SOzcn <selahattinozcnma@gmail.com>
  parent: Murthy Nunna <mnunna@fnal.gov>
  0 siblings, 1 reply; 4+ messages in thread

From: SOzcn @ 2023-12-20 06:14 UTC (permalink / raw)
  To: Murthy Nunna <mnunna@fnal.gov>; +Cc: pgsql-admin

Hello, next to your linux command you can get output like ; pg_restore -
... - ... * 2>&1 | ts '[%Y-%m-%d %H:%M:%S]' > pg_restore_output.log*

Murthy Nunna <mnunna@fnal.gov>, 20 Ara 2023 Çar, 02:08 tarihinde şunu yazdı:

> Hi,
>
>
>
> I am running pg_restore on a large (~20TB) database. I am using -V flag.
> Is there a way I can get timestamps in front of each line that is logged in
> the output.
>
>
>
> pg_restore: launching item 5470 INDEX ….
>
> pg_restore: creating INDEX ….
>
> pg_restore: finished item 6131 TABLE DATA …
>
>
>

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

* RE: Timestamps in outputs
@ 2023-12-24 15:36  Murthy Nunna <mnunna@fnal.gov>
  parent: SOzcn <selahattinozcnma@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Murthy Nunna @ 2023-12-24 15:36 UTC (permalink / raw)
  To: SOzcn <selahattinozcnma@gmail.com>; +Cc: pgsql-admin

Thanks, SOzcn!

Just for the record…. If you don’t have “ts” installed in your server (like mine), you can do the following as sell. I got this solution from a Linux forum. There are number of alternatives, but I find this one simpler.

<your-script-or-command> | awk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0; fflush() }' > t.txt &

Thanks!



From: SOzcn <selahattinozcnma@gmail.com>
Sent: Wednesday, December 20, 2023 12:15 AM
To: Murthy Nunna <mnunna@fnal.gov>
Cc: pgsql-admin@postgresql.org
Subject: Re: Timestamps in outputs

Hello, next to your linux command you can get output like ; pg_restore - ... - ...  2>&1 | ts '[%Y-%m-%d %H:%M:%S]' > pg_restore_output.log

Murthy Nunna <mnunna@fnal.gov<mailto:mnunna@fnal.gov>>, 20 Ara 2023 Çar, 02:08 tarihinde şunu yazdı:
Hi,

I am running pg_restore on a large (~20TB) database. I am using -V flag. Is there a way I can get timestamps in front of each line that is logged in the output.

pg_restore: launching item 5470 INDEX ….
pg_restore: creating INDEX ….
pg_restore: finished item 6131 TABLE DATA …



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

* Re: Timestamps in outputs
@ 2023-12-24 16:27  Scott Ribe <scott_ribe@elevated-dev.com>
  parent: Murthy Nunna <mnunna@fnal.gov>
  0 siblings, 0 replies; 4+ messages in thread

From: Scott Ribe @ 2023-12-24 16:27 UTC (permalink / raw)
  To: Murthy Nunna <mnunna@fnal.gov>; +Cc: pgsql-admin

> On Dec 24, 2023, at 8:36 AM, Murthy Nunna <mnunna@fnal.gov> wrote:
> 
> <your-script-or-command> | awk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0; fflush() }' > t.txt &

Ooooh, awesome! I'm going to save that for reference.






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


end of thread, other threads:[~2023-12-24 16:27 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-12-19 23:08 Timestamps in outputs Murthy Nunna <mnunna@fnal.gov>
2023-12-20 06:14 ` SOzcn <selahattinozcnma@gmail.com>
2023-12-24 15:36   ` Murthy Nunna <mnunna@fnal.gov>
2023-12-24 16:27     ` Scott Ribe <scott_ribe@elevated-dev.com>

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