RE: Timestamps in outputs

From: Murthy Nunna <mnunna(at)fnal(dot)gov>
To: SOzcn <selahattinozcnma(at)gmail(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: RE: Timestamps in outputs
Date: 2023-12-24 15:36:27
Message-ID: DM8PR09MB66778CAAF165DC2BBCBA017BB89AA@DM8PR09MB6677.namprd09.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)com>
Sent: Wednesday, December 20, 2023 12:15 AM
To: Murthy Nunna <mnunna(at)fnal(dot)gov>
Cc: pgsql-admin(at)postgresql(dot)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(at)fnal(dot)gov<mailto:mnunna(at)fnal(dot)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 …

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Murthy Nunna 2023-12-24 15:53:39 Query Performance after pg_restore
Previous Message Scott Ribe 2023-12-24 14:00:04 Re: Need inputs on postgresql HA with consul cluster