Index: libbeat/cfgfile/cfgfile.go --- libbeat/cfgfile/cfgfile.go.orig +++ libbeat/cfgfile/cfgfile.go @@ -37,10 +37,10 @@ var ( // Additional default settings, that must be available for variable expansion defaults = common.MustNewConfigFrom(map[string]interface{}{ "path": map[string]interface{}{ - "home": ".", // to be initialized by beat - "config": "${path.home}", - "data": fmt.Sprint("${path.home}", string(os.PathSeparator), "data"), - "logs": fmt.Sprint("${path.home}", string(os.PathSeparator), "logs"), + "home": "${LOCALBASE}/share/${BEAT}", // to be initialized by beat + "config": "${SYSCONFDIR}/${BEAT}", + "data": "${LOCALSTATEDIR}/db/${BEAT}", + "logs": "${LOCALSTATEDIR}/log/${BEAT}", }, }) @@ -96,8 +96,8 @@ func GetDefaultCfgfile() string { // HandleFlags adapts default config settings based on command line flags. func HandleFlags() error { - // default for the home path is the binary location - home, err := filepath.Abs(filepath.Dir(os.Args[0])) + // default for the home path is "${LOCALBASE}/share/${BEAT}" + home, err := filepath.Abs("${LOCALBASE}/share/${BEAT}") if err != nil { if *homePath == "" { return fmt.Errorf("The absolute path to %s could not be obtained. %v", @@ -217,5 +217,5 @@ func GetPathConfig() string { return *homePath } // TODO: Do we need this or should we always return *homePath? - return "" + return "${SYSCONFDIR}/${BEAT}" }