Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trackrdrd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
trackrdrd
Commits
b123a280
Commit
b123a280
authored
Sep 23, 2012
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trackrdrd: added usage and README
parent
04bee061
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
19 deletions
+109
-19
README.rst
trackrdrd/README.rst
+32
-0
options.txt
trackrdrd/options.txt
+27
-0
Makefile.am
trackrdrd/src/Makefile.am
+24
-3
trackrdrd.c
trackrdrd/src/trackrdrd.c
+24
-16
synopsis.txt
trackrdrd/synopsis.txt
+2
-0
No files found.
trackrdrd/README.rst
View file @
b123a280
.. _ref-varnishd:
==========
trackrdrd
==========
-------------------------
Tracking Log Reader demon
-------------------------
:Author: Geoffrey Simmons
:Date: 2012-09-23
:Version: 0.1
:Manual section: 3
SYNOPSIS
========
.. include:: synopsis.txt
DESCRIPTION
===========
The trackrdrd demon reads from the shared memory log of a running
instance of Varnish and collects data relevant to tracking for the
Otto project.
OPTIONS
=======
.. include:: options.txt
trackrdrd/options.txt
0 → 100644
View file @
b123a280
-n varnish_logfile
The 'varnish name' indicating the mmap'd log file used by
varnishd. By default, the host name is assumed (as with
varnishd).
-l log_file
Log file for status, warning, debug and error messages. If '-'
is specified, then log messages are written to stdout. By
default, syslog(3) is used for logging. Log levels correspond
to the 'priorities' defined by syslog(3).
-f varnishlog_bindump
A binary dump of the Varnish SHM log produced by 'varnishlog
-w'. If this option is specified, trackrdrd reads from the
dump instead of a live SHM log (useful for debugging and
replaying traffic). The options -f and -n are mutually
exclusive; -n is the default.
-d
Sets the log level to LOG_DEBUG. The default log level is
LOG_INFO.
-V
Print version and exit
-h
Print usage and exit
trackrdrd/src/Makefile.am
View file @
b123a280
...
@@ -2,7 +2,7 @@ INCLUDES = -I$(VARNISHSRC)/include -I$(VARNISHSRC)
...
@@ -2,7 +2,7 @@ INCLUDES = -I$(VARNISHSRC)/include -I$(VARNISHSRC)
bin_PROGRAMS
=
trackrdrd
bin_PROGRAMS
=
trackrdrd
nodist_trackrdrd_SOURCES
=
revision.h
nodist_trackrdrd_SOURCES
=
revision.h
usage.h
trackrdrd_SOURCES
=
\
trackrdrd_SOURCES
=
\
trackrdrd.h
\
trackrdrd.h
\
...
@@ -20,10 +20,11 @@ check:
...
@@ -20,10 +20,11 @@ check:
test
/regress.sh
test
/regress.sh
BUILT_SOURCES
=
revision.h usage.h
MAINTAINERCLEANFILES
=
revision.h usage.h
# Derive a revision name from the git commit
# Derive a revision name from the git commit
# Adopted from Varnish include/Makefile.am
# Adopted from Varnish include/Makefile.am
BUILT_SOURCES
=
revision.h
MAINTAINERCLEANFILES
=
revision.h
revision.h
:
FORCE
revision.h
:
FORCE
@
if
[
-d
"
$(top_srcdir)
/../.git"
]
;
then
\
@
if
[
-d
"
$(top_srcdir)
/../.git"
]
;
then
\
V
=
"
$$
(git show -s --pretty=format:%h)"
\
V
=
"
$$
(git show -s --pretty=format:%h)"
\
...
@@ -51,4 +52,24 @@ revision.h: FORCE
...
@@ -51,4 +52,24 @@ revision.h: FORCE
)
>
revision.h
;
\
)
>
revision.h
;
\
fi
\
fi
\
fi
fi
usage.h
:
$(top_srcdir)/synopsis.txt $(top_srcdir)/options.txt
(
\
echo
'/*'
;
\
echo
' * NB: This file is machine generated, DO NOT EDIT!'
;
\
echo
' *'
;
\
echo
' * Run make to regenerate'
;
\
echo
' *'
;
\
echo
' */'
;
\
echo
''
;
\
echo
'const char *synopsis = '
\
)
>
usage.h
sed
-e
's/.*/\"&\\n\"/'
$(top_srcdir)
/synopsis.txt
>>
usage.h
(
\
echo
';'
;
\
echo
'const char *options = '
\
)
>>
usage.h
sed
-e
's/.*/\"&\\n\"/'
$(top_srcdir)
/options.txt
>>
usage.h
echo
';'
>>
usage.h
FORCE
:
FORCE
:
\ No newline at end of file
trackrdrd/src/trackrdrd.c
View file @
b123a280
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
#include "trackrdrd.h"
#include "trackrdrd.h"
#include "revision.h"
#include "revision.h"
#include "usage.h"
#define TRACK_TAGS "ReqStart,VCL_log,ReqEnd"
#define TRACK_TAGS "ReqStart,VCL_log,ReqEnd"
#define TRACKLOG_PREFIX "track "
#define TRACKLOG_PREFIX "track "
...
@@ -179,11 +180,10 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
...
@@ -179,11 +180,10 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static
void
static
void
usage
(
void
)
usage
(
int
status
)
{
{
fprintf
(
stderr
,
"usage: varnishlog "
fprintf
(
stderr
,
"Usage:
\n
%s
\n
%s
\n
"
,
synopsis
,
options
);
"%s [-aDV] [-o [tag regex]] [-n varnish_name] [-P file] [-w file]
\n
"
,
VSL_USAGE
);
exit
(
status
);
exit
(
1
);
}
}
int
int
...
@@ -191,7 +191,7 @@ main(int argc, char * const *argv)
...
@@ -191,7 +191,7 @@ main(int argc, char * const *argv)
{
{
int
c
;
int
c
;
int
D_flag
=
0
,
d_flag
=
0
;
int
D_flag
=
0
,
d_flag
=
0
;
const
char
*
P_arg
=
NULL
,
*
l_arg
=
NULL
;
const
char
*
P_arg
=
NULL
,
*
l_arg
=
NULL
,
*
n_arg
=
NULL
,
*
f_arg
=
NULL
;
struct
vpf_fh
*
pfh
=
NULL
;
struct
vpf_fh
*
pfh
=
NULL
;
struct
VSM_data
*
vd
;
struct
VSM_data
*
vd
;
...
@@ -208,10 +208,10 @@ main(int argc, char * const *argv)
...
@@ -208,10 +208,10 @@ main(int argc, char * const *argv)
break
;
break
;
case
'V'
:
case
'V'
:
printf
(
PACKAGE_STRING
" revision "
REVISION
"
\n
"
);
printf
(
PACKAGE_STRING
" revision "
REVISION
"
\n
"
);
exit
(
0
);
exit
(
EXIT_SUCCESS
);
case
'n'
:
case
'n'
:
if
(
VSL_Arg
(
vd
,
c
,
optarg
)
<=
0
)
n_arg
=
optarg
;
exit
(
1
)
;
break
;
case
'l'
:
case
'l'
:
l_arg
=
optarg
;
l_arg
=
optarg
;
break
;
break
;
...
@@ -219,21 +219,29 @@ main(int argc, char * const *argv)
...
@@ -219,21 +219,29 @@ main(int argc, char * const *argv)
d_flag
=
1
;
d_flag
=
1
;
break
;
break
;
case
'f'
:
case
'f'
:
if
(
VSL_Arg
(
vd
,
'r'
,
optarg
)
<=
0
)
f_arg
=
optarg
;
exit
(
1
);
break
;
break
;
case
'h'
:
case
'h'
:
usage
(
EXIT_SUCCESS
);
default:
default:
usage
();
usage
(
EXIT_FAILURE
);
}
}
}
}
if
((
argc
-
optind
)
>
0
)
if
((
argc
-
optind
)
>
0
)
usage
();
usage
(
EXIT_FAILURE
);
if
(
f_arg
&&
n_arg
)
usage
(
EXIT_FAILURE
);
if
(
f_arg
&&
VSL_Arg
(
vd
,
'r'
,
f_arg
)
<=
0
)
exit
(
EXIT_FAILURE
);
else
if
(
n_arg
&&
VSL_Arg
(
vd
,
'n'
,
n_arg
)
<=
0
)
exit
(
EXIT_FAILURE
);
if
(
LOG_Open
(
PACKAGE_NAME
,
l_arg
)
!=
0
)
{
if
(
LOG_Open
(
PACKAGE_NAME
,
l_arg
)
!=
0
)
{
perror
(
l_arg
);
perror
(
l_arg
);
exit
(
1
);
exit
(
EXIT_FAILURE
);
}
}
if
(
d_flag
)
if
(
d_flag
)
LOG_SetLevel
(
LOG_DEBUG
);
LOG_SetLevel
(
LOG_DEBUG
);
...
@@ -253,14 +261,14 @@ main(int argc, char * const *argv)
...
@@ -253,14 +261,14 @@ main(int argc, char * const *argv)
*/
*/
if
(
P_arg
&&
(
pfh
=
VPF_Open
(
P_arg
,
0644
,
NULL
))
==
NULL
)
{
if
(
P_arg
&&
(
pfh
=
VPF_Open
(
P_arg
,
0644
,
NULL
))
==
NULL
)
{
perror
(
P_arg
);
perror
(
P_arg
);
exit
(
1
);
exit
(
EXIT_FAILURE
);
}
}
if
(
pfh
!=
NULL
)
if
(
pfh
!=
NULL
)
VPF_Write
(
pfh
);
VPF_Write
(
pfh
);
/* XXX: child opens and reads VSL */
/* XXX: child opens and reads VSL */
if
(
VSL_Open
(
vd
,
1
))
if
(
VSL_Open
(
vd
,
1
))
exit
(
1
);
exit
(
EXIT_FAILURE
);
/* Only read the VSL tags relevant to tracking */
/* Only read the VSL tags relevant to tracking */
assert
(
VSL_Arg
(
vd
,
'i'
,
TRACK_TAGS
)
>
0
);
assert
(
VSL_Arg
(
vd
,
'i'
,
TRACK_TAGS
)
>
0
);
...
@@ -277,5 +285,5 @@ main(int argc, char * const *argv)
...
@@ -277,5 +285,5 @@ main(int argc, char * const *argv)
VPF_Remove
(
pfh
);
VPF_Remove
(
pfh
);
LOG_Log0
(
LOG_INFO
,
"exiting"
);
LOG_Log0
(
LOG_INFO
,
"exiting"
);
exit
(
0
);
exit
(
EXIT_SUCCESS
);
}
}
trackrdrd/synopsis.txt
0 → 100644
View file @
b123a280
trackrdrd [-n varnish_name] [-l log_file] [-f varnishlog_bindump]
[-d] [-V] [-h]
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