suricata
log-httplog.c File Reference
#include "suricata-common.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

◆ DEFAULT_LOG_FILENAME

#define DEFAULT_LOG_FILENAME   "http.log"

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

◆ LOG_HTTP_CF_REQUEST_COOKIE

#define LOG_HTTP_CF_REQUEST_COOKIE   'C'

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

◆ LOG_HTTP_CF_REQUEST_HEADER

#define LOG_HTTP_CF_REQUEST_HEADER   'i'

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

◆ LOG_HTTP_CF_REQUEST_HOST

#define LOG_HTTP_CF_REQUEST_HOST   'h'

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

◆ LOG_HTTP_CF_REQUEST_LEN

#define LOG_HTTP_CF_REQUEST_LEN   'b'

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

◆ LOG_HTTP_CF_REQUEST_METHOD

#define LOG_HTTP_CF_REQUEST_METHOD   'm'

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

◆ LOG_HTTP_CF_REQUEST_PROTOCOL

#define LOG_HTTP_CF_REQUEST_PROTOCOL   'H'

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

◆ LOG_HTTP_CF_REQUEST_TIME

#define LOG_HTTP_CF_REQUEST_TIME   't'

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

◆ LOG_HTTP_CF_REQUEST_URI

#define LOG_HTTP_CF_REQUEST_URI   'u'

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

◆ LOG_HTTP_CF_RESPONSE_HEADER

#define LOG_HTTP_CF_RESPONSE_HEADER   'o'

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

◆ LOG_HTTP_CF_RESPONSE_LEN

#define LOG_HTTP_CF_RESPONSE_LEN   'B'

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

◆ LOG_HTTP_CF_RESPONSE_STATUS

#define LOG_HTTP_CF_RESPONSE_STATUS   's'

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

◆ LOG_HTTP_CUSTOM

#define LOG_HTTP_CUSTOM   2

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

◆ LOG_HTTP_DEFAULT

#define LOG_HTTP_DEFAULT   0

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

◆ LOG_HTTP_EXTENDED

#define LOG_HTTP_EXTENDED   1

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

◆ MODULE_NAME

#define MODULE_NAME   "LogHttpLog"

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

◆ OUTPUT_BUFFER_SIZE

#define OUTPUT_BUFFER_SIZE   65535

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

Typedef Documentation

◆ LogHttpFileCtx

◆ LogHttpLogThread

Function Documentation

◆ LogHttpLogger()

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

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

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

Referenced by LogHttpLogRegister().

Here is the caller graph for this function:

◆ LogHttpLogInitCtx()

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 549 of file log-httplog.c.

References LogHttpFileCtx_::cf, ConfNodeLookupChildValue(), ConfValIsTrue(), OutputCtx_::data, DEFAULT_LOG_FILENAME, OutputCtx_::DeInit, LogHttpFileCtx_::file_ctx, LogHttpFileCtx_::flags, LOG_HTTP_CUSTOM, LOG_HTTP_DEFAULT, LOG_HTTP_EXTENDED, LogCustomFormatAlloc(), LogCustomFormatParse(), LogFileFreeCtx(), LogFileNewCtx(), SCCalloc, SCConfLogOpenGeneric(), SCLogError, and unlikely.

Referenced by LogHttpLogRegister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LogHttpLogRegister()

void LogHttpLogRegister ( void  )

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

References ALPROTO_HTTP1, 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:

◆ LogHttpLogThreadDeinit()

TmEcode LogHttpLogThreadDeinit ( ThreadVars t,
void *  data 
)

Definition at line 530 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:

◆ LogHttpLogThreadInit()

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

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

References LogHttpLogThread_::buffer, LogHttpLogThread_::httplog_ctx, MemBufferCreateNew(), OUTPUT_BUFFER_SIZE, SCCalloc, SCFree, SCLogDebug, 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: