Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RFC3339 timestamps in the results #265

Merged
merged 1 commit into from
Nov 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion report/azureblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (w AzureBlobWriter) upload(res models.ScanResult) (err error) {
if err != nil {
return err
}
timestr := time.Now().Format("20060102_1504")
timestr := time.Now().Format(time.RFC3339)
name := ""
if len(res.Container.ContainerID) == 0 {
name = fmt.Sprintf("%s/%s.json", timestr, res.ServerName)
Expand Down
3 changes: 1 addition & 2 deletions report/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ func LoadOneScanHistory(jsonDir string) (scanHistory models.ScanHistory, err err
if scanResults[0].ScannedAt.IsZero() {
splitPath := strings.Split(jsonDir, string(os.PathSeparator))
timeStr := splitPath[len(splitPath)-1]
timeformat := "20060102_1504"
if scannedAt, err = time.Parse(timeformat, timeStr); err != nil {
if scannedAt, err = time.Parse(time.RFC3339, timeStr); err != nil {
err = fmt.Errorf("Failed to parse %s: %s", timeStr, err)
return
}
Expand Down
2 changes: 1 addition & 1 deletion report/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (w S3Writer) Write(scanResults []models.ScanResult) (err error) {

// http://docs.aws.amazon.com/sdk-for-go/latest/v1/developerguide/common-examples.title.html
svc := getS3()
timestr := time.Now().Format("20060102_1504")
timestr := time.Now().Format(time.RFC3339)
for _, r := range scanResults {
key := ""
if len(r.Container.ContainerID) == 0 {
Expand Down
3 changes: 1 addition & 2 deletions report/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import (
)

func ensureResultDir(scannedAt time.Time) (path string, err error) {
const timeLayout = "20060102_1504"
jsonDirName := scannedAt.Format(timeLayout)
jsonDirName := scannedAt.Format(time.RFC3339)

resultsDir := config.Conf.ResultsDir
if len(resultsDir) == 0 {
Expand Down