()
| 1180 | } |
| 1181 | |
| 1182 | func (p linux) SetupLogDir() error { |
| 1183 | logDir := "/var/log" |
| 1184 | |
| 1185 | boshRootLogPath := path.Join(p.dirProvider.DataDir(), "root_log") |
| 1186 | |
| 1187 | err := p.fs.MkdirAll(boshRootLogPath, userRootLogDirPermissions) |
| 1188 | if err != nil { |
| 1189 | return bosherr.WrapError(err, "Creating root log dir") |
| 1190 | } |
| 1191 | |
| 1192 | _, _, _, err = p.cmdRunner.RunCommand("chmod", "0771", boshRootLogPath) |
| 1193 | if err != nil { |
| 1194 | return bosherr.WrapError(err, "Chmoding /var/log dir") |
| 1195 | } |
| 1196 | |
| 1197 | auditDirPath := path.Join(boshRootLogPath, "audit") |
| 1198 | _, _, _, err = p.cmdRunner.RunCommand("mkdir", "-p", auditDirPath) |
| 1199 | if err != nil { |
| 1200 | return bosherr.WrapError(err, "Creating audit log dir") |
| 1201 | } |
| 1202 | |
| 1203 | _, _, _, err = p.cmdRunner.RunCommand("chmod", "0750", auditDirPath) |
| 1204 | if err != nil { |
| 1205 | return bosherr.WrapError(err, "Chmoding audit log dir") |
| 1206 | } |
| 1207 | |
| 1208 | sysstatDirPath := path.Join(boshRootLogPath, "sysstat") |
| 1209 | _, _, _, err = p.cmdRunner.RunCommand("mkdir", "-p", sysstatDirPath) |
| 1210 | if err != nil { |
| 1211 | return bosherr.WrapError(err, "Creating sysstat log dir") |
| 1212 | } |
| 1213 | |
| 1214 | _, _, _, err = p.cmdRunner.RunCommand("chmod", "0755", sysstatDirPath) |
| 1215 | if err != nil { |
| 1216 | return bosherr.WrapError(err, "Chmoding sysstat log dir") |
| 1217 | } |
| 1218 | |
| 1219 | // change ownership |
| 1220 | _, _, _, err = p.cmdRunner.RunCommand("chown", "root:syslog", boshRootLogPath) |
| 1221 | if err != nil { |
| 1222 | return bosherr.WrapError(err, "Chowning root log dir") |
| 1223 | } |
| 1224 | |
| 1225 | err = p.ensureFile(fmt.Sprintf("%s/btmp", boshRootLogPath), "root:utmp", "0600") |
| 1226 | if err != nil { |
| 1227 | return err |
| 1228 | } |
| 1229 | |
| 1230 | err = p.ensureFile(fmt.Sprintf("%s/wtmp", boshRootLogPath), "root:utmp", "0664") |
| 1231 | if err != nil { |
| 1232 | return err |
| 1233 | } |
| 1234 | |
| 1235 | err = p.ensureFile(fmt.Sprintf("%s/lastlog", boshRootLogPath), "root:utmp", "0664") |
| 1236 | if err != nil { |
| 1237 | return err |
| 1238 | } |
| 1239 |
nothing calls this directly
no test coverage detected