Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: Add split_log.sh #525

Merged
merged 1 commit into from
Apr 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions scripts/split_log.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# Helper script useful for manual splitting of drakvuf log file by plugin
# (normally done by a postprocess step)

[ $# -ne 1 ] && echo "Split DRAKVUF log by plugin. Usage:\n$0 [drakvuf log]" && exit 1
INPUT_FILE=$1

[ -f $INPUT_FILE ] || (echo "File not found!" && exit 1)

PLUGINS=$(jq -r "[ inputs.Plugin ] | unique | .[]" $INPUT_FILE)

echo "Plugins found: ${PLUGINS}"

for plugin in $PLUGINS; do
FILENAME=${plugin}.log

echo Writing $FILENAME...
jq -c "select(.Plugin == \"${plugin}\")" $INPUT_FILE > $FILENAME
icedevml marked this conversation as resolved.
Show resolved Hide resolved
done