Skip to content
Open
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
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Config struct {
LogVerbose bool `yaml:"log_verbose"`
SearchHost bool `yaml:"search_host,omitempty"`
logaConfigPath string `yaml:",omitempty"`
EnableSSL bool `yaml:"enable_ssl"`
}

func basicCheckOrExit(err error) {
Expand All @@ -53,6 +54,7 @@ func defaultConfig() Config {
StartTime: 0,
Count: 500,
LogVerbose: false,
EnableSSL: false,
logaConfigPath: "./loga.yaml",
ConfDefinedQueries: map[string]string{
"example": "foo AND bar",
Expand Down Expand Up @@ -99,6 +101,7 @@ func (c *Config) setFlags(fs *flag.FlagSet) {
fs.BoolVar(&c.LogVerbose, "v", c.LogVerbose, "Verbose logging option")
fs.BoolVar(&c.Highlight, "h", c.Highlight, "Highlight search in output")
fs.BoolVar(&c.FlagVersion, "version", false, "Print version and exit")
fs.BoolVar(&c.EnableSSL, "enable-ssl", false, "Using HTTPS for elasticsearch request.")

fs.StringVar(&c.logaConfigPath, "c", c.logaConfigPath, "Path to loga.yaml")
fs.StringVar(&c.FlagDefinedQuery, "d", c.FlagDefinedQuery, "Define a lookup on the CLI")
Expand Down
6 changes: 5 additions & 1 deletion loga/elastic_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ func (esRequest *ESRequest) makeRequest(c *config.Config) (ESResponse, error) {
log.Debugf("Elastic Search Request:\n %s", string(jsonpost))

// Craft the request URI
queryURL := strings.Join([]string{"http://", c.ElasticsearchURL, ":", c.ElasticsearchPort, "/_search?pretty"}, "")
requestMethod := "http"
if c.EnableSSL {
requestMethod := "https"
}
queryURL := strings.Join([]string{requestMethod, "://", c.ElasticsearchURL, ":", c.ElasticsearchPort, "/_search?pretty"}, "")
log.Debug("Query URI: ", queryURL)

// Make request
Expand Down