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

LOG-1497: Add the --tag option to add extra tags to the log message #109

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add the --tag option to add extra tags to the log message

  • Loading branch information
Kristján Valur Jónsson
Kristján Valur Jónsson committed Nov 3, 2017
commit 6535e5ca38e7ed699f7e8ceb7b6c48d713a0324c
@@ -72,6 +72,9 @@ LOGGLY_USERNAME=
#this is a mandatory input
LOGGLY_PASSWORD=

#Extra loggly tags to append to the syslog messages
LOGGLY_TAGS=()

#if this variable is set to true then suppress all prompts
SUPPRESS_PROMPT="false"

@@ -515,6 +518,10 @@ downloadTlsCerts() {

confString() {
RSYSLOG_VERSION_TMP=$(echo $RSYSLOG_VERSION | cut -d "." -f1)
TAGS=""
for TAG in "${LOGGLY_TAGS[@]}"; do
TAGS+=" tag=\\\"${TAG}\\\""
done
inputStr_TLS_RSYS_7="
# -------------------------------------------------------
# Syslog Logging Directives for Loggly ($LOGGLY_ACCOUNT.loggly.com)
@@ -523,7 +530,7 @@ confString() {
### RsyslogTemplate for Loggly ###
##########################################################
\$template LogglyFormat,\"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [$LOGGLY_AUTH_TOKEN@$LOGGLY_DISTRIBUTION_ID tag=\\\"RsyslogTLS\\\"] %msg%\n\"
\$template LogglyFormat,\"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [$LOGGLY_AUTH_TOKEN@$LOGGLY_DISTRIBUTION_ID tag=\\\"RsyslogTLS\\\"${TAGS}] %msg%\n\"
# Setup disk assisted queues
\$WorkDirectory /var/spool/rsyslog # where to place spool files
@@ -560,7 +567,7 @@ confString() {
template(name=\"LogglyFormat\" type=\"string\"
string=\"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [$LOGGLY_AUTH_TOKEN@$LOGGLY_DISTRIBUTION_ID tag=\\\"RsyslogTLS\\\"] %msg%\n\"
string=\"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [$LOGGLY_AUTH_TOKEN@$LOGGLY_DISTRIBUTION_ID tag=\\\"RsyslogTLS\\\"${TAGS}] %msg%\n\"
)
# Send messages to Loggly over TCP using the template.
@@ -572,7 +579,7 @@ action(type=\"omfwd\" protocol=\"tcp\" target=\"$LOGS_01_HOST\" port=\"$LOGGLY_S
# Syslog Logging Directives for Loggly ($LOGGLY_ACCOUNT.loggly.com)
# -------------------------------------------------------
# Define the template used for sending logs to Loggly. Do not change this format.
\$template LogglyFormat,\"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [$LOGGLY_AUTH_TOKEN@$LOGGLY_DISTRIBUTION_ID tag=\\\"Rsyslog\\\"] %msg%\n\"
\$template LogglyFormat,\"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [$LOGGLY_AUTH_TOKEN@$LOGGLY_DISTRIBUTION_ID tag=\\\"Rsyslog\\\"${TAGS}] %msg%\n\"
\$WorkDirectory /var/spool/rsyslog # where to place spool files
\$ActionQueueFileName fwdRule1 # unique name prefix for spool files
@@ -986,7 +993,7 @@ checkScriptRunningMode() {
#display usage syntax
usage() {
cat <<EOF
usage: configure-linux [-a loggly auth account or subdomain] [-t loggly token (optional)] [-u username] [-p password (optional)] [-s suppress prompts {optional)] [--insecure {to send logs without TLS} (optional)[--force-secure {optional} ]
usage: configure-linux [-a loggly auth account or subdomain] [-t loggly token (optional)] [-u username] [-p password (optional)] [-s suppress prompts {optional)] [--insecure {to send logs without TLS} (optional)] [--force-secure {optional} ] [--tag <tag> (optional, multiple)]
usage: configure-linux [-a loggly auth account or subdomain] [-r to remove]
usage: configure-linux [-h for help]
EOF
@@ -1035,6 +1042,10 @@ if [ "$1" != "being-invoked" ]; then
LOGGLY_TLS_SENDING="true"
LOGGLY_SYSLOG_PORT=6514
;;
--tag)
shift
LOGGLY_TAGS+=("$1")
;;
-h | --help)
usage
exit
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.