suricata
log-httplog.c File Reference
#include "suricata-common.h"
#include "debug.h"
#include "detect.h"
#include "pkt-var.h"
#include "conf.h"
#include "threads.h"
#include "threadvars.h"
#include "tm-threads.h"
#include "util-print.h"
#include "util-unittest.h"
#include "util-debug.h"
#include "output.h"
#include "log-httplog.h"
#include "app-layer-htp.h"
#include "app-layer.h"
#include "app-layer-parser.h"
#include "util-privs.h"
#include "util-buffer.h"
#include "util-logopenfile.h"
#include "util-time.h"
#include "log-cf-common.h"
Include dependency graph for log-httplog.c:

Go to the source code of this file.

Data Structures

struct  LogHttpFileCtx_
 
struct  LogHttpLogThread_
 

Macros

#define DEFAULT_LOG_FILENAME   "http.log"
 
#define MODULE_NAME   "LogHttpLog"
 
#define OUTPUT_BUFFER_SIZE   65535
 
#define LOG_HTTP_CF_REQUEST_HOST   'h'
 
#define LOG_HTTP_CF_REQUEST_PROTOCOL   'H'
 
#define LOG_HTTP_CF_REQUEST_METHOD   'm'
 
#define LOG_HTTP_CF_REQUEST_URI   'u'
 
#define LOG_HTTP_CF_REQUEST_TIME   't'
 
#define LOG_HTTP_CF_REQUEST_HEADER   'i'
 
#define LOG_HTTP_CF_REQUEST_COOKIE   'C'
 
#define LOG_HTTP_CF_REQUEST_LEN   'b'
 
#define LOG_HTTP_CF_RESPONSE_STATUS   's'
 
#define LOG_HTTP_CF_RESPONSE_HEADER   'o'
 
#define LOG_HTTP_CF_RESPONSE_LEN   'B'
 
#define LOG_HTTP_DEFAULT   0
 
#define LOG_HTTP_EXTENDED   1
 
#define LOG_HTTP_CUSTOM   2
 

Typedefs

typedef struct LogHttpFileCtx_ LogHttpFileCtx
 
typedef struct LogHttpLogThread_ LogHttpLogThread
 

Functions

TmEcode LogHttpLogThreadInit (ThreadVars *, const void *, void **)
 
TmEcode LogHttpLogThreadDeinit (ThreadVars *, void *)
 
int LogHttpLogger (ThreadVars *tv, void *thread_data, const Packet *, Flow *f, void *state, void *tx, uint64_t tx_id)
 
void LogHttpLogRegister (void)
 
OutputInitResult LogHttpLogInitCtx (ConfNode *conf)
 Create a new http log LogFileCtx. More...
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t
Ignacio Sanchez sanch.nosp@m.ezma.nosp@m.rtin..nosp@m.ji@g.nosp@m.mail..nosp@m.com

Implements http logging portion of the engine.

Definition in file log-httplog.c.

Macro Definition Documentation

#define DEFAULT_LOG_FILENAME   "http.log"

Definition at line 54 of file log-httplog.c.

Referenced by LogHttpLogInitCtx().

#define LOG_HTTP_CF_REQUEST_COOKIE   'C'

Definition at line 79 of file log-httplog.c.

#define LOG_HTTP_CF_REQUEST_HEADER   'i'

Definition at line 78 of file log-httplog.c.

#define LOG_HTTP_CF_REQUEST_HOST   'h'

Definition at line 73 of file log-httplog.c.

#define LOG_HTTP_CF_REQUEST_LEN   'b'

Definition at line 80 of file log-httplog.c.

#define LOG_HTTP_CF_REQUEST_METHOD   'm'

Definition at line 75 of file log-httplog.c.

#define LOG_HTTP_CF_REQUEST_PROTOCOL   'H'

Definition at line 74 of file log-httplog.c.

#define LOG_HTTP_CF_REQUEST_TIME   't'

Definition at line 77 of file log-httplog.c.

#define LOG_HTTP_CF_REQUEST_URI   'u'

Definition at line 76 of file log-httplog.c.

#define LOG_HTTP_CF_RESPONSE_HEADER   'o'

Definition at line 82 of file log-httplog.c.

#define LOG_HTTP_CF_RESPONSE_LEN   'B'

Definition at line 83 of file log-httplog.c.

#define LOG_HTTP_CF_RESPONSE_STATUS   's'

Definition at line 81 of file log-httplog.c.

#define LOG_HTTP_CUSTOM   2

Definition at line 94 of file log-httplog.c.

Referenced by LogHttpLogInitCtx().

#define LOG_HTTP_DEFAULT   0

Definition at line 92 of file log-httplog.c.

Referenced by LogHttpLogInitCtx().

#define LOG_HTTP_EXTENDED   1

Definition at line 93 of file log-httplog.c.

Referenced by LogHttpLogInitCtx().

#define MODULE_NAME   "LogHttpLog"

Definition at line 56 of file log-httplog.c.

Referenced by LogHttpLogRegister().

#define OUTPUT_BUFFER_SIZE   65535

Definition at line 58 of file log-httplog.c.

Referenced by LogHttpLogThreadInit(), and OutputJsonRegister().

Typedef Documentation

Function Documentation

int LogHttpLogger ( ThreadVars tv,
void *  thread_data,
const Packet p,
Flow f,
void *  state,
void *  tx,
uint64_t  tx_id 
)

Definition at line 488 of file log-httplog.c.

References PKT_IS_IPV4, PKT_IS_IPV6, PKT_IS_TCP, SCEnter, SCReturnInt, and TM_ECODE_OK.

Referenced by LogHttpLogRegister().

Here is the caller graph for this function:

OutputInitResult LogHttpLogInitCtx ( ConfNode conf)

Create a new http log LogFileCtx.

Parameters
confPointer to ConfNode containing this loggers configuration.
Returns
NULL if failure, LogFileCtx* to the file_ctx if succesful

Definition at line 552 of file log-httplog.c.

References ALPROTO_HTTP, AppLayerParserRegisterLogger(), LogHttpFileCtx_::cf, ConfNodeLookupChildValue(), ConfValIsTrue(), OutputInitResult_::ctx, OutputCtx_::data, DEFAULT_LOG_FILENAME, OutputCtx_::DeInit, LogHttpFileCtx_::file_ctx, LogHttpFileCtx_::flags, LOG_HTTP_CUSTOM, LOG_HTTP_DEFAULT, LOG_HTTP_EXTENDED, LogCustomFormatAlloc(), LogCustomFormatFree(), LogCustomFormatParse(), LogFileFreeCtx(), LogFileNewCtx(), OutputInitResult_::ok, SC_ERR_HTTP_LOG_GENERIC, SC_ERR_INVALID_ARGUMENT, SCCalloc, SCConfLogOpenGeneric(), SCFree, SCLogDebug, SCLogError, SCMalloc, and unlikely.

Referenced by LogHttpLogRegister().

Here is the call graph for this function:

Here is the caller graph for this function:

void LogHttpLogRegister ( void  )

Definition at line 66 of file log-httplog.c.

References ALPROTO_HTTP, LOGGER_HTTP, LogHttpLogger(), LogHttpLogInitCtx(), LogHttpLogThreadDeinit(), LogHttpLogThreadInit(), MODULE_NAME, and OutputRegisterTxModule().

Referenced by OutputRegisterLoggers().

Here is the call graph for this function:

Here is the caller graph for this function:

TmEcode LogHttpLogThreadDeinit ( ThreadVars t,
void *  data 
)

Definition at line 533 of file log-httplog.c.

References LogHttpLogThread_::buffer, MemBufferFree(), SCFree, and TM_ECODE_OK.

Referenced by LogHttpLogRegister().

Here is the call graph for this function:

Here is the caller graph for this function:

TmEcode LogHttpLogThreadInit ( ThreadVars t,
const void *  initdata,
void **  data 
)

Definition at line 506 of file log-httplog.c.

References LogHttpLogThread_::buffer, LogHttpLogThread_::httplog_ctx, MemBufferCreateNew(), OUTPUT_BUFFER_SIZE, SCFree, SCLogDebug, SCMalloc, TM_ECODE_FAILED, TM_ECODE_OK, and unlikely.

Referenced by LogHttpLogRegister().

Here is the call graph for this function:

Here is the caller graph for this function: