예제 #1
0
파일: gogId.go 프로젝트: strebul/gogy
			Query:     query,
			TimeStart: time.Now().Add(-time.Duration(gogIdDuration) * time.Hour),
			TimeEnd:   time.Now(),
			Size:      10,
			Order:     "desc",
		}

		client := component.Client{
			Host:     config.ReadString("logstash.host"),
			Login:    config.ReadString("logstash.login"),
			Password: config.ReadString("logstash.password"),
		}

		list := client.FindLogs(request)

		decorator := component.Decorator{}

		decorator.DecorateRequest(request)

		for _, log := range list {
			decorator.DecorateDetails(log)
		}

		return nil
	},
}

func init() {
	GogIdCmd.Flags().IntVarP(&gogIdDuration, "duration", "d", 24, "")
}
예제 #2
0
			if timestamp == 0 {
				startTime = time.Now().Add(-time.Duration(24) * time.Hour)
				log.Println("Used default start time")
			} else {
				startTime = time.Unix(int64(timestamp), 0)
			}

			request := model.Request{
				Query:     fmt.Sprintf(`message: "%s"`, config.ReadString("fc.pattern")),
				TimeStart: startTime,
				TimeEnd:   time.Now(),
				Size:      500,
				Order:     "acs",
			}

			decorator := component.Decorator{}
			decorator.DecorateRequest(request)

			client := component.Client{
				Host:     config.ReadString("logstash.host"),
				Login:    config.ReadString("logstash.login"),
				Password: config.ReadString("logstash.password"),
			}
			list := client.FindLogs(request)

			stored := 0
			for _, entity := range list {
				reader = entity.Source

				var exists int
예제 #3
0
파일: gog.go 프로젝트: strebul/gogy
		request := model.Request{
			Query:     query,
			TimeStart: time.Now().Add(-time.Duration(gogDuration) * time.Hour),
			TimeEnd:   time.Now(),
			Size:      gogSize,
			Order:     "desc",
		}

		client := component.Client{
			Host:     config.ReadString("logstash.host"),
			Login:    config.ReadString("logstash.login"),
			Password: config.ReadString("logstash.password"),
		}
		list := client.FindLogs(request)

		decorator := component.Decorator{}

		decorator.DecorateRequest(request)
		decorator.DecorateList(list, true)

		return nil
	},
}

func init() {
	GogCmd.Flags().StringVarP(&gogLevel, "log-level", "l", "", "~debug or warning,error")
	GogCmd.Flags().IntVarP(&gogSize, "size", "s", 100, "")
	GogCmd.Flags().IntVarP(&gogDuration, "duration", "d", 24, "")
	GogCmd.Flags().StringVarP(&gogScriptId, "script-id", "", "", "")
	GogCmd.Flags().StringVarP(&gogSessionId, "session-id", "", "", "")
	GogCmd.Flags().StringVarP(&gogMessage, "message", "m", "", "")