1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
|
#!/bin/bash
#########################################################################
# #
# This script processed linaro web logs, producing different reports #
# Reports that can be run: #
# 1) Awffull (webalizer fork) #
# 2) Webalizer #
# 3) Webdruid (webalizer fork) #
# 4) Visitors #
# #
# You can run those tools on the full log or a processed log #
# The full log shows path traveled and other info, the processed log #
# really only shows what files were downloaded, for releases and #
# snapshots.linaro.org this is important information. #
# #
# 1) full log analyses of un unaltered web log #
# 2) filtered analyses of the web log of only the .gz and .bz2 files #
# and everything else stripped out #
# #
# To speed things up we use dnshistory to do reverse DNS #
# as a time cheat we only run the lookup on www.linaro.org log so #
# you should always process that log first so your DNS data is fresh #
# #
#########################################################################
# first save where we are
STARTING_LOCATION=`pwd`
# house keeping
if [ -z "$WEB_NAME" ] || [ -z "$TRUE" ] ; then
echo "WEB SITE NAME or other variables NOT SET"
echo "This script is not designed to be called directly"
exit 1
fi
#TRUE=1
#FALSE=0
#WEB_NAME="snapshots.linaro.org"
#WEB_NAME="releases.linaro.org"
#WEB_NAME="www.linaro.org"
# Which tools are we running, if not set at all set to false
if [ -z "$AWFFULL" ] ; then
AWFFULL=$FALSE
fi
if [ -z "$WEBALIZER" ] ; then
WEBALIZER=$FALSE
fi
if [ -z "$WEBDRUID" ] ; then
WEBDRUID=$FALSE
fi
if [ -z "$VISITORS" ] ; then
VISITORS=$FALSE
fi
# this allows an external script to set DEBUG, or if it's not set,
# then set it to false here so the script is run quietly
if [ -z "$DEBUG" ] ; then
DEBUG=$FALSE
fi
# do we want to extract file info and run the log analyzers on only that data
# quite handy for snapshots and releases .linaro.org so we get a better
# picture of what is downloaded.
# 1 = true, 0 = false
if [ $WEB_NAME = "snapshots.linaro.org" ] || [ $WEB_NAME = "releases.linaro.org" ] || [ $WEB_NAME = "builds.96boards.org" ]; then
EXTRACT_GZ_BZ2_FILES=$TRUE
EXTRACT_TOOLCHAIN_LOG=$TRUE
else
EXTRACT_GZ_BZ2_FILES=$FALSE
EXTRACT_TOOLCHAIN_LOG=$FALSE
fi
# this allows an external script to set DO_GEOIP_LOOKUP or DO_REV_DNS_LOOKUP
# as desired but by default they are set to true so the log files have
# as much data in them as possible.
if [ -z "$DO_GEOIP_LOOKUP" ] ; then
DO_GEOIP_LOOKUP=$TRUE
fi
if [ -z "$DO_REV_DNS_LOOKUP" ] ; then
DO_REV_DNS_LOOKUP=$TRUE
fi
# Load config
CONFIG=${1:-config}
source $CONFIG
#if [ $WEB_NAME = "snapshots.linaro.org" ] || [ $WEB_NAME = "releases.linaro.org" ] ; then
# RAW_LOG_NAME="$WEB_NAME-$PROCESSED_LOG_NAME"
#elif [ $WEB_NAME = "www.linaro.org" ] ; then
# RAW_LOG_NAME="$PROCESSED_LOG_NAME"
#fi
#########################################################################
# #
# only have old logs on www.linaro.org as it's hard to get stuff done #
# on that machine #
# #
#########################################################################
if [ $WEB_NAME = "www.linaro.org" ] ; then
OLD_LOG_PATH="$INPUT_PATH/2013"
OLD_LOG_NAME="$PROCESSED_LOG_NAME"
else
OLD_LOG_PATH="$INPUT_PATH"
OLD_LOG_NAME=""
fi
AWFFULL_FULL_PATH_NAME="awffull.full"
AWFFULL_CONF_FULL_NAME="awffull.conf.full"
AWFFULL_FILTERED_PATH_NAME="awffull.filtered"
AWFFULL_CONF_FILTERED_NAME="awffull.conf.filtered"
AWFFULL_TOOLCHAIN_PATH_NAME="awffull.toolchain"
AWFFULL_CONF_TOOLCHAIN_NAME="awffull.conf.toolchain"
AWFFULL_EXTRA_CMD_LINE_OPTIONS=""
WEBALIZER_FULL_PATH_NAME="webalizer.full"
WEBALIZER_CONF_FULL_NAME="webalizer.conf.full"
WEBALIZER_FILTERED_PATH_NAME="webalizer.filtered"
WEBALIZER_CONF_FILTERED_NAME="webalizer.conf.filtered"
WEBALIZER_TOOLCHAIN_PATH_NAME="webalizer.toolchain"
WEBALIZER_CONF_TOOLCHAIN_NAME="webalizer.conf.toolchain"
WEBALIZER_EXTRA_CMD_LINE_OPTIONS=""
WEBDRUID_FULL_PATH_NAME="webdruid.full"
WEBDRUID_CONF_FULL_NAME="webdruid.conf.full"
WEBDRUID_FILTERED_PATH_NAME="webdruid.filtered"
WEBDRUID_CONF_FILTERED_NAME="webdruid.conf.filtered"
WEBDRUID_TOOLCHAIN_PATH_NAME="webdruid.toolchain"
WEBDRUID_CONF_TOOLCHAIN_NAME="webdruid.conf.toolchain"
WEBDRUID_EXTRA_CMD_LINE_OPTIONS=""
write.conf.file ()
{
# $1 = File to write conf into into
# $2 = Output directory for analsys to be written into
# $3 = Info to be written into the web analsys to id what you are looking at
echo "# DO NOT EDIT THIS FILE, modify analyse-snapshot.sh as it rewrites this file everytime it's run" > $1
echo "OutputDir $2" >> $1
echo "HTMLPost $3" >> $1
echo "ReportTitle \"Usage Statistics for the $3 of \"" >> $1
echo "HostName $WEB_NAME" >> $1
echo "ReallyQuiet yes" >> $1
echo "IndexMonths 24" >> $1
echo "GraphMonths 24" >> $1
echo "TopSites 100" >> $1
echo "AllSites yes" >> $1
echo "TopURLs 100" >> $1
echo "AllURLs yes" >> $1
echo "GeoIP no" >> $1
# echo "GeoIPDatabase $GEO_IP_DB" >> $1
echo "IgnoreURL /get-remote-static" >> $1
echo "IgnoreURL /linaro-openid/login" >> $1
echo "IgnoreURL /get-textile-files" >> $1
echo "IgnoreURL /css/*" >> $1
echo "IgnoreURL /static/*" >> $1
echo "IgnoreURL /js/*" >> $1
echo "IgnoreURL /license" >> $1
if [ "$WEB_NAME" == "cards.linaro.org" -a $1 == "$WORK_PATH/$WEBDRUID_CONF_FULL_NAME" ]; then
# Graphs take too long too generate, being killed if tried
echo "PathGraph no" >> $1
echo "UsersFlow no" >> $1
fi
}
write_config_files ()
{
if [ $AWFFULL -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$AWFFULL_CONF_FULL_NAME $OUTPUT_PATH/$AWFFULL_FULL_PATH_NAME $PROCESSED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.awffull.conf.full"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$AWFFULL_CONF_FILTERED_NAME $OUTPUT_PATH/$AWFFULL_FILTERED_PATH_NAME $FILTERED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.awffull.conf.filtered"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$AWFFULL_CONF_TOOLCHAIN_NAME $OUTPUT_PATH/$AWFFULL_TOOLCHAIN_PATH_NAME $TOOLCHAIN_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.awffull.conf.toolchain"
fi
fi
fi
fi
if [ $WEBALIZER -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$WEBALIZER_CONF_FULL_NAME $OUTPUT_PATH/$WEBALIZER_FULL_PATH_NAME $PROCESSED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.webalizer.conf.full"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$WEBALIZER_CONF_FILTERED_NAME $OUTPUT_PATH/$WEBALIZER_FILTERED_PATH_NAME $FILTERED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.webalizer.conf.filtered"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$WEBALIZER_CONF_TOOLCHAIN_NAME $OUTPUT_PATH/$WEBALIZER_TOOLCHAIN_PATH_NAME $TOOLCHAIN_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.webalizer.conf.toolchain"
fi
fi
fi
fi
if [ $WEBDRUID -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$WEBDRUID_CONF_FULL_NAME $OUTPUT_PATH/$WEBDRUID_FULL_PATH_NAME $PROCESSED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.webdruid.conf.full"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$WEBDRUID_CONF_FILTERED_NAME $OUTPUT_PATH/$WEBDRUID_FILTERED_PATH_NAME $FILTERED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.webdruid.conf.filtered"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
write.conf.file $WORK_PATH/$WEBDRUID_CONF_TOOLCHAIN_NAME $OUTPUT_PATH/$WEBDRUID_TOOLCHAIN_PATH_NAME $TOOLCHAIN_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "write.webdruid.conf.toolchain"
fi
fi
fi
fi
}
prep_directories ()
{
if [ ! -d "$WORK_PATH" ]; then
mkdir -p "$WORK_PATH"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $WORK_PATH"
fi
fi
if [ $AWFFULL -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$AWFFULL_FULL_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$AWFFULL_FULL_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$AWFFULL_FULL_PATH_NAME"
fi
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$AWFFULL_FILTERED_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$AWFFULL_FILTERED_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$AWFFULL_FILTERED_PATH_NAME"
fi
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$AWFFULL_TOOLCHAIN_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$AWFFULL_TOOLCHAIN_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$AWFFULL_TOOLCHAIN_PATH_NAME"
fi
fi
fi
fi
fi
if [ $WEBALIZER -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$WEBALIZER_FULL_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$WEBALIZER_FULL_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$WEBALIZER_FULL_PATH_NAME"
fi
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$WEBALIZER_FILTERED_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$WEBALIZER_FILTERED_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$WEBALIZER_FILTER_PATH_NAME"
fi
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$WEBALIZER_TOOLCHAIN_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$WEBALIZER_TOOLCHAIN_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$WEBALIZER_TOOLCHAIN_PATH_NAME"
fi
fi
fi
fi
fi
if [ $WEBDRUID -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$WEBDRUID_FULL_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$WEBDRUID_FULL_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$WEBDRUID_FULL_PATH_NAME"
fi
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$WEBDRUID_FILTERED_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$WEBDRUID_FILTERED_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$WEBDRUID_FILTERED_PATH_NAME"
fi
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
if [ ! -d "$OUTPUT_PATH/$WEBDRUID_TOOLCHAIN_PATH_NAME" ]; then
mkdir -p "$OUTPUT_PATH/$WEBDRUID_TOOLCHAIN_PATH_NAME"
if [ $DEBUG -eq $TRUE ] ; then
echo "mkdir -p $OUTPUT_PATH/$WEBDRUID_TOOLCHAIN_PATH_NAME"
fi
fi
fi
fi
fi
cd "$WORK_PATH"
}
cleanup ()
{
# now delete the temp log file.
rm -f $WORK_PATH/$TMP_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$TMP_LOG_NAME"
fi
rm -f $WORK_PATH/$PROCESSED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$PROCESSED_LOG_NAME"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
rm -f $WORK_PATH/$FILTERED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$FILTERED_LOG_NAME"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
rm -f $WORK_PATH/$TOOLCHAIN_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$TOOLCHAIN_LOG_NAME"
fi
fi
fi
if [ $AWFFULL -eq $TRUE ] ; then
rm -f $WORK_PATH/$AWFFULL_CONF_FULL_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$AWFFULL_CONF_FULL_NAME"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
rm -f $WORK_PATH/$AWFFULL_CONF_FILTERED_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$AWFFULL_CONF_FILTERED_NAME"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
rm -f $WORK_PATH/$AWFFULL_CONF_TOOLCHAIN_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$AWFFULL_CONF_TOOLCHAIN_NAME"
fi
fi
fi
fi
if [ $WEBALIZER -eq $TRUE ] ; then
rm -f $WORK_PATH/$WEBALIZER_CONF_FULL_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$WEBALIZER_CONF_FULL_NAME"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
if [ -f "$WORK_PATH/$WEBALIZER_CONF_FILTERED_NAME" ] ; then
rm -f $WORK_PATH/$WEBALIZER_CONF_FILTERED_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$WEBALIZER_CONF_FILTERED_NAME"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
rm -f $WORK_PATH/$WEBALIZER_CONF_TOOLCHAIN_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$WEBALIZER_CONF_TOOLCHAIN_NAME"
fi
fi
fi
fi
fi
if [ $WEBDRUID -eq $TRUE ] ; then
rm -f $WORK_PATH/$WEBDRUID_CONF_FULL_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$WEBDRUID_CONF_FULL_NAME"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
rm -f $WORK_PATH/$WEBDRUID_CONF_FILTERED_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$WEBDRUID_CONF_FILTERED_NAME"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
rm -f $WORK_PATH/$WEBDRUID_CONF_TOOLCHAIN_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "rm -f $WORK_PATH/$WEBDRUID_CONF_TOOLCHAIN_NAME"
fi
fi
fi
fi
}
extract_logs ()
{
# Build a single log file that is not gzipped.
mkdir -p $WORK_PATH
zcat $INPUT_PATH/*access.log-20*[0-9].resolved.gz >$WORK_PATH/$PROCESSED_LOG_NAME
# now make a new file with only .gz, bz2, xz,exe, and zip files downloaded
# this grep can take some time to run, it's using a regular expression to extract compressed files
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
cat $WORK_PATH/$PROCESSED_LOG_NAME | grep -E '\<*\.(bz2|gz|xz|exe|zip)\>' | grep -v "gcc-linaro\ " > $WORK_PATH/$TMP_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "creating filtered log"
fi
# strip out our known IP's and some standard extra junk we don't need or care about
cat $WORK_PATH/$TMP_LOG_NAME \
| grep -v .asc \
| grep -v HEAD \
| grep -v OPTIONS \
| grep -v .png \
| grep -v .ico \
| grep -v .css \
| grep -v .js \
| grep -v validation.linaro.org \
> $WORK_PATH/$FILTERED_LOG_NAME
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
if [ $DEBUG -eq $TRUE ] ; then
echo "creating toochain log"
fi
cat $WORK_PATH/$FILTERED_LOG_NAME | grep -E '\<*gcc-linaro' > $WORK_PATH/$TOOLCHAIN_LOG_NAME
fi
fi
}
process_logs ()
{
## Awffull
# use all the data in the file
if [ $DEBUG -eq $TRUE ] ; then
echo "`date`"
fi
if [ $AWFFULL -eq $TRUE ] ; then
awffull $AWFFULL_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$AWFFULL_CONF_FULL_NAME $WORK_PATH/$PROCESSED_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "awffull processing $WORK_PATH/$PROCESSED_LOG_NAME"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
# Now use the filtered log that has only the .bz2 or .gz files and look at those patterns
awffull $AWFFULL_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$AWFFULL_CONF_FILTERED_NAME $WORK_PATH/$FILTERED_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "awffull processing $WORK_PATH/$FILTERED_LOG_NAME"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
awffull $AWFFULL_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$AWFFULL_CONF_TOOLCHAIN_NAME $WORK_PATH/$TOOLCHAIN_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "awffull processing $WORK_PATH/$TOOLCHAIN_LOG_NAME"
fi
fi
fi
fi
## Webalizer
# use all the data in the file
if [ $DEBUG -eq $TRUE ] ; then
echo "`date`"
fi
if [ $WEBALIZER -eq $TRUE ] ; then
webalizer $WEBALIZER_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$WEBALIZER_CONF_FULL_NAME $WORK_PATH/$PROCESSED_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "webalizer processing $WORK_PATH/$PROCESSED_LOG_NAME"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
# Now use the filtered log that has only the .bz2 or .gz files and look at those patterns
webalizer $WEBALIZER_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$WEBALIZER_CONF_FILTERED_NAME $WORK_PATH/$FILTERED_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "webalizer processing $WORK_PATH/$FILTERED_LOG_NAME"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
webalizer $WEBALIZER_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$WEBALIZER_CONF_TOOLCHAIN_NAME $WORK_PATH/$TOOLCHAIN_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "webalizer processing $WORK_PATH/$TOOLCHAIN_LOG_NAME"
fi
fi
fi
fi
## Visitors
# use all the data in the file
if [ $DEBUG -eq $TRUE ] ; then
echo "`date`"
fi
if [ $VISITORS -eq $TRUE ] ; then
if [ $DEBUG -eq $TRUE ] ; then
echo "visitors processing $WORK_PATH/$PROCESSED_LOG_NAME"
echo visitors --ignore-404 -A --prefix $WEB_NAME -o html --trails --output-file $OUTPUT_PATH/visitors-all.html $WORK_PATH/$PROCESSED_LOG_NAME
fi
visitors --ignore-404 -A --prefix $WEB_NAME -o html --trails --output-file $OUTPUT_PATH/visitors-all.html $WORK_PATH/$PROCESSED_LOG_NAME &> /dev/null
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
# Now use the filtered log that has only the .bz2 or .gz files and look at those patterns
visitors --ignore-404 -A --prefix $WEB_NAME -o html --trails --output-file $OUTPUT_PATH/visitors-filtered.html $WORK_PATH/$FILTERED_LOG_NAME &> /dev/null
cp $WORK_PATH/$FILTERED_LOG_NAME $OUTPUT_PATH/.
gzip -f -9 $OUTPUT_PATH/$FILTERED_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "visitors processing $WORK_PATH/$FILTERED_LOG_NAME and then creating $OUTPUT_PATH/$FILTERED_LOG_NAME.gz"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
visitors --ignore-404 -A --prefix $WEB_NAME -o html --trails --output-file $OUTPUT_PATH/visitors-toolchain.html $WORK_PATH/$TOOLCHAIN_LOG_NAME &> /dev/null
cp $WORK_PATH/$TOOLCHAIN_LOG_NAME $OUTPUT_PATH/.
gzip -f -9 $OUTPUT_PATH/$TOOLCHAIN_LOG_NAME
if [ $DEBUG -eq $TRUE ] ; then
echo "visitors processing $WORK_PATH/$TOOLCHAIN_LOG_NAME and then creating $OUTPUT_PATH/$TOOLCHAIN_LOG_NAME.gz"
fi
fi
fi
fi
## Webdruid
# use all the data in the file
if [ $DEBUG -eq $TRUE ] ; then
echo "`date`"
fi
if [ $WEBDRUID -eq $TRUE ] ; then
webdruid $WEBDRUID_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$WEBDRUID_CONF_FULL_NAME $WORK_PATH/$PROCESSED_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "webdruid processing $WORK_PATH/$PROCESSED_LOG_NAME"
fi
if [ $EXTRACT_GZ_BZ2_FILES -eq $TRUE ] ; then
# Now use the filtered log that has only the .bz2 or .gz files and look at those patterns
webdruid $WEBDRUID_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$WEBDRUID_CONF_FILTERED_NAME $WORK_PATH/$FILTERED_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "webdruid processing $WORK_PATH/$FILTERED_LOG_NAME"
fi
if [ $EXTRACT_TOOLCHAIN_LOG -eq $TRUE ] ; then
webdruid $WEBDRUID_EXTRA_CMD_LINE_OPTIONS -c $WORK_PATH/$WEBDRUID_CONF_TOOLCHAIN_NAME $WORK_PATH/$TOOLCHAIN_LOG_NAME > /dev/null
if [ $DEBUG -eq $TRUE ] ; then
echo "webdruid processing $WORK_PATH/$TOOLCHAIN_LOG_NAME"
fi
fi
fi
fi
}
# OK, the actual section to do work, prep, write out config files as needed,
# extract log files, process the log files, cleanup and exit.
# verify and make if necessary all directories needed by this script
prep_directories
cleanup
# write out the config files, rememnber they are changed here in this file
write_config_files
#/usr/bin/touch ~/bin/starttime
# combine all logs into a single file, then filter the log into a second file
extract_logs
# analyse the logs...
process_logs
# cleanup the extra files and stuff
if [ $DEBUG -ne $TRUE ] ; then
cleanup
else
echo "WARNING: Not cleaning up temporary files, beware of running out of disk space."
fi
# change back to where we were called from
cd $STARTING_LOCATION
# done, out of here
|