Skip to content

Commit

Permalink
wildcard expansion for multiple files in config
Browse files Browse the repository at this point in the history
  • Loading branch information
RJ committed Jul 6, 2012
1 parent 1c249ee commit 796da2b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
28 changes: 23 additions & 5 deletions README.md
@@ -1,10 +1,28 @@
## logtail
## logtail: tail -f logfiles in the browser with websockets

NB: incomplete hack!

tail -f logfiles in browser using websockets
*NB: incomplete hack!*

### How to build and run
```
$ rebar get-deps
$ ./start-dev.sh
```

Now visit http://localhost:9090/index.html

(still need to make cowboy treat / as /index.html)

### Configuration

Add entries to the sources section in app.config:

*Single file*
```
{file, "/path/to/file.log", []}
```

*Multiple files, wildcard expansion*
```
{files, "/var/log/*", []}
```

http://localhost:9090/index.html (still need to make cowboy treat / as /index.html)
4 changes: 4 additions & 0 deletions priv/index.html
Expand Up @@ -134,6 +134,10 @@
padding: 1em;
}

div.source {
font-weight: bold;
}

@media screen
{
body>div#fixedbox
Expand Down
13 changes: 12 additions & 1 deletion src/logtail_mgr.erl
Expand Up @@ -165,4 +165,15 @@ start_tailer({file, Path, Opts}) when is_list(Path), is_list(Opts) ->
_ ->
lager:info("starting tailer for {file, ~s}", [Path]),
supervisor:start_child(logtail_tailer_sup, [{file, Path, Opts}])
end.
end;

start_tailer({files, Path}) ->
start_tailer({files, Path, []});

start_tailer({files, Path, Opts}) when is_list(Path), is_list(Opts) ->
lists:foreach(fun(P) ->
start_tailer({file, P, Opts})
end, filelib:wildcard(Path)).



0 comments on commit 796da2b

Please sign in to comment.