Giter VIP home page Giter VIP logo

gcfg's Introduction

Go Reference

Gravwell Open-Source Code

This repository contains open-sourced libraries and commands developed by Gravwell.

There are a selection of Gravwell-specific libraries and tools:

  • ingest/ contains the ingest library, which is used to connect to a Gravwell indexer and upload data.
  • ingesters/ contains the source code for Gravwell ingesters.
  • generators/ is a collection of tools that generate artificial data for testing Gravwell or any other log analytics system.
  • manager/ provides a very simple init command which we use in Docker containers.
  • chancacher/ implements a caching library we use for ingesters.

There are also a few libraries which may be of use outside Gravwell-specific applications:

  • filewatch/ is a library that can monitor files on the filesystem for changes; we use this in the FileFollow ingester.
  • timegrinder/ is a timestamp extraction library we use to extract timestamps from arbitrary data
  • ipexist/ contains a library for efficiently storing and checking for the existence of an IPv4 set with high density sets.
  • winevent/ is a library which can interact with the Windows Event subsystem to extract XML rendered events.

gcfg's People

Contributors

akavel avatar ashnwade avatar david-fritz-gravwell avatar floren avatar kris-watts-gravwell avatar speter avatar traetox avatar wanglei-ok avatar

Watchers

 avatar  avatar

gcfg's Issues

Panic in backtick parsing

There is a panic in how backticks are parsed in config files.

Here is the panic/traceback:

panic: missing end quote

goroutine 1 [running]:
github.com/gravwell/gcfg.unquote(0xc0000ea300, 0x28, 0x5, 0xc0000ea300)
        /home/kris/mygo/pkg/mod/github.com/gravwell/[email protected]/read.go:45 +0x304
github.com/gravwell/gcfg.readIntoPass(0xc000087670, 0x715ea0, 0xc0000c2c60, 0xc0001365c0, 0xc0000b01e0, 0xc000160000, 0xd21, 0x1e00, 0xc0000ae500, 0x0, ...)
        /home/kris/mygo/pkg/mod/github.com/gravwell/[email protected]/read.go:160 +0xcd2
github.com/gravwell/gcfg.readInto(0x715ea0, 0xc0000c2c60, 0xc0001365c0, 0xc0000b01e0, 0xc000160000, 0xd21, 0x1e00, 0x0, 0x40c678)
        /home/kris/mygo/pkg/mod/github.com/gravwell/[email protected]/read.go:194 +0xda
github.com/gravwell/gcfg.ReadInto(0x715ea0, 0xc0000c2c60, 0x810100, 0xc0000a3200, 0xc00015a000, 0xd21)
        /home/kris/mygo/pkg/mod/github.com/gravwell/[email protected]/read.go:214 +0x132
github.com/gravwell/gcfg.ReadStringInto(...)
        /home/kris/mygo/pkg/mod/github.com/gravwell/[email protected]/read.go:221
github.com/gravwell/gravwell/v3/ingest/config.LoadConfigBytes(0x715ea0, 0xc0000c2c60, 0xc000158000, 0xd21, 0x1e00, 0x0, 0x0)
        /home/kris/githubwork/gravwell/ingest/config/loader.go:80 +0xd5
github.com/gravwell/gravwell/v3/ingest/config.LoadConfigFile(0x715ea0, 0xc0000c2c60, 0x7ab041, 0x23, 0x0, 0x0)
        /home/kris/githubwork/gravwell/ingest/config/loader.go:70 +0x306
main.GetConfig(0x7ab041, 0x23, 0x1400, 0x7efbfd4ba400, 0x20300000000000)
        /home/kris/githubwork/gravwell/ingesters/SimpleRelay/config.go:77 +0x76
main.main()
        /home/kris/githubwork/gravwell/ingesters/SimpleRelay/main.go:81 +0x65                                                                               

Here is the config snippet that triggered it:

[Listener "sd"]
        Bind-String="0.0.0.0:8888"
        Tag-Name=sdtest4
        Ignore-Timestamps=true
        Preprocessor=cvesplit
        Preprocessor=ts

[Preprocessor "cvesplit"]
        Type=jsonarraysplit
        Extraction="cves"
        Passthrough-Misses=false
        Force-JSON-Object=true
        Additional-Fields="ip,last_seen"

[Preprocessor "ts"]
        Type=regextimestamp
        Regex=`"last_seen":\s*"(?P<timestamp>[^"]+)"`
        TS-Match-Name=timestamp

Input String Parsing: Misspelled section name string produces duplicate error messages

What are the steps to reproduce this issue?

  1. Modify gcfg/example_test.go 'profile "A"' to 'profileX "A"'
  2. Run self-test.

What happens?

    can't store data at section "profileX"
    can't store data into key "color" at section "profileX"
    can't store data at section "profileX"
    can't store data into key "color" at section "profileX"

What versions of software are you using?

Current v1, 9585638

Broken tests

These tests appear to be wrong, some of these integers CLEARLY shouldn't be accepted.

Whats up here? Is this just a bad test? Did we break these?

kris@box:~/githubwork/gcfg$ go test ./...
ok      github.com/gravwell/gcfg        0.007s
ok      github.com/gravwell/gcfg/scanner        0.001s
ok      github.com/gravwell/gcfg/token  0.008s
--- FAIL: TestParseInt (0.00s)
    int_test.go:63: ParseInt(int, "0", IntMode(Dec)): pass; got 0, error <nil>
    int_test.go:63: ParseInt(int, "10", IntMode(Dec)): pass; got 10, error <nil>
    int_test.go:63: ParseInt(int, "-10", IntMode(Dec)): pass; got -10, error <nil>
    int_test.go:63: ParseInt(int, "x", IntMode(Dec)): pass; got 0, error failed to parse "x" as int: expected integer
    int_test.go:63: ParseInt(int, "0xa", IntMode(Hex)): pass; got 10, error <nil>
    int_test.go:63: ParseInt(int, "a", IntMode(Hex)): pass; got 10, error <nil>
    int_test.go:63: ParseInt(int, "10", IntMode(Hex)): pass; got 16, error <nil>
    int_test.go:63: ParseInt(int, "-0xa", IntMode(Hex)): pass; got -10, error <nil>
    int_test.go:54: ParseInt(int, "0x", IntMode(Hex)): fail; got error failed to parse "0x" as int: strconv.ParseInt: parsing "0x": invalid syntax, want ok
    int_test.go:54: ParseInt(int, "-0x", IntMode(Hex)): fail; got error failed to parse "-0x" as int: strconv.ParseInt: parsing "-0x": invalid syntax, want ok
    int_test.go:63: ParseInt(int, "-a", IntMode(Hex)): pass; got -10, error <nil>
    int_test.go:63: ParseInt(int, "-10", IntMode(Hex)): pass; got -16, error <nil>
    int_test.go:63: ParseInt(int, "x", IntMode(Hex)): pass; got 0, error failed to parse "x" as int: expected integer
    int_test.go:63: ParseInt(int, "10", IntMode(Oct)): pass; got 8, error <nil>
    int_test.go:63: ParseInt(int, "010", IntMode(Oct)): pass; got 8, error <nil>
    int_test.go:63: ParseInt(int, "-10", IntMode(Oct)): pass; got -8, error <nil>
    int_test.go:63: ParseInt(int, "-010", IntMode(Oct)): pass; got -8, error <nil>
    int_test.go:63: ParseInt(int, "10", IntMode(Dec|Hex)): pass; got 10, error <nil>
    int_test.go:63: ParseInt(int, "010", IntMode(Dec|Hex)): pass; got 10, error <nil>
    int_test.go:63: ParseInt(int, "0x10", IntMode(Dec|Hex)): pass; got 16, error <nil>
    int_test.go:63: ParseInt(int, "10", IntMode(Dec|Oct)): pass; got 10, error <nil>
    int_test.go:63: ParseInt(int, "010", IntMode(Dec|Oct)): pass; got 8, error <nil>
    int_test.go:63: ParseInt(int, "0x10", IntMode(Dec|Oct)): pass; got 0, error failed to parse "0x10" as int: extra characters "x10"
    int_test.go:63: ParseInt(int, "10", IntMode(Hex|Oct)): pass; got 0, error ambiguous integer value; must include '0' prefix
    int_test.go:63: ParseInt(int, "010", IntMode(Hex|Oct)): pass; got 8, error <nil>
    int_test.go:63: ParseInt(int, "0x10", IntMode(Hex|Oct)): pass; got 16, error <nil>
    int_test.go:63: ParseInt(int, "10", IntMode(Dec|Hex|Oct)): pass; got 10, error <nil>
    int_test.go:63: ParseInt(int, "010", IntMode(Dec|Hex|Oct)): pass; got 8, error <nil>
    int_test.go:63: ParseInt(int, "0x10", IntMode(Dec|Hex|Oct)): pass; got 16, error <nil>
--- FAIL: TestScanFully (0.00s)
    scan_test.go:32: ScanFully(*int, "a", 'v') = failed to parse "a" as int: expected integer; *ptr==0
    scan_test.go:23: ScanFully(*int, "0x", 'v'): want ok, got error failed to parse "0x" as int: strconv.ParseInt: parsing "0x": invalid syntax
    scan_test.go:32: ScanFully(*int, "0x", 'd') = failed to parse "0x" as int: extra characters "x"; *ptr==0
FAIL
FAIL    github.com/gravwell/gcfg/types  0.002s
FAIL

unprintable characters and alternate quotes

Figure out how to identify unprintable characters or when the alternate quotes are used

we have seen a FEW times where OSX users copy something, OSX automatically changes double quotes and single quotes to the unicode garbage and then configs break.

So we need to somehow do the following

errors suck when a bad key is put into a config block

What are the steps to reproduce this issue?

  1. stick something like Foobar=stuff in s3.conf for the S3 ingester

What happens?

you get the error

failed to get configuration Config file "/tmp/s3/s3.conf" returned error warning:                                                                                                                                                                                                
can't store data at section "Bucket", subsection "default"

What were you expecting to happen?

"Cannot store "Foobar" into section Bucket, subsection default.

Any other comments?

we have the key value, the error should include it.

What versions of software are you using?

5.1.2-4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.