]>
git.proxmox.com Git - pve-cluster.git/blob - data/src/logtest.c
2cac288249e8f5a7161e48fe9bdadaf330ffb18c
2 Copyright (C) 2010 Proxmox Server Solutions GmbH
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Affero General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Affero General Public License for more details.
14 You should have received a copy of the GNU Affero General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Author: Dietmar Maurer <dietmar@proxmox.com>
21 #define _XOPEN_SOURCE /* glibc2 needs this */
22 #include <time.h> /* for strptime */
27 #include <sys/types.h>
28 #include <sys/syslog.h>
36 #include "cfs-utils.h"
41 .nodename
= "testnode",
49 uint32_t pid
= getpid();
52 clusterlog_t
*cl3
= clusterlog_new();
54 clog_entry_t
*entry
= (clog_entry_t
*)alloca(CLOG_MAX_ENTRY_SIZE
);
55 clog_pack(entry
, cfs
.nodename
, "root", "cluster", pid
, time(NULL
), LOG_INFO
, "starting cluster log");
56 clusterlog_insert(cl3
, entry
);
58 for (int i
= 0; i
< 5000; i
++) {
59 clusterlog_add(cl3
, "user1", "TESTDOMAIN1", pid
, LOG_INFO
,
60 "test user1 รค message asdasd d dsgfdfgdgdg dgg dgdg %d", i
);
64 for (int i
= 0; i
< 5000; i
++) {
65 clog_base_t
*clog
[2] = { cl3
->base
, cl3
->base
};
67 clusterlog_merge(cl3
, clog
, 2);
68 //clusterlog_sort(cl3);
72 //clog_dump(cl3->base);
74 clusterlog_destroy(cl3
);
81 clusterlog_t
*cl1
= clusterlog_new();
83 for (int i
= 0; i
< 5; i
++) {
84 clusterlog_add(cl1
, "user1", "TESTDOMAIN1", pid
, LOG_INFO
,
85 "test user1 message asdasd %d", i
);
90 for (int i
= 0; i
< 5; i
++) {
91 clusterlog_add(cl1
, "user2", "TESTDOMAIN1", pid
, LOG_INFO
,
92 "test user2 message asdasd %d", i
);
96 clusterlog_t
*cl2
= clusterlog_new();
99 for (int i
= 0; i
< 5; i
++) {
100 clusterlog_add(cl2
, "user3", "TESTDOMAIN2", pid
, LOG_INFO
,
101 "test user3 message asdasd %d", i
);
106 clog_base_t
*clog
[2] = { cl1
->base
, cl2
->base
};
108 clusterlog_merge(cl1
, clog
, 2);
109 clog_dump(cl1
->base
);
111 clusterlog_destroy(cl1
);
112 clusterlog_destroy(cl2
);