rbatch 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/CHANGELOG +43 -0
- data/HOW_TO_TEST.md +9 -0
- data/README.ja.md +6 -5
- data/README.md +6 -5
- data/Rakefile +1 -38
- metadata +78 -112
- data/sample/bin/log_backup.rb +0 -20
- data/sample/bin/test.rb +0 -6
- data/sample/bin/test2.rb +0 -3
- data/sample/conf/log_backup.yaml +0 -4
- data/sample/log/20130120_apache_log_insert.log +0 -171
- data/sample/log/20130120_openam_log_insert.log +0 -143
- data/sample/log/20130121_apache_log_insert.log +0 -103
- data/sample/log/20130121_file_batch_copy.log +0 -15
- data/sample/log/20130121_openam_log_insert.log +0 -39
- data/sample/log/20130121_webagent_log_insert.log +0 -432
- data/sample/log/20130122_apache_log_insert.log +0 -153
- data/sample/log/20130122_openam_log_insert.log +0 -374
- data/sample/log/20130122_webagent_log_insert.log +0 -144
- data/sample/log/20130129_log_backup.log +0 -95
- data/sample/log/20130131_apache_log_insert.log +0 -23
- data/sample/log/20130209_test.log +0 -128
- data/sample/log/20130210_test.log +0 -68
- data/sample/moto/README +0 -16
- data/sample/moto/auditlog.src.zip +0 -0
- data/sample/moto/build.gradle +0 -106
- data/sample/moto/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/sample/moto/gradle/wrapper/gradle-wrapper.properties +0 -7
- data/sample/moto/gradle.properties +0 -12
- data/sample/moto/gradlew +0 -164
- data/sample/moto/gradlew.bat +0 -90
- data/sample/moto/settings.gradle +0 -1
- data/sample/moto/src/main/bin/delete_auditlog.sh +0 -176
- data/sample/moto/src/main/bin/delete_workflowinstances.sh +0 -315
- data/sample/moto/src/main/bin/import_auth_log.sh +0 -23
- data/sample/moto/src/main/etc/delete_auditlog.param +0 -39
- data/sample/moto/src/main/etc/delete_workflowinstances.param +0 -30
- data/sample/moto/src/main/etc/log4j.xml +0 -28
- data/sample/moto/src/main/etc/status.properties +0 -27
- data/sample/moto/src/main/etc/sysparam.properties +0 -54
- data/sample/moto/src/main/java/jp/ossc/imortAuditlog/DateUtil.java +0 -48
- data/sample/moto/src/main/java/jp/ossc/imortAuditlog/ImportAuthLogMain.java +0 -36
- data/sample/moto/src/main/java/jp/ossc/imortAuditlog/LogReader.java +0 -521
- data/sample/moto/src/main/java/jp/ossc/imortAuditlog/MysqlController.java +0 -315
- data/sample/moto/src/main/logrotate/delete_auditlog +0 -6
- data/sample/moto/src/main/logrotate/delete_workflowinstanceslog +0 -6
- data/sample/moto/src/main/sql/tables.sql +0 -36
@@ -1,315 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
# 引数チェック
|
4
|
-
if [ $# -ne 3 ]; then
|
5
|
-
echo "Error Code:1 Arguments are insufficient." 1>&2
|
6
|
-
exit 1
|
7
|
-
fi
|
8
|
-
|
9
|
-
A=`echo "$1" | sed 's/[^0-9]//g'`
|
10
|
-
if test "$1" != "$A"; then
|
11
|
-
echo "Error Code:2 Not Numerical " 1>&2
|
12
|
-
exit 2
|
13
|
-
fi
|
14
|
-
|
15
|
-
A=`echo "$2" | sed 's/[^0-9]//g'`
|
16
|
-
if test "$2" != "$A"; then
|
17
|
-
echo "Error Code:2 Not Numerical" $2 1>&2
|
18
|
-
exit 2
|
19
|
-
fi
|
20
|
-
|
21
|
-
# company_id Check
|
22
|
-
A=`echo "$3" | sed 's/[^0-9]//g'`
|
23
|
-
if test "$3" != "$A"; then
|
24
|
-
echo "Error Code:2 Not Numerical" $3 1>&2
|
25
|
-
exit 2
|
26
|
-
fi
|
27
|
-
|
28
|
-
A=`date +%Y%m%d -d "$1"`
|
29
|
-
if test "$1" != "$A"; then
|
30
|
-
echo "Error Code:3 Not Date Type " $1 1>&2
|
31
|
-
exit 3
|
32
|
-
fi
|
33
|
-
|
34
|
-
A=`date +%Y%m%d -d "$2"`
|
35
|
-
if test "$2" != "$A"; then
|
36
|
-
echo "Error Code:3 Not Date Type " $2 1>&2
|
37
|
-
exit 3
|
38
|
-
fi
|
39
|
-
|
40
|
-
### スクリプトファイルの場所
|
41
|
-
BASEDIR=`dirname $0`
|
42
|
-
### paramファイル
|
43
|
-
PARAM=${BASEDIR}/../etc/delete_workflowinstances.param
|
44
|
-
## 今日の日付
|
45
|
-
CURRENT_TIME="date '+%Y-%m-%d %H:%M:%S'"
|
46
|
-
## hostname
|
47
|
-
HOSTNAME=$(hostname)s
|
48
|
-
|
49
|
-
|
50
|
-
### ログメッセージ、ナンバー、ステータスの配列
|
51
|
-
declare -a LOG_MSG
|
52
|
-
LOG_MSG[0001]="INFO ワークフロー申請書削除ツールを開始します。"
|
53
|
-
LOG_MSG[0002]="INFO ワークフロー申請書削除ツールを終了します。"
|
54
|
-
LOG_MSG[0003]="ERR ワークフロー申請書削除ツールが異常終了しました。"
|
55
|
-
|
56
|
-
LOG_MSG[0101]="INFO チェック処理を開始します。"
|
57
|
-
LOG_MSG[0102]="INFO チェック処理を終了します。"
|
58
|
-
LOG_MSG[0103]="ERR パラメータファイルが読み込めませんでした。"
|
59
|
-
|
60
|
-
LOG_MSG[0201]="INFO 削除件数確認処理を開始します。"
|
61
|
-
LOG_MSG[0202]="INFO 削除件数確認処理を終了します。"
|
62
|
-
LOG_MSG[0203]="ERR テーブルからの削除件数取得に失敗しました。"
|
63
|
-
LOG_MSG[0204]="INFO 削除対象レコードがありませんでした。"
|
64
|
-
|
65
|
-
LOG_MSG[0301]="INFO レコード削除処理を開始します。"
|
66
|
-
LOG_MSG[0302]="INFO レコード削除処理を終了します。"
|
67
|
-
LOG_MSG[0303]="ERR テーブルからのレコード削除に失敗しました。"
|
68
|
-
|
69
|
-
LOG_MSG[0401]="INFO ログ出力処理を開始します。"
|
70
|
-
LOG_MSG[0402]="INFO ログ出力処理を終了します。"
|
71
|
-
LOG_MSG[0403]="ERR ログ出力に失敗しました。"
|
72
|
-
|
73
|
-
|
74
|
-
####### utility functions
|
75
|
-
## ----------------------------------------
|
76
|
-
## output msg to log file
|
77
|
-
## params $1 status code
|
78
|
-
##
|
79
|
-
print_log () {
|
80
|
-
local len=$(expr length $1)
|
81
|
-
if [ 4 -eq $len ];then
|
82
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME $1 ${LOG_MSG[$1]} >> ${LOG_FILE}
|
83
|
-
else
|
84
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME $1 >> ${LOG_FILE}
|
85
|
-
fi
|
86
|
-
}
|
87
|
-
|
88
|
-
## ----------------------------------------
|
89
|
-
## output multiple msg to log
|
90
|
-
## params $@ status codes
|
91
|
-
##
|
92
|
-
print_multi_log () {
|
93
|
-
for arg in $@
|
94
|
-
do
|
95
|
-
print_log $arg
|
96
|
-
done
|
97
|
-
}
|
98
|
-
|
99
|
-
## ----------------------------------------
|
100
|
-
## mysql cmd
|
101
|
-
## params なし
|
102
|
-
##
|
103
|
-
mysql_cmd () {
|
104
|
-
# mysql -u${DB_USER} -p${DB_PASSWD}
|
105
|
-
## IPアドレスを指定してDBに接続の場合
|
106
|
-
/usr/bin/mysql -u${DB_USER} -p${DB_PASSWD} -h ${MYSQLHOST} lportal
|
107
|
-
}
|
108
|
-
|
109
|
-
## ----------------------------------------
|
110
|
-
## error trap function
|
111
|
-
## params $1 status code
|
112
|
-
##
|
113
|
-
err_handler () {
|
114
|
-
local err_status=${1:-$?}
|
115
|
-
print_multi_log $err_status "0003"
|
116
|
-
exit 1
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
## ========== main logic ==========
|
121
|
-
##### パラメータファイルのチェック #####
|
122
|
-
if [ -e $PARAM ]
|
123
|
-
then
|
124
|
-
source $PARAM
|
125
|
-
|
126
|
-
# ログディレクトリ作成
|
127
|
-
mkdir -p ${LOG_DIR}
|
128
|
-
|
129
|
-
## print start log
|
130
|
-
print_multi_log "0001" "0101" "0102"
|
131
|
-
else
|
132
|
-
SCRIPTNAME=`basename $0`
|
133
|
-
echo `eval $CURRENT_TIME` $HOSTNAME 0103 ${LOG_MSG[0103]}>> \
|
134
|
-
${BASEDIR}/../log/${SCRIPTNAME%.sh}.log
|
135
|
-
exit 1
|
136
|
-
fi
|
137
|
-
|
138
|
-
|
139
|
-
##### 削除レコード数を取得 #####
|
140
|
-
trap 'err_handler "0203"' ERR
|
141
|
-
## 開始ログ出力
|
142
|
-
print_log "0201"
|
143
|
-
|
144
|
-
## 削除件数取得
|
145
|
-
## instant_workflow_assignable_userテーブルより削除件数取得
|
146
|
-
instant_workflow_assignable_user_cnt=$(echo "select count(*) as c from instant_workflow_assignable_user \
|
147
|
-
where definition_instance_id in (select definition_instance_id \
|
148
|
-
from instant_workflow_definition_instance where company_id = '$3' \
|
149
|
-
and register_date between '$1' and '$2');" \
|
150
|
-
| mysql_cmd 2)
|
151
|
-
instant_workflow_assignable_user_cnt=$(echo $instant_workflow_assignable_user_cnt | sed -e s/c//)
|
152
|
-
|
153
|
-
## instant_workflow_form_instance_page_auditテーブルより削除件数取得
|
154
|
-
instant_workflow_form_instance_page_audit_cnt=$(echo "select count(*) as c from \
|
155
|
-
instant_workflow_form_instance_page_audit where definition_instance_id in \
|
156
|
-
(select definition_instance_id from instant_workflow_definition_instance where \
|
157
|
-
company_id = '$3' and register_date between '$1' and '$2');" \
|
158
|
-
| mysql_cmd 2> /dev/null)
|
159
|
-
instant_workflow_form_instance_page_audit_cnt=$(echo $instant_workflow_form_instance_page_audit_cnt | sed -e s/c//)
|
160
|
-
|
161
|
-
## instant_workflow_page_instanceテーブルより削除件数取得
|
162
|
-
instant_workflow_page_instance_cnt=$(echo "select count(*) as c from \
|
163
|
-
instant_workflow_page_instance where definition_instance_id in \
|
164
|
-
(select definition_instance_id from instant_workflow_definition_instance where \
|
165
|
-
company_id = '$3' and register_date between '$1' and '$2');" \
|
166
|
-
| mysql_cmd 2> /dev/null)
|
167
|
-
instant_workflow_page_instance_cnt=$(echo $instant_workflow_page_instance_cnt | sed -e s/c//)
|
168
|
-
|
169
|
-
## instant_workflow_assign_instance_detailテーブルより削除件数取得
|
170
|
-
instant_workflow_assign_instance_detail_cnt=$(echo "select count(*) as c from instant_workflow_assign_instance_detail \
|
171
|
-
where assign_instance_id in (select assign_instance_id from \
|
172
|
-
instant_workflow_assign_instance where definition_instance_id \
|
173
|
-
in (select definition_instance_id from instant_workflow_definition_instance \
|
174
|
-
where company_id = '$3' and register_date between '$1' and '$2'));" \
|
175
|
-
| mysql_cmd 2> /dev/null)
|
176
|
-
instant_workflow_assign_instance_detail_cnt=$(echo $instant_workflow_assign_instance_detail_cnt | sed -e s/c//)
|
177
|
-
|
178
|
-
## instant_workflow_assign_instanceテーブルより削除件数取得
|
179
|
-
instant_workflow_assign_instance_cnt=$(echo "select count(*) as c from \
|
180
|
-
instant_workflow_assign_instance where definition_instance_id in \
|
181
|
-
(select definition_instance_id from instant_workflow_definition_instance \
|
182
|
-
where company_id = '$3' and register_date between '$1' and '$2');" \
|
183
|
-
| mysql_cmd 2> /dev/null)
|
184
|
-
instant_workflow_assign_instance_cnt=$(echo $instant_workflow_assign_instance_cnt | sed -e s/c//)
|
185
|
-
|
186
|
-
## instant_workflow_form_instanceテーブルより削除件数取得
|
187
|
-
instant_workflow_form_instance_cnt=$(echo "select count(*) as c from instant_workflow_form_instance \
|
188
|
-
where definition_instance_id in (select definition_instance_id from \
|
189
|
-
instant_workflow_definition_instance where company_id = '$3' and \
|
190
|
-
register_date between '$1' and '$2');" \
|
191
|
-
| mysql_cmd 2> /dev/null)
|
192
|
-
instant_workflow_form_instance_cnt=$(echo $instant_workflow_form_instance_cnt | sed -e s/c//)
|
193
|
-
|
194
|
-
## instant_workflow_definition_instanceテーブルより削除件数取得
|
195
|
-
instant_workflow_definition_instance_cnt=$(echo "select count(*) as c from instant_workflow_definition_instance \
|
196
|
-
where company_id = '$3' and register_date between '$1' and '$2';" \
|
197
|
-
| mysql_cmd 2> /dev/null)
|
198
|
-
instant_workflow_definition_instance_cnt=$(echo $instant_workflow_definition_instance_cnt | sed -e s/c//)
|
199
|
-
|
200
|
-
|
201
|
-
## 削除対象が0の場合、件数0をログに出力後、正常終了
|
202
|
-
[ 0 -eq $instant_workflow_assignable_user_cnt ] && \
|
203
|
-
[ 0 -eq $instant_workflow_form_instance_page_audit_cnt ] && \
|
204
|
-
[ 0 -eq $instant_workflow_page_instance_cnt ] && \
|
205
|
-
[ 0 -eq $instant_workflow_assign_instance_detail_cnt ] && \
|
206
|
-
[ 0 -eq $instant_workflow_assign_instance_cnt ] && \
|
207
|
-
[ 0 -eq $instant_workflow_form_instance_cnt ] && \
|
208
|
-
[ 0 -eq $instant_workflow_definition_instance_cnt ] && \
|
209
|
-
print_multi_log "0204" "0002" && exit 0
|
210
|
-
|
211
|
-
## 終了ログ出力
|
212
|
-
print_log "0202"
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
##### 対象レコードを削除 #####
|
217
|
-
trap 'err_handler "0303"' ERR
|
218
|
-
## 開始ログ出力
|
219
|
-
print_log "0301"
|
220
|
-
|
221
|
-
## レコード削除
|
222
|
-
#[ $authentication_cnt -gt 0 ] && echo \
|
223
|
-
# "delete from ${AUTHENTICATION_LOG_TBL} where \
|
224
|
-
# date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
|
225
|
-
# | mysql_cmd > /dev/null 2>&1
|
226
|
-
|
227
|
-
#[ $authorization_cnt -gt 0 ] && echo \
|
228
|
-
# "delete from ${AUTHORIZATION_LOG_TBL} where \
|
229
|
-
# date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
|
230
|
-
# | mysql_cmd > /dev/null 2>&1
|
231
|
-
|
232
|
-
#[ $access_cnt -gt 0 ] && echo \
|
233
|
-
# "delete from ${ACCESS_LOG_TBL} where \
|
234
|
-
# date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
|
235
|
-
# | mysql_cmd > /dev/null 2>&1
|
236
|
-
|
237
|
-
|
238
|
-
[ $instant_workflow_assignable_user_cnt -gt 0 ] && echo \
|
239
|
-
"delete from instant_workflow_assignable_user \
|
240
|
-
where definition_instance_id in (select definition_instance_id \
|
241
|
-
from instant_workflow_definition_instance where company_id = '$3' \
|
242
|
-
and register_date between '$1' and '$2');" \
|
243
|
-
| mysql_cmd > /dev/null 2>&1
|
244
|
-
|
245
|
-
[ $instant_workflow_form_instance_page_audit_cnt -gt 0 ] && echo \
|
246
|
-
"delete from \
|
247
|
-
instant_workflow_form_instance_page_audit where definition_instance_id in \
|
248
|
-
(select definition_instance_id from instant_workflow_definition_instance where \
|
249
|
-
company_id = '$3' and register_date between '$1' and '$2');" \
|
250
|
-
| mysql_cmd > /dev/null 2>&1
|
251
|
-
|
252
|
-
[ $instant_workflow_page_instance_cnt -gt 0 ] && echo \
|
253
|
-
"delete from \
|
254
|
-
instant_workflow_page_instance where definition_instance_id in \
|
255
|
-
(select definition_instance_id from instant_workflow_definition_instance where \
|
256
|
-
company_id = '$3' and register_date between '$1' and '$2');" \
|
257
|
-
| mysql_cmd > /dev/null 2>&1
|
258
|
-
|
259
|
-
[ $instant_workflow_assign_instance_detail_cnt -gt 0 ] && echo \
|
260
|
-
"delete from instant_workflow_assign_instance_detail \
|
261
|
-
where assign_instance_id in (select assign_instance_id from \
|
262
|
-
instant_workflow_assign_instance where definition_instance_id \
|
263
|
-
in (select definition_instance_id from instant_workflow_definition_instance \
|
264
|
-
where company_id = '$3' and register_date between '$1' and '$2'));" \
|
265
|
-
| mysql_cmd > /dev/null 2>&1
|
266
|
-
|
267
|
-
[ $instant_workflow_assign_instance_cnt -gt 0 ] && echo \
|
268
|
-
"delete from \
|
269
|
-
instant_workflow_assign_instance where definition_instance_id in \
|
270
|
-
(select definition_instance_id from instant_workflow_definition_instance \
|
271
|
-
where company_id = '$3' and register_date between '$1' and '$2');" \
|
272
|
-
| mysql_cmd > /dev/null 2>&1
|
273
|
-
|
274
|
-
[ $instant_workflow_form_instance_cnt -gt 0 ] && echo \
|
275
|
-
"delete from instant_workflow_form_instance \
|
276
|
-
where definition_instance_id in (select definition_instance_id from \
|
277
|
-
instant_workflow_definition_instance where company_id = '$3' and \
|
278
|
-
register_date between '$1' and '$2');" \
|
279
|
-
| mysql_cmd > /dev/null 2>&1
|
280
|
-
|
281
|
-
[ $instant_workflow_definition_instance_cnt -gt 0 ] && echo \
|
282
|
-
"delete from instant_workflow_definition_instance \
|
283
|
-
where company_id = '$3' and register_date between '$1' and '$2';" \
|
284
|
-
| mysql_cmd > /dev/null 2>&1
|
285
|
-
|
286
|
-
## 終了ログ出力
|
287
|
-
print_log "0302"
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
##### ログへ削除件数の出力 #####
|
292
|
-
trap 'err_handler "0403"' ERR
|
293
|
-
## 開始ログ出力
|
294
|
-
print_log "0401"
|
295
|
-
|
296
|
-
## 削除件数をログに書込み
|
297
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
|
298
|
-
"instant_workflow_assignable_userテーブルより${instant_workflow_assignable_user_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
|
299
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
|
300
|
-
"instant_workflow_form_instance_page_auditテーブルより${instant_workflow_form_instance_page_audit_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
|
301
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
|
302
|
-
"instant_workflow_page_instanceテーブルより${instant_workflow_page_instance_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
|
303
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
|
304
|
-
"instant_workflow_assign_instance_detailテーブルより${instant_workflow_assign_instance_detail_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
|
305
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
|
306
|
-
"instant_workflow_assign_instanceテーブルより${instant_workflow_assign_instance_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
|
307
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
|
308
|
-
"instant_workflow_form_instanceテーブルより${instant_workflow_form_instance_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
|
309
|
-
echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
|
310
|
-
"instant_workflow_definition_instanceテーブルより${instant_workflow_definition_instance_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
|
311
|
-
|
312
|
-
|
313
|
-
## 終了ログ出力
|
314
|
-
print_multi_log "0402" "0002"
|
315
|
-
|
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
#####################################
|
4
|
-
#
|
5
|
-
# 認証アクセスログDB取込シェル
|
6
|
-
#
|
7
|
-
#####################################
|
8
|
-
|
9
|
-
cd `dirname $0`
|
10
|
-
|
11
|
-
JAVA_CMD=/usr/java/default/bin/java
|
12
|
-
|
13
|
-
CLASSPATH="../lib/*:../etc"
|
14
|
-
|
15
|
-
$JAVA_CMD -cp $CLASSPATH jp.ossc.imortAuditlog.ImportAuthLogMain
|
16
|
-
if [ $? -ne 0 ]; then
|
17
|
-
echo "ERROR:jp.ossc.imortAuditlog.ImportAuthLogMain"
|
18
|
-
exit 1
|
19
|
-
fi
|
20
|
-
|
21
|
-
exit 0
|
22
|
-
|
23
|
-
|
@@ -1,39 +0,0 @@
|
|
1
|
-
### system enviroment ###
|
2
|
-
|
3
|
-
## script name
|
4
|
-
SCRIPTNAME=`basename $0`
|
5
|
-
SCRIPTNAME=${SCRIPTNAME%.sh}
|
6
|
-
|
7
|
-
### ディレクトリ関連
|
8
|
-
## ルートディレクトリ
|
9
|
-
ROOT_DIR=${BASEDIR}/..
|
10
|
-
|
11
|
-
## bin directory
|
12
|
-
BIN_DIR=${ROOT_DIR}/bin
|
13
|
-
|
14
|
-
## log directory
|
15
|
-
LOG_DIR=${ROOT_DIR}/log
|
16
|
-
## log file
|
17
|
-
LOG_FILE=${LOG_DIR}/${SCRIPTNAME}.log
|
18
|
-
|
19
|
-
## パラメータファイルがあるディレクトリ
|
20
|
-
ETC_DIR=${ROOT_DIR}/etc
|
21
|
-
|
22
|
-
|
23
|
-
### database 関連の項目
|
24
|
-
## user
|
25
|
-
DB_USER=liferay
|
26
|
-
## password
|
27
|
-
DB_PASSWD='liferay'
|
28
|
-
|
29
|
-
## 削除対象テーブル
|
30
|
-
ACCESS_LOG_TBL=lportal.access_log
|
31
|
-
AUTHENTICATION_LOG_TBL=lportal.authentication_log
|
32
|
-
AUTHORIZATION_LOG_TBL=lportal.authorization_log
|
33
|
-
|
34
|
-
## 削除対象ログレコードを何日前以上のものにするか
|
35
|
-
## 日数で指定する。デフォルトでは3年より前のもの(1095を指定)
|
36
|
-
DAYS_GO_BACK=1095
|
37
|
-
|
38
|
-
|
39
|
-
MYSQLHOST="localhost"
|
@@ -1,30 +0,0 @@
|
|
1
|
-
### system enviroment ###
|
2
|
-
|
3
|
-
## script name
|
4
|
-
SCRIPTNAME=`basename $0`
|
5
|
-
SCRIPTNAME=${SCRIPTNAME%.sh}
|
6
|
-
|
7
|
-
### ディレクトリ関連
|
8
|
-
## ルートディレクトリ
|
9
|
-
ROOT_DIR=${BASEDIR}/..
|
10
|
-
|
11
|
-
## bin directory
|
12
|
-
BIN_DIR=${ROOT_DIR}/bin
|
13
|
-
|
14
|
-
## log directory
|
15
|
-
LOG_DIR=${ROOT_DIR}/log
|
16
|
-
## log file
|
17
|
-
LOG_FILE=${LOG_DIR}/${SCRIPTNAME}.log
|
18
|
-
|
19
|
-
## パラメータファイルがあるディレクトリ
|
20
|
-
ETC_DIR=${ROOT_DIR}/etc
|
21
|
-
|
22
|
-
|
23
|
-
### database 関連の項目
|
24
|
-
## user
|
25
|
-
DB_USER=liferay
|
26
|
-
## password
|
27
|
-
DB_PASSWD='liferay'
|
28
|
-
|
29
|
-
|
30
|
-
MYSQLHOST="localhost"
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
3
|
-
|
4
|
-
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
5
|
-
<appender name="FILE" class="org.apache.log4j.FileAppender">
|
6
|
-
|
7
|
-
<param name="File" value="../logs/import_auth.log" />
|
8
|
-
|
9
|
-
<layout class="org.apache.log4j.PatternLayout">
|
10
|
-
<param name="ConversionPattern"
|
11
|
-
value="%d %-5p %m%n" />
|
12
|
-
</layout>
|
13
|
-
</appender>
|
14
|
-
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
|
15
|
-
<param name="Target" value="System.out"/>
|
16
|
-
<param name="Threshold" value="INFO"/>
|
17
|
-
|
18
|
-
<layout class="org.apache.log4j.PatternLayout">
|
19
|
-
<!-- The default pattern: Date Priority [Category] Message\n -->
|
20
|
-
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p %m%n"/>
|
21
|
-
</layout>
|
22
|
-
</appender>
|
23
|
-
<root>
|
24
|
-
<level value="INFO" />
|
25
|
-
<appender-ref ref="CONSOLE"/>
|
26
|
-
<appender-ref ref="FILE"/>
|
27
|
-
</root>
|
28
|
-
</log4j:configuration>
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#AUTHENTICATION MESSAGE
|
2
|
-
auth.100=Login Success
|
3
|
-
auth.101=Login Success
|
4
|
-
auth.102=Login Success
|
5
|
-
auth.103=Login Success
|
6
|
-
auth.104=Login Success
|
7
|
-
auth.105=Login Success
|
8
|
-
auth.200=Login Failed
|
9
|
-
auth.201=Invalid Password
|
10
|
-
auth.202=No user profile
|
11
|
-
auth.203=User Profile does not exist
|
12
|
-
auth.204=Not active
|
13
|
-
auth.205=User is Locked out
|
14
|
-
auth.206=User account has expired
|
15
|
-
auth.207=Login Timed Out
|
16
|
-
auth.208=Authentication module is denied
|
17
|
-
auth.209=maximum number of session
|
18
|
-
auth.240=Login Failed
|
19
|
-
auth.241=Invalid Password
|
20
|
-
auth.245=User is Locked out
|
21
|
-
auth.247=Login Timed Out
|
22
|
-
auth.300=Logout
|
23
|
-
auth.301=Logout
|
24
|
-
auth.302=Logout
|
25
|
-
auth.303=Logout
|
26
|
-
auth.304=Logout
|
27
|
-
auth.305=Logout
|
@@ -1,54 +0,0 @@
|
|
1
|
-
#server swicher
|
2
|
-
server.sw=sso
|
3
|
-
|
4
|
-
#sso authlog config
|
5
|
-
sso.authlog.path=/var/log/OpenStandia/openam/log/
|
6
|
-
sso.authlog.name=amAuthentication.access.1
|
7
|
-
sso.autherrlog.name=amAuthentication.error.1
|
8
|
-
|
9
|
-
#sso agent authlog config
|
10
|
-
sso.agent.authlog.path=/opt/OpenStandia/web_agents/apache22_agent/Agent_001/logs/audit/
|
11
|
-
sso.agent.authlog.name=amAgent_localhost_80.log
|
12
|
-
sso.agent.authlog.exclude.pattern=
|
13
|
-
#for local log
|
14
|
-
sso.agent.authlog.keyword=Info
|
15
|
-
sso.agent.authlog.request.point=11
|
16
|
-
#for remote log
|
17
|
-
sso.agent.authlog.keyword=INFO
|
18
|
-
sso.agent.authlog.request.point=8
|
19
|
-
|
20
|
-
#sso accesslog config
|
21
|
-
sso.accesslog.path=/var/log/OpenStandia/apache/
|
22
|
-
sso.accesslog.name=access_log.1
|
23
|
-
sso.clientip.point=2
|
24
|
-
sso.userid.point=4
|
25
|
-
sso.date.point=5
|
26
|
-
sso.processingtime.point=6
|
27
|
-
sso.request.point=8
|
28
|
-
sso.status.point=9
|
29
|
-
sso.agent.point=11
|
30
|
-
sso.referer.point=12
|
31
|
-
|
32
|
-
#rp accesslog config
|
33
|
-
rp.accesslog.path=/var/log/OpenStandia/apache/
|
34
|
-
rp.accesslog.name=access_log.1
|
35
|
-
rp.clientip.point=2
|
36
|
-
rp.userid.point=4
|
37
|
-
rp.date.point=5
|
38
|
-
rp.processingtime.point=6
|
39
|
-
rp.request.point=8
|
40
|
-
rp.status.point=9
|
41
|
-
rp.agent.point=11
|
42
|
-
rp.referer.point=12
|
43
|
-
|
44
|
-
#mysql config
|
45
|
-
mysql.host=localhost
|
46
|
-
mysql.port=3306
|
47
|
-
mysql.user=liferay
|
48
|
-
mysql.password=liferay
|
49
|
-
mysql.dbname=lportal
|
50
|
-
mysql.option=autocommit=false&socketTimout=290000&useUnicode=true&chracterEncoding=utf8&useFastDateParsing=false
|
51
|
-
|
52
|
-
exclude.pattern=jpg,gif,html,css,js,jpeg,ico
|
53
|
-
execute.count=100
|
54
|
-
companyid.value=10112
|
@@ -1,48 +0,0 @@
|
|
1
|
-
package jp.ossc.imortAuditlog;
|
2
|
-
|
3
|
-
import java.util.Calendar;
|
4
|
-
|
5
|
-
public class DateUtil {
|
6
|
-
private static String[] months = new String[] {
|
7
|
-
"Jan", "Feb", "Mar", "Apr",
|
8
|
-
"May", "Jun", "Jul", "Aug",
|
9
|
-
"Oct", "Sep", "Nov", "Dec",
|
10
|
-
};
|
11
|
-
public static Calendar toCalendar(String strDate){
|
12
|
-
int yyyy = 0;
|
13
|
-
int MM = 0;
|
14
|
-
int dd = 0;
|
15
|
-
int HH = 0;
|
16
|
-
int mm = 0;
|
17
|
-
int ss = 0;
|
18
|
-
Calendar cal = Calendar.getInstance();
|
19
|
-
cal.setLenient(false);
|
20
|
-
if (strDate.startsWith("[")) {
|
21
|
-
strDate = strDate.replace("[", "");
|
22
|
-
strDate = strDate.replace("]", "");
|
23
|
-
yyyy = Integer.parseInt(strDate.substring(7,11));
|
24
|
-
for (int i = 0; i < months.length; i++) {
|
25
|
-
if(months[i].equals(strDate.subSequence(3, 6))){
|
26
|
-
MM = i;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
dd = Integer.parseInt(strDate.substring(0,2));
|
30
|
-
HH = Integer.parseInt(strDate.substring(12,14));
|
31
|
-
mm = Integer.parseInt(strDate.substring(15,17));
|
32
|
-
ss = Integer.parseInt(strDate.substring(18,20));
|
33
|
-
}else{
|
34
|
-
strDate = strDate.replace("\"", "");
|
35
|
-
yyyy = Integer.parseInt(strDate.substring(0,4));
|
36
|
-
MM = Integer.parseInt(strDate.substring(5,7)) -1;
|
37
|
-
dd = Integer.parseInt(strDate.substring(8,10));
|
38
|
-
HH = Integer.parseInt(strDate.substring(11,13));
|
39
|
-
mm = Integer.parseInt(strDate.substring(14,16));
|
40
|
-
ss = Integer.parseInt(strDate.substring(17,19));
|
41
|
-
}
|
42
|
-
cal.clear();
|
43
|
-
cal.set(yyyy,MM,dd,HH,mm,ss);
|
44
|
-
|
45
|
-
return cal;
|
46
|
-
}
|
47
|
-
|
48
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
package jp.ossc.imortAuditlog;
|
2
|
-
|
3
|
-
import java.util.PropertyResourceBundle;
|
4
|
-
import java.util.ResourceBundle;
|
5
|
-
|
6
|
-
import org.apache.log4j.Logger;
|
7
|
-
|
8
|
-
/**
|
9
|
-
*
|
10
|
-
* 認証アクセスログ照会
|
11
|
-
*
|
12
|
-
* SSOサーバ、リバプロサーバの認証ログ、アクセスログを
|
13
|
-
* DBに取り込む。
|
14
|
-
*
|
15
|
-
*/
|
16
|
-
|
17
|
-
public class ImportAuthLogMain {
|
18
|
-
private static Logger logger = Logger.getLogger(ImportAuthLogMain.class);
|
19
|
-
public static void main(String arg[]){
|
20
|
-
ResourceBundle sysResource = PropertyResourceBundle.getBundle("sysparam");
|
21
|
-
String sw = sysResource.getString("server.sw");
|
22
|
-
|
23
|
-
LogReader logread = new LogReader();
|
24
|
-
//SSOサーバの場合、認証ログ・認可ログ・アクセスログを取り込む
|
25
|
-
if(sw.equals("sso")){
|
26
|
-
logread.authLogReader(sysResource);
|
27
|
-
logread.agentAuthLogReader(sysResource);
|
28
|
-
logread.accessLogReader(sysResource , sw);
|
29
|
-
//リバプロサーバの場合、アクセスログを取り込む
|
30
|
-
}else if(sw.equals("rp")){
|
31
|
-
logread.accessLogReader(sysResource ,sw);
|
32
|
-
}else{
|
33
|
-
logger.error("sysparam server error");
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|