<commit_before>package command

import (
	"flag"
	"fmt"
	"strings"

	"github.com/funkygao/gocli"
)

type Logstash struct {
	Ui  cli.Ui
	Cmd string
}

func (this *Logstash) Run(args []string) (exitCode int) {
	cmdFlags := flag.NewFlagSet("logstash", flag.ContinueOnError)
	cmdFlags.Usage = func() { this.Ui.Output(this.Help()) }
	if err := cmdFlags.Parse(args); err != nil {
		return 1
	}

	this.showSampleConfig()

	return
}

func (this *Logstash) showSampleConfig() {
	config := `
input {
    file {
        path => "/var/wd/ehaproxy/ehaproxy.log"
        type => "ehaproxy"
    }
    file {
        path => "/var/wd/ehaproxy/panic"
        type => "ehaproxy_panic"
    }
    file {
        path => "/var/wd/ehaproxy/logs/haproxy.log"
        type => "haproxy"
    }
    file {
        path => "/var/wd/kateway/kateway.log"
        type => "kateway"
    }
    file {
        path => "/var/wd/kateway/panic"
        type => "kateway_panic"
    }
}

output {
    if [type] == "pubsub" {<commit_msg>use logstash multiline to merge stack trace<commit_after>package command

import (
	"flag"
	"fmt"
	"strings"

	"github.com/funkygao/gocli"
)

type Logstash struct {
	Ui  cli.Ui
	Cmd string
}

func (this *Logstash) Run(args []string) (exitCode int) {
	cmdFlags := flag.NewFlagSet("logstash", flag.ContinueOnError)
	cmdFlags.Usage = func() { this.Ui.Output(this.Help()) }
	if err := cmdFlags.Parse(args); err != nil {
		return 1
	}

	this.showSampleConfig()

	return
}

func (this *Logstash) showSampleConfig() {
	config := `
input {
    file {
        path => "/var/wd/ehaproxy/ehaproxy.log"
        type => "ehaproxy"
    }
    file {
        path => "/var/wd/ehaproxy/panic"
        type => "ehaproxy_panic"
    }
    file {
        path => "/var/wd/ehaproxy/logs/haproxy.log"
        type => "haproxy"
    }
    file {
        path => "/var/wd/kateway/kateway.log"
        type => "kateway"
    }
    file {
        path => "/var/wd/kateway/panic"
        type => "kateway_panic"
    }
}

filter {
    multiline {
        pattern => "^201" # e,g. this line begins with 2017-01-22
        what => "previous"
        negate => true
    }
}

output {
    if [type] == "pubsub" {
{'fraction_non_alphanumeric': 0.1545538178472861, 'fraction_numerical': 0.005979760809567618, 'mean_word_length': 2.310502283105023, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3797699', 'n_tokens_mistral': 863, 'n_tokens_neox': 837, 'n_words': 162}