我想将RDS实例的常规日志上传到CloudWatch Logs。
这是我设置的配置:
@RestController
public class SomeController {
@Autowired
private SomeService someService;
@PostMapping("/parents/{parentEntityId}/childs")
public ResponseEntity<Void> save(@PathVariable("parentEntityId") Long parentEntityId, @RequestBody ChildDto childDto) {
ChildEntity childEntity = childDtoMapper.fromDto(childDto);
someService.saveChild(parentEntityId, childEntity);
return ResponseEntity.created(...).build();
}
}
public class SomeServiceImpl {
@Autowired
private ParentEntityRepository parentEntityRepository;
@Autowired
private ChildEntityRepository childEntityRepository;
public ChildEntity saveChild(final long parentEntityId, final ChildEntity childEntity){
Optional<ParentEntity> parentEntity = parentEntityRepository.findById(parentEntityId);
if (parentEntity.isPresent()) {
childEntity.setParent(parentEntity.get());
childEntityRepository.save(childEntity);
return childEntity;
}
throw new EntityNotFoundException("Parent entity not found!");
}
}
部分中选择General log
。设置了以上选项后,我仍然无法在CloudWatch的日志组中找到日志。
还有其他我忘记配置的东西吗?