@@ -43,6 +43,8 @@ const (
43
43
defaultRequestRetrySleep = "1s" // sleep 1 sec between retries for HTTP requests
44
44
defaultMaxRequestRetries = "30" // maximum number of retries for HTTP requests
45
45
defaultStateDirectory = "/usr/share/elastic-agent/state" // directory that will hold the state data
46
+
47
+ logsPathPerms = 0775
46
48
)
47
49
48
50
var (
@@ -150,7 +152,7 @@ func logContainerCmd(streams *cli.IOStreams) error {
150
152
logsPath := envWithDefault ("" , "LOGS_PATH" )
151
153
if logsPath != "" {
152
154
// log this entire command to a file as well as to the passed streams
153
- if err := os .MkdirAll (logsPath , 0755 ); err != nil {
155
+ if err := os .MkdirAll (logsPath , logsPathPerms ); err != nil {
154
156
return fmt .Errorf ("preparing LOGS_PATH(%s) failed: %w" , logsPath , err )
155
157
}
156
158
logPath := filepath .Join (logsPath , "elastic-agent-startup.log" )
@@ -795,14 +797,14 @@ func setPaths(statePath, configPath, logsPath string, writePaths bool) error {
795
797
if logsPath != "" {
796
798
paths .SetLogs (logsPath )
797
799
// ensure that the logs directory exists
798
- if err := os .MkdirAll (filepath .Join (logsPath ), 0755 ); err != nil {
800
+ if err := os .MkdirAll (filepath .Join (logsPath ), logsPathPerms ); err != nil {
799
801
return fmt .Errorf ("preparing LOGS_PATH(%s) failed: %w" , logsPath , err )
800
802
}
801
803
}
802
804
803
805
// ensure that the internal logger directory exists
804
806
loggerPath := filepath .Join (paths .Home (), logger .DefaultLogDirectory )
805
- if err := os .MkdirAll (loggerPath , 0755 ); err != nil {
807
+ if err := os .MkdirAll (loggerPath , logsPathPerms ); err != nil {
806
808
return fmt .Errorf ("preparing internal log path(%s) failed: %w" , loggerPath , err )
807
809
}
808
810
0 commit comments