Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Informatica Secure Agent
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
interop
iics
Informatica Secure Agent
Commits
dbda2208
Commit
dbda2208
authored
5 years ago
by
Eric Schoville
Browse files
Options
Downloads
Patches
Plain Diff
Move JSON log formatting to function
parent
c4b85705
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
run_agent.sh
+25
-11
25 additions, 11 deletions
run_agent.sh
with
25 additions
and
11 deletions
run_agent.sh
+
25
−
11
View file @
dbda2208
...
...
@@ -64,6 +64,21 @@ handle_term() {
fi
}
set_json_log
()
{
if
[
!
-z
${
JSON_LOG
}
]
;
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
}
# Login to the API with the provided username and password and get the URL and session id
# so we can check the status of this agent. Read results into Bash array
...
...
@@ -87,6 +102,14 @@ if [ -z "$status_code" ]; then
exit
1
fi
error_code
=
$(
jq
-nr
"
${
json
}
|.error.code"
)
if
[
-z
"
$error_code
"
]
;
then
echo
"Error connecting to Informatica API:
${
error_code
}
"
echo
$json
exit
1
fi
result
=(
$(
jq
-nr
"
${
json
}
|.serverUrl, .icSessionId"
)
)
if
[
-z
"
$result
"
]
;
then
...
...
@@ -146,8 +169,9 @@ else
fi
# set shutdown hooks
# set shutdown hooks
and set the json log file if necessary
prep_term
set_json_log
# run application
./infaagent startup
...
...
@@ -190,16 +214,6 @@ 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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment