-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: verify property baseed filtering on msgid and structured data
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Loading branch information
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
. "${srcdir:-.}/lib.sh" | ||
|
||
ID47="$DIR/id47.log" | ||
DATA="$DIR/data.log" | ||
|
||
setup_rfc5424() | ||
{ | ||
cat <<-EOF > "${CONF}" | ||
# Match all log messages, store in RC5424 | ||
*.* -${LOG} ;RFC5424 | ||
# Match ID47 | ||
:msgid, equal, "ID47" | ||
*.* ${ID47} ;RFC5424 | ||
:data, regex, ".*eventSource=\"Application\".*" | ||
*.* ${DATA} ;RFC5424 | ||
EOF | ||
setup -m0 >"${LOG2}" | ||
} | ||
|
||
verify_netcat() | ||
{ | ||
MSG='<165>1 2003-10-11T22:14:15.003Z mymachine.example.com su 12345 ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][id@2 test="tast"] BOM"su root" failed for lonvick on /dev/pts/8" ' | ||
|
||
echo "$MSG" | nc -w1 -Uu "${SOCK}" | ||
grep -H "mymachine" "${ID47}" | ||
} | ||
|
||
check_log() | ||
{ | ||
log="$1"; shift | ||
msg="$*" | ||
|
||
grep -H "$msg" "$log" | ||
} | ||
|
||
run_step "Set up syslogd w/ RFC5424" setup_rfc5424 | ||
run_step "Verify parsing of netcat message" verify_netcat | ||
run_step "Verify regexp on structured data" check_log "$DATA" "mymachine" |