public class WebServerAccessLogImpl
extends java.lang.Object
implements org.torproject.descriptor.WebServerAccessLog
Defines sanitization and validation for web server access logs.
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
filenamePattern
The mandatory web server log descriptor file name pattern.
|
static java.lang.String |
MARKER
The log's name should include this string.
|
static java.lang.String |
SEP
Logfile name parts separator.
|
Modifier | Constructor and Description |
---|---|
protected |
WebServerAccessLogImpl(byte[] logBytes,
java.io.File descriptorFile,
java.lang.String logName)
Creates a WebServerAccessLog from the given bytes and filename.
|
protected |
WebServerAccessLogImpl(java.lang.String virtualHost,
java.lang.String physicalHost,
java.time.LocalDate logDate)
Creates an empty WebServerAccessLog from the given filename parts.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
decompressedByteStream() |
java.util.List<java.lang.String> |
getAnnotations() |
java.lang.String |
getCompressionType() |
java.io.File |
getDescriptorFile() |
java.time.LocalDate |
getLogDate() |
java.lang.String |
getPhysicalHost() |
byte[] |
getRawDescriptorBytes() |
int |
getRawDescriptorLength() |
java.util.List<java.lang.String> |
getUnrecognizedLines() |
java.lang.String |
getVirtualHost() |
java.util.stream.Stream<org.torproject.descriptor.WebServerAccessLog.Line> |
logLines()
Returns a stream of all valid log lines.
|
void |
setRawDescriptorBytes(byte[] bytes) |
public static final java.lang.String SEP
public static final java.lang.String MARKER
public static final java.util.regex.Pattern filenamePattern
protected WebServerAccessLogImpl(byte[] logBytes, java.io.File descriptorFile, java.lang.String logName) throws org.torproject.descriptor.DescriptorParseException
The given bytes are read, whereas the file is not read.
The path of the given file has to be compliant to the following
naming pattern
<virtualHost>-<physicalHost>-access.log-<yyyymmdd>.<compression>
,
where an unknown compression type (see getCompressionType()
)
is interpreted as missing compression. In this case the bytes
will be compressed to the default compression type.
The immediate parent name is taken to be the physical host collecting the
logs.
org.torproject.descriptor.DescriptorParseException
protected WebServerAccessLogImpl(java.lang.String virtualHost, java.lang.String physicalHost, java.time.LocalDate logDate)
This instance is not intended to be written to disk, as it doesn't have any content. The main intention of this instance is to compute storage paths.
virtualHost
- Virtual host name.physicalHost
- Physical host name.logDate
- Log date.public java.io.InputStream decompressedByteStream() throws org.torproject.descriptor.DescriptorParseException
decompressedByteStream
in interface org.torproject.descriptor.LogDescriptor
org.torproject.descriptor.DescriptorParseException
public java.lang.String getCompressionType()
public byte[] getRawDescriptorBytes()
getRawDescriptorBytes
in interface org.torproject.descriptor.Descriptor
getRawDescriptorBytes
in interface org.torproject.descriptor.LogDescriptor
public void setRawDescriptorBytes(byte[] bytes)
public int getRawDescriptorLength()
getRawDescriptorLength
in interface org.torproject.descriptor.Descriptor
public java.util.List<java.lang.String> getAnnotations()
getAnnotations
in interface org.torproject.descriptor.Descriptor
getAnnotations
in interface org.torproject.descriptor.LogDescriptor
public java.util.List<java.lang.String> getUnrecognizedLines()
getUnrecognizedLines
in interface org.torproject.descriptor.Descriptor
getUnrecognizedLines
in interface org.torproject.descriptor.LogDescriptor
getUnrecognizedLines
in interface org.torproject.descriptor.WebServerAccessLog
public java.io.File getDescriptorFile()
getDescriptorFile
in interface org.torproject.descriptor.Descriptor
public java.lang.String getPhysicalHost()
getPhysicalHost
in interface org.torproject.descriptor.WebServerAccessLog
public java.lang.String getVirtualHost()
getVirtualHost
in interface org.torproject.descriptor.WebServerAccessLog
public java.time.LocalDate getLogDate()
getLogDate
in interface org.torproject.descriptor.WebServerAccessLog
public java.util.stream.Stream<org.torproject.descriptor.WebServerAccessLog.Line> logLines() throws org.torproject.descriptor.DescriptorParseException
logLines
in interface org.torproject.descriptor.LogDescriptor
logLines
in interface org.torproject.descriptor.WebServerAccessLog
org.torproject.descriptor.DescriptorParseException