Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
L
logstash-forwarder
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
LaaS
logstash-forwarder
Commits
3c13718a
Commit
3c13718a
authored
Jul 02, 2013
by
Jordan Sissel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
account for the newline as well
parent
5b970578
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
registrar.go
registrar.go
+4
-2
No files found.
registrar.go
View file @
3c13718a
...
...
@@ -13,6 +13,7 @@ func Registrar(input chan []*FileEvent) {
log
.
Printf
(
"Registrar received %d events
\n
"
,
len
(
events
))
// Take the last event found for each file source
for
_
,
event
:=
range
events
{
// skip stdin
if
*
event
.
Source
==
"-"
{
continue
}
...
...
@@ -22,7 +23,9 @@ func Registrar(input chan []*FileEvent) {
fstat
:=
(
*
(
event
.
fileinfo
))
.
Sys
()
.
(
*
syscall
.
Stat_t
)
state
[
*
event
.
Source
]
=
&
FileState
{
Source
:
event
.
Source
,
Offset
:
event
.
Offset
+
uint64
(
len
(
*
event
.
Text
)),
// take the offset + length of the line + newline char and
// save it as the new starting offset.
Offset
:
event
.
Offset
+
int64
(
len
(
*
event
.
Text
))
+
1
,
Inode
:
fstat
.
Ino
,
Device
:
fstat
.
Dev
,
}
...
...
@@ -37,7 +40,6 @@ func Registrar(input chan []*FileEvent) {
func
write
(
state
map
[
string
]
*
FileState
)
{
log
.
Printf
(
"Saving registrar state.
\n
"
)
// Open tmp file, write, flush, rename
file
,
err
:=
os
.
Create
(
".lumberjack.new"
)
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment