-
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.
Merge branch 'topic/christian/add-zeek-archiver'
* topic/christian/add-zeek-archiver: (68 commits) A bunch of nits to appease the Bannier linter :-) CI: bump Github workflow actions to current versions Remove zeek-archiver's Github workflows and .gitignore Remove zeek-archiver's CI setup, yesss Btest-ify zeek-archiver's ad-hoc shell script tests Remove zeek-archiver Makefile, no longer needed Unify zeek-archiver's and this repo's licensing. Relate zeek-archiver's README with the toplevel one. Remove zeek-archiver's separate version file, no longer needed Migrate zeek-archiver's update-config setup Remove redundant output at the end of cmake run Unify the CMake setup to build/install zeek-archiver Tweak zeek-archiver CHANGES to indicate it's historic. CI updates Add support for parsing log_suffix metadata from filenames CI: drop macOS Big Sur, add macOS Ventura CI: remove Fedora 35, now EOL CI: remove FreeBSD 11, EOL CI: actually run Fedora 36 ... CI: add Fedora 37 ...
- Loading branch information
Showing
27 changed files
with
1,433 additions
and
11 deletions.
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
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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.50-29 | ||
0.50-118 |
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,21 @@ | ||
# Common functionality for zeek-archiver's tests, originally found in its own | ||
# test.sh script that wasn't using btest. | ||
|
||
set -e | ||
set -x | ||
|
||
function queue_dir | ||
{ | ||
mkdir -p queue | ||
echo queue | ||
} | ||
|
||
function archive_dir | ||
{ | ||
echo archive | ||
} | ||
|
||
function archive_date_dir | ||
{ | ||
echo archive/2020-07-16 | ||
} |
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,12 @@ | ||
# Verify that commands injected via filenames do not execute. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in='test;uptime;__2020-07-16-09-43-10__2020-07-16-09-43-10__.log' | ||
log_out='test;uptime;.09:43:10-09:43:10.log' | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <"$(archive_date_dir)/${log_out}.gz")" == "hello" |
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,12 @@ | ||
# Use a custom delimiter in the resulting logs. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test_2020-07-16-09-43-10_2020-07-16-09-43-10_.log | ||
log_out=test.09:43:10-09:43:10.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v -d _ "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <$(archive_date_dir)/${log_out}.gz)" == "hello" |
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,12 @@ | ||
# Use a customized timestamp in output logs. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16_09-43-10__2020-07-16_09-43-10__.log | ||
log_out=test.09:43:10-09:43:10.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v --time-fmt %Y-%m-%d_%H-%M-%S "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <"$(archive_date_dir)/${log_out}.gz")" == "hello" |
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,12 @@ | ||
# Default behavior: compress the log. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__.log | ||
log_out=test.09:43:10-09:43:10.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <"$(archive_date_dir)/${log_out}.gz")" == "hello" |
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,12 @@ | ||
# Don't compress the logs. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__.log | ||
log_out=test.09:43:10-09:43:10.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v --compress="" "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(cat "$(archive_date_dir)/${log_out}")" == "hello" |
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,12 @@ | ||
# Verify that passing extra parameters to the compression stage works. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__.log | ||
log_out=test.09:43:10-09:43:10.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v --compress 'gz,gzip -9' "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <"$(archive_date_dir)/${log_out}.gz")" == "hello" |
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,15 @@ | ||
# Verify the source file still exists and the destination wasn't created | ||
# (or removed) when the compression command fails. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__.log | ||
log_out=test.09:43:10-09:43:10.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v --compress=false,/bin/false "$(queue_dir)" "$(archive_dir)" | ||
|
||
if [[ ! -e "$(queue_dir)/${log_in}" ]] || [[ -e "$(archive_date_dir)/${log_out}.false" ]] ; then | ||
exit 1 | ||
fi |
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,12 @@ | ||
# Verify log name metadata behavior: check that additional pid metadata gets dropped. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__log_suffix=logger-test,pid=4711__.log | ||
log_out=test.09:43:10-09:43:10-logger-test.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <"$(archive_date_dir)/${log_out}.gz")" == "hello" |
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,12 @@ | ||
# Verify log name metadata behavior: empty metadata is acceptable. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10____.log | ||
log_out=test.09:43:10-09:43:10.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <"$(archive_date_dir)/${log_out}.gz")" == "hello" |
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,21 @@ | ||
# Verify log name metadata behavior: invalid metadata causes skipping of archival. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
@TEST-START-FILE run.sh | ||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v "$(queue_dir)" "$(archive_dir)" | ||
test -f "$(queue_dir)/${log_in}" | ||
@TEST-END-FILE | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__log_suffix,invalid=4711__.log | ||
. run.sh | ||
|
||
# @TEST-START-NEXT | ||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__log_suffix=logger-test,__.log | ||
. run.sh | ||
|
||
# @TEST-START-NEXT | ||
log_in="test__2020-07-16-09-43-10__2020-07-16-09-43-10__ __.log" | ||
. run.sh |
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,12 @@ | ||
# Verify log name metadata behavior: check that suffixes get applied correctly. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__log_suffix=logger-test__.log | ||
log_out=test.09:43:10-09:43:10-logger-test.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <"$(archive_date_dir)/${log_out}.gz")" == "hello" |
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,13 @@ | ||
# Detect pre-compressed logs. | ||
# @TEST-EXEC: bash %INPUT | ||
|
||
. "$SCRIPTS/zeek-archiver-common.sh" | ||
|
||
log_in=test__2020-07-16-09-43-10__2020-07-16-09-43-10__.log | ||
log_out=test.09:43:10-09:43:10.log | ||
|
||
echo hello > "$(queue_dir)/${log_in}" | ||
gzip "$(queue_dir)/${log_in}" | ||
zeek-archiver -1 -v "$(queue_dir)" "$(archive_dir)" | ||
|
||
test "$(gunzip <"$(archive_date_dir)/${log_out}.gz")" == "hello" |
Oops, something went wrong.