Exemplo n.º 1
0
			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, "")
}
Exemplo n.º 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
Exemplo n.º 3
0
Arquivo: gog.go Projeto: 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", "", "")