Comments (1)
Here is an example failing test (I modified the first test in the nginx_test.go file):
func TestProcessLines(t *testing.T) {
t1, _ := time.ParseInLocation(commonLogFormatTimeLayout, "08/Oct/2015:00:26:26 -0000", time.UTC)
preReg := &parsers.ExtRegexp{regexp.MustCompile("^.*:..:.. (?P<pre_hostname>[a-zA-Z-.]+): ")}
tlm := []testLineMaps{
{
line: "Nov 05 10:23:45 myhost: https - 10.252.4.24 - - [08/Oct/2015:00:26:26 +0000] 200 174 0.099 a873d74c-4588-4a25-b3ed-77d23fe6275a 17d22fa7-796e-85f6-3d58-2d6e693da860",
trimmedLine: "https - 10.252.4.24 - - [08/Oct/2015:00:26:26 +0000] 200 174 0.099 a873d74c-4588-4a25-b3ed-77d23fe6275a 17d22fa7-796e-85f6-3d58-2d6e693da860",
ev: event.Event{
Timestamp: t1,
Data: map[string]interface{}{
"pre_hostname": "myhost",
"body_bytes_sent": int64(174),
"http_x_forwarded_proto": "https",
"remote_addr": "10.252.4.24",
"request_time": 0.099,
"status": int64(200),
"traceId": "a873d74c-4588-4a25-b3ed-77d23fe6275a",
"id": "17d22fa7-796e-85f6-3d58-2d6e693da860",
},
},
},
}
p := &Parser{
conf: Options{
NumParsers: 5,
},
lineParser: &GonxLineParser{
parser: gonx.NewParser("$http_x_forwarded_proto - $remote_addr - $remote_user [$time_local] $status $body_bytes_sent $request_time $traceId $id"),
},
}
lines := make(chan string)
send := make(chan event.Event)
go func() {
for _, pair := range tlm {
lines <- pair.line
}
close(lines)
}()
go p.ProcessLines(lines, send, preReg)
for _, pair := range tlm {
resp := <-send
if !reflect.DeepEqual(resp, pair.ev) {
t.Fatalf("line resp didn't match up for %s. Expected: %+v, actual: %+v",
pair.line, pair.ev, resp)
}
}
}
from honeytail.
Related Issues (20)
- Add Alpine support HOT 1
- Support for specifying a date for timestamps. HOT 1
- Issue with Honeytail not parsing through Arangodb logs HOT 3
- mysql queries that include the word timestamp break parser HOT 3
- Honeytail 1.4.1 only supports a single value for AddFields in .conf HOT 9
- Update to cimg/go image and go 1.16.x HOT 1
- API key is leaked via process tree HOT 1
- Mention config file as an option in the docs HOT 1
- Update go to 1.18beta HOT 1
- GetTimestamp says it deletes the time value it returns, but not if it's already a time.Time HOT 1
- GetTimestamp might delete a field that isn't a timestamp
- patch openSSL CVE
- honeytail container image on Docker hub HOT 2
- postgres parser reports `duration` not `duration_ms`
- Remove dependency on mongodbtools
- It's not possible to specify multi-valued fields (slices) in a .ini file HOT 1
- Ability to perform health checks on honeytail container HOT 3
- Honeytail nginx parser doesn't recognize log_format defined in included config. HOT 3
- NGINX log format with escape parameter not matching
- allow disabling logs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from honeytail.