@@ -142,6 +142,7 @@ func EnablePostgresLogging(
142142 // https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/receiver/filelogreceiver#readme
143143 outConfig .Receivers ["filelog/postgres_csvlog" ] = map [string ]any {
144144 // Read the CSV files and keep track of what has been processed.
145+ // The wildcard covers all potential log file names.
145146 "include" : []string {directory + "/*.csv" },
146147 "storage" : "file_storage/postgres_logs" ,
147148
@@ -173,6 +174,7 @@ func EnablePostgresLogging(
173174 // https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/receiver/filelogreceiver#readme
174175 outConfig .Receivers ["filelog/postgres_jsonlog" ] = map [string ]any {
175176 // Read the JSON files and keep track of what has been processed.
177+ // The wildcard covers all potential log file names.
176178 "include" : []string {directory + "/*.json" },
177179 "storage" : "file_storage/postgres_logs" ,
178180
@@ -238,8 +240,17 @@ func EnablePostgresLogging(
238240 "fsync" : true ,
239241 }
240242
243+ // https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/receiver/filelogreceiver#readme
241244 outConfig .Receivers ["filelog/pgbackrest_log" ] = map [string ]any {
242- "include" : []string {naming .PGBackRestPGDataLogPath + "/*.log" },
245+ // We use logrotate to rotate the pgbackrest logs which renames the
246+ // old .log file to .log.1. We want the collector to ingest logs from
247+ // both files as it is possible that pgbackrest will continue to write
248+ // a log record or two to the old file while rotation is occurring.
249+ // The collector knows not to create duplicate logs.
250+ "include" : []string {
251+ naming .PGBackRestPGDataLogPath + "/*.log" ,
252+ naming .PGBackRestPGDataLogPath + "/*.log.1" ,
253+ },
243254 "storage" : "file_storage/pgbackrest_logs" ,
244255
245256 // pgBackRest prints logs with a log prefix, which includes a timestamp
0 commit comments