Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
8d1b6de5
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8d1b6de5
编写于
2月 11, 2001
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add pg_logger to /contrib.
上级
e9371566
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
124 addition
and
0 deletion
+124
-0
contrib/README
contrib/README
+4
-0
contrib/pg_logger/Makefile
contrib/pg_logger/Makefile
+34
-0
contrib/pg_logger/README.pg_logger
contrib/pg_logger/README.pg_logger
+1
-0
contrib/pg_logger/pg_logger.c
contrib/pg_logger/pg_logger.c
+85
-0
未找到文件。
contrib/README
浏览文件 @
8d1b6de5
...
...
@@ -89,6 +89,10 @@ pg_dumplo -
Dump large objects
by Karel Zak <zakkr@zf.jcu.cz>
pg_logger -
Stdin-to-syslog gateway for PostgreSQL
by Nathan Myers <ncm@nospam.cantrip.org>
pgbench -
TPC-B like benchmarking tool
by Tatsuo Ishii <t-ishii@sra.co.jp>
...
...
contrib/pg_logger/Makefile
0 → 100644
浏览文件 @
8d1b6de5
#
# $Header: /cvsroot/pgsql/contrib/pg_logger/Attic/Makefile,v 1.1 2001/02/11 02:18:27 momjian Exp $
#
subdir
=
contrib/pg_logger
top_builddir
=
../..
include
$(top_builddir)/src/Makefile.global
OBJS
=
pg_logger.o
all
:
pg_logger
pg_logger
:
$(OBJS)
$(CC)
$(CFLAGS)
$(LDFLAGS)
$(OBJS)
$(LIBS)
-o
$@
install
:
all installdirs
$(INSTALL_PROGRAM)
pg_logger
$(X)
$(bindir)
$(INSTALL_DATA)
README.pg_logger
$(docdir)
/contrib
installdirs
:
$(mkinstalldirs)
$(bindir)
$(docdir)
/contrib
uninstall
:
rm
-f
$(bindir)
/pg_logger
$(X)
$(docdir)
/contrib/README.pg_logger
clean distclean maintainer-clean
:
rm
-f
pg_logger
$(X)
$(OBJS)
depend dep
:
$(CC)
-MM
-MG
$(CFLAGS)
*
.c
>
depend
ifeq
(depend,$(wildcard depend))
include
depend
endif
contrib/pg_logger/README.pg_logger
0 → 100644
浏览文件 @
8d1b6de5
Stdin-to-syslog gateway for PostgreSQL
contrib/pg_logger/pg_logger.c
0 → 100644
浏览文件 @
8d1b6de5
/* pg_logger: stdin-to-syslog gateway for postgresql.
*
* Copyright 2001 by Nathan Myers <ncm@nospam.cantrip.org>
* This software is distributed free of charge with no warranty of any kind.
* You have permission to make copies for any purpose, provided that (1)
* this copyright notice is retained unchanged, and (2) you agree to
* absolve the author of all responsibility for all consequences arising
* from any use.
*/
#include <stdio.h>
#include <stddef.h>
#include <syslog.h>
#include <string.h>
struct
{
const
char
*
tag
;
int
size
;
int
priority
;
}
tags
[]
=
{
{
""
,
0
,
LOG_NOTICE
},
{
"emerg:"
,
sizeof
(
"emerg"
),
LOG_EMERG
},
{
"alert:"
,
sizeof
(
"alert"
),
LOG_ALERT
},
{
"crit:"
,
sizeof
(
"crit"
),
LOG_CRIT
},
{
"err:"
,
sizeof
(
"err"
),
LOG_ERR
},
{
"error:"
,
sizeof
(
"error"
),
LOG_ERR
},
{
"warning:"
,
sizeof
(
"warning"
),
LOG_WARNING
},
{
"notice:"
,
sizeof
(
"notice"
),
LOG_NOTICE
},
{
"info:"
,
sizeof
(
"info"
),
LOG_INFO
},
{
"debug:"
,
sizeof
(
"debug"
),
LOG_DEBUG
}
};
int
main
()
{
char
buf
[
301
];
int
c
;
char
*
pos
=
buf
;
const
char
*
colon
=
0
;
#ifndef DEBUG
openlog
(
"postgresql"
,
LOG_CONS
,
LOG_LOCAL1
);
#endif
while
(
(
c
=
getchar
())
!=
EOF
)
{
if
(
c
==
'\r'
)
{
continue
;
}
if
(
c
==
'\n'
)
{
int
level
=
sizeof
(
tags
)
/
sizeof
(
*
tags
);
char
*
bol
;
if
(
colon
==
0
||
(
size_t
)(
colon
-
buf
)
>
sizeof
(
"warning"
))
{
level
=
1
;
}
*
pos
=
0
;
while
(
--
level
)
{
if
(
pos
-
buf
>=
tags
[
level
].
size
&&
strncmp
(
buf
,
tags
[
level
].
tag
,
tags
[
level
].
size
)
==
0
)
{
break
;
}
}
bol
=
buf
+
tags
[
level
].
size
;
if
(
bol
>
buf
&&
*
bol
==
' '
)
{
++
bol
;
}
if
(
pos
-
bol
>
0
)
{
#ifndef DEBUG
syslog
(
tags
[
level
].
priority
,
"%s"
,
bol
);
#else
printf
(
"%d/%s
\n
"
,
tags
[
level
].
priority
,
bol
);
#endif
}
pos
=
buf
;
colon
=
(
char
const
*
)
0
;
continue
;
}
if
(
c
==
':'
&&
!
colon
)
{
colon
=
pos
;
}
if
((
size_t
)(
pos
-
buf
)
<
sizeof
(
buf
)
-
1
)
{
*
pos
++
=
c
;
}
}
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录