Created
June 15, 2021 01:44
-
-
Save navarrothiago/f601256ae9fd689453c82ac06cc106d6 to your computer and use it in GitHub Desktop.
Dump Cilium Syslog
This file contains hidden or 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
#!/bin/bash | |
main() { | |
local -r __dirname="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
DATE=$(date '+%Y-%m-%d-%H%M%S') | |
DIR_LOG="${__dirname}"/tmp/logs/cilium | |
HOSTNAME=$(cat /proc/sys/kernel/hostname) | |
LOG_SYSLINK="${HOSTNAME}"-syslog.txt | |
LOG_FILE="${HOSTNAME}"-"${DATE}"-syslog.txt | |
cd "${DIR_LOG}" | |
mkdir -p "${HOSTNAME}" | |
journalctl -b > "${HOSTNAME}"/"${LOG_FILE}" | |
ln -sf "${HOSTNAME}"/"${LOG_FILE}" "${LOG_SYSLINK}" | |
cd - | |
exit 0 | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment