Skip to content
Snippets Groups Projects
Commit 8a85c36b authored by Eric Schoville's avatar Eric Schoville
Browse files

Add JSON_LOG parameter, tail agentcore.log

parent f9d7bb44
No related branches found
No related tags found
No related merge requests found
......@@ -153,7 +153,7 @@ prep_term
./infaagent startup
# sleep to allow startup (probably should refactor to use inotify tools or somesuch)
sleep 5
sleep 10
if [ "$register" = true ]; then
......@@ -190,8 +190,19 @@ curl -sS -H "Content-Type: application/json" \
term_child_pid=$(cat $PID_FILE)
echoGreen "Secure Agent Starting pid:$term_child_pid"
if [[ -n ${JSON_LOG+x} && "$JSON_LOG" = true ]]; then
# https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
# Replace the text line with a json formatted line. This is ugly.
find . -type f -name log4j.properties \
-exec sed -i '/^log4j.appender.stdout.layout.ConversionPattern/c\log4j.appender.stdout.layout.ConversionPattern={"dateIso8601":"%d","timeZone":"%d{z}","priority":"%p","category":"%c","message":"%m"}%n' \
{} \;
fi
# wait until terminated
while true
do
tail -f /dev/null & wait ${!}
tail -f agentcore.log & wait ${!}
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment