60#define READ_BUF_SIZE (2 * PIPE_CHUNK_SIZE)
63#define LOGROTATE_SIGNAL_FILE "logrotate"
109#define NBUFFER_LISTS 256
301 elog(
FATAL,
"could not create syslogger data transfer thread: %m");
527 errmsg(
"could not read from logger pipe: %m")));
626 errmsg(
"could not create pipe for syslog: %m")));
640 errmsg(
"could not create pipe for syslog: %m")));
711 (
errmsg(
"could not fork system logger: %m")));
730 (
errmsg(
"redirecting log output to logging collector process"),
731 errhint(
"Future log output will appear in directory \"%s\".",
739 errmsg(
"could not redirect stdout: %m")));
744 errmsg(
"could not redirect stderr: %m")));
761 errmsg(
"could not redirect stderr: %m")));
897 if (p.
nuls[0] ==
'\0' && p.
nuls[1] ==
'\0' &&
1172 errmsg(
"could not read from logger pipe: %m")));
1247 errmsg(
"could not open log file \"%s\": %m",
1337 (
errmsg(
"disabling automatic rotation (use SIGHUP to re-enable)")));
1489 errmsg(
"could not remove file \"%s\": %m",
1512 errmsg(
"could not open file \"%s\": %m",
1523 errmsg(
"could not write file \"%s\": %m",
1536 errmsg(
"could not write file \"%s\": %m",
1549 errmsg(
"could not write file \"%s\": %m",
1560 errmsg(
"could not rename file \"%s\" to \"%s\": %m",
Datum now(PG_FUNCTION_ARGS)
#define write_stderr(str)
#define Assert(condition)
#define fprintf(file, fmt, msg)
int errcode_for_socket_access(void)
int errmsg_internal(const char *fmt,...)
int errcode_for_file_access(void)
int errhint(const char *fmt,...)
int errmsg(const char *fmt,...)
#define LOG_DESTINATION_JSONLOG
#define LOG_DESTINATION_STDERR
#define ereport(elevel,...)
#define LOG_DESTINATION_CSVLOG
int MakePGDirectory(const char *directoryName)
#define palloc_object(type)
void ProcessConfigFile(GucContext context)
volatile sig_atomic_t ConfigReloadPending
void SignalHandlerForConfigReload(SIGNAL_ARGS)
void SetLatch(Latch *latch)
void ResetLatch(Latch *latch)
pid_t postmaster_child_launch(BackendType child_type, int child_slot, void *startup_data, size_t startup_data_len, ClientSocket *client_sock)
List * lappend(List *list, void *datum)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext PostmasterContext
void MemoryContextDelete(MemoryContext context)
BackendType MyBackendType
PGDLLIMPORT const uint8 pg_number_of_ones[256]
static PgChecksumMode mode
static char buf[DEFAULT_XLOG_SEG_SIZE]
size_t pg_strftime(char *s, size_t maxsize, const char *format, const struct pg_tm *t)
struct pg_tm * pg_localtime(const pg_time_t *timep, const pg_tz *tz)
PGDLLIMPORT pg_tz * log_timezone
size_t strlcpy(char *dst, const char *src, size_t siz)
CommandDest whereToSendOutput
static int fd(const char *x, int i)
void init_ps_display(const char *fixed_part)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void initStringInfo(StringInfo str)
bool Log_truncate_on_rotation
static bool rotation_disabled
static void logfile_rotate(bool time_based_rotation, int size_rotation_for)
static bool pipe_eof_seen
void SysLoggerMain(const void *startup_data, size_t startup_data_len)
static bool logfile_rotate_dest(bool time_based_rotation, int size_rotation_for, pg_time_t fntime, int target_dest, char **last_file_name, FILE **logFile)
bool CheckLogrotateSignal(void)
static char * logfile_getname(pg_time_t timestamp, const char *suffix)
#define LOGROTATE_SIGNAL_FILE
static FILE * logfile_open(const char *filename, const char *mode, bool allow_errors)
static void update_metainfo_datafile(void)
static char * last_csv_file_name
NON_EXEC_STATIC pg_time_t first_syslogger_file_time
static void process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
void RemoveLogrotateSignalFiles(void)
void write_syslogger_file(const char *buffer, int count, int destination)
static pg_time_t next_rotation_time
static volatile sig_atomic_t rotation_requested
static List * buffer_lists[NBUFFER_LISTS]
static void sigUsr1Handler(SIGNAL_ARGS)
static void set_next_rotation_time(void)
static void flush_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
int SysLogger_Start(int child_slot)
static FILE * jsonlogFile
static char * last_json_file_name
static char * last_sys_file_name
#define PIPE_PROTO_DEST_JSONLOG
#define PIPE_PROTO_IS_LAST
#define PIPE_PROTO_DEST_CSVLOG
#define LOG_METAINFO_DATAFILE_TMP
#define PIPE_PROTO_DEST_STDERR
#define LOG_METAINFO_DATAFILE
int AddWaitEventToSet(WaitEventSet *set, uint32 events, pgsocket fd, Latch *latch, void *user_data)
int WaitEventSetWait(WaitEventSet *set, long timeout, WaitEvent *occurred_events, int nevents, uint32 wait_event_info)
WaitEventSet * CreateWaitEventSet(ResourceOwner resowner, int nevents)
#define WL_SOCKET_READABLE
void _dosmaperr(unsigned long)