File: check_forensic

package info (click to toggle)
apache2 2.4.64-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 59,104 kB
  • sloc: ansic: 211,971; python: 13,977; perl: 11,307; sh: 7,102; php: 1,315; javascript: 1,314; awk: 749; makefile: 712; lex: 374; yacc: 161; xml: 2
file content (51 lines) | stat: -rwxr-xr-x 952 bytes parent folder | download | duplicates (7)
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
#!/bin/sh

# check_forensic <forensic log file>

# check the forensic log for requests that did not complete
# output the request log for each one

F=$1

temp_create_method=file
if test -f `which mktemp`; then
  temp_create_method=mktemp
elif test -f `which tempfile`; then
  temp_create_method=tempfile
fi

create_temp()
{
  prefix=$1
  case "$temp_create_method" in
    file)
      name="/tmp/$1.$$"
      ;;
    mktemp)
      name=`mktemp -t $1.XXXXXX`
      ;;
    tempfile)
      name=`tempfile --prefix=$1`
      ;;
    *)
      echo "$0: Cannot create temporary file"
      exit 1
      ;;
  esac
}

create_temp fcall
all=$name
create_temp fcin
in=$name
create_temp fcout
out=$name
trap "rm -f -- \"$all\" \"$in\" \"$out\";" 0 1 2 3 13 15

cut -f 1 -d '|' $F  > $all
grep ^+ < $all | cut -c2- | sort > $in
grep -- ^- < $all | cut -c2- | sort > $out

# use -i instead of -I for GNU xargs
join -v 1 $in $out | xargs -I xx egrep "^\\+xx" $F
exit 0