Giter VIP home page Giter VIP logo

Comments (2)

jimonreal avatar jimonreal commented on July 22, 2024

I have made a few changes to be able to choose the facility using an env var, and if not set use the default "user".
Later I want to change that for a more parameter solution, using what you propose above, and been able to choose between syslog, stdout and any other logging driver.

Here is what a would apply first:

diff --git a/bin/marathon-framework b/bin/marathon-framework
index 85858a7..7a6d333 100755
--- a/bin/marathon-framework
+++ b/bin/marathon-framework
@@ -20,6 +20,7 @@ self="$(cd "$(dirname "$0")" && pwd -P)"/"$(basename "$0")"
 marathon_jar="$self"
 conf_dir=/etc/marathon/conf
 conf_file=/etc/default/marathon
+syslog_facility=${MARATHON_SYSLOG_FACILITY:-user}

 function main {
   if [[ ${1:-} = --jar ]]
@@ -60,7 +61,7 @@ function load_options_and_log {
   set -o allexport
   [[ ! -f "$conf_file" ]] || . "$conf_file"
   set +o allexport
-  for env_op in `env | grep ^MARATHON_ | sed -e '/^MARATHON_APP/d' -e 's/MARATHON_//' -e 's/=/ /'| awk '{printf("%s%s ", "--", tolower($1)); for(i=2;i<=NF;i++){printf("%s ", $i)}}'| sed -e 's/ $//'`; do
+  for env_op in `env | grep ^MARATHON_ | grep -v MARATHON_SYSLOG_FACILITY | sed -e '/^MARATHON_APP/d' -e 's/MARATHON_//' -e 's/=/ /'| awk '{printf("%s%s ", "--", tolower($1)); for(i=2;i<=NF;i++){printf("%s ", $i)}}'| sed -e 's/ $//'`; do
     cmd+=( "$env_op" )
   done
   # Default zk and master option
@@ -115,8 +116,8 @@ function run_jar {

 function logged {
   local token="$1[$$]" ; shift
-  exec 1> >(exec logger -p user.info   -t "$token")
-  exec 2> >(exec logger -p user.notice -t "$token")
+  exec 1> >(exec logger -p "${syslog_facility}".info   -t "$token")
+  exec 2> >(exec logger -p "${syslog_facility}".notice -t "$token")
   "$@"
 }

from chaos.

SEJeff avatar SEJeff commented on July 22, 2024

@jimonreal That is a good start, but ideally I could still just log to a flat file and have splunk ingest that.

from chaos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.