Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some minor fixes #3

Merged
merged 4 commits into from
Jun 2, 2023
Merged
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
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
# Flog

[![go report card](https://goreportcard.com/badge/github.com/mingrammer/flog)](https://goreportcard.com/report/github.com/mingrammer/flog) [![travis ci](https://travis-ci.com/mingrammer/flog.svg?branch=master)](https://travis-ci.com/mingrammer/flog) [![docker download](https://img.shields.io/docker/pulls/mingrammer/flog.svg)](https://hub.docker.com/r/mingrammer/flog)
[![go report card](https://goreportcard.com/badge/github.com/calyptia/flog)](https://goreportcard.com/report/github.com/calyptia/flog) [![docker download](https://img.shields.io/docker/pulls/calyptia/flog.svg)](https://hub.docker.com/r/calyptia/flog)

flog is a fake log generator for common log formats such as apache-common, apache error and RFC3164 syslog.

It is useful for testing some tasks which require log data like amazon kinesis log stream test.

> Thanks to [gofakeit](https://github.com/brianvoe/gofakeit) 😘
>
> And many thanks to [mingrammer](https://github.com/mingrammer/flog) for the original project 😘

## Installation

### Using go get

```bash
go get -u github.com/mingrammer/flog
go get -u github.com/calyptia/flog
```

It is recommended to also run `dep ensure` to make sure that the dependencies are in the correct versions.

### Using [homebrew](https://brew.sh)

```
brew tap mingrammer/flog
brew tap calyptia/flog
brew install flog
```

### Using .tar.gz archive

Download gzip file from [Github Releases](https://github.com/mingrammer/flog/releases/latest) according to your OS. Then, copy the unzipped executable to under system path.
Download gzip file from [Github Releases](https://github.com/calyptia/flog/releases/latest) according to your OS. Then, copy the unzipped executable to under system path.

### Using [docker](https://www.docker.com)

```
docker run -it --rm mingrammer/flog
docker run -it --rm calyptia/flog
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion flog.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Generate(option *Option) error {
start := time.Now()
log := ""
for i := 0; i < option.Rate; i++ {
log = NewLog(option.Format, created, option.Bytes)
log = NewLog(option.Format, time.Now(), option.Bytes)
_, _ = writer.Write([]byte(log + "\n"))
created = created.Add(interval)
}
Expand Down
4 changes: 2 additions & 2 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/spf13/pflag"
)

const version = "0.4.3"
const version = "0.5.0"
const usage = `flog is a fake log generator for common log formats

Usage: flog [options]
Expand Down Expand Up @@ -170,7 +170,7 @@ func ParseOptions() *Option {
number := pflag.IntP("number", "n", opts.Number, "Number of lines to generate")
bytes := pflag.IntP("bytes", "b", opts.Bytes, "Size of log records to generate in bytes (default 512)")
sleepString := pflag.StringP("sleep", "s", "0s", "Creation time interval (default unit: seconds)")
rate := pflag.IntP("rate", "r", opts.Number, "Logs per second")
rate := pflag.IntP("rate", "r", opts.Rate, "Logs per second")
splitBy := pflag.IntP("split", "p", opts.SplitBy, "Maximum number of lines or size of a log file")
overwrite := pflag.BoolP("overwrite", "w", false, "Overwrite the existing log files")
forever := pflag.BoolP("loop", "l", false, "Loop output forever until killed")
Expand Down