#include "logmsg/logmsg.h"#include "str-utils.h"#include "str-repr/encode.h"#include "messages.h"#include "logpipe.h"#include "timeutils/cache.h"#include "timeutils/misc.h"#include "logmsg/nvtable.h"#include "stats/stats-registry.h"#include "stats/stats-cluster-single.h"#include "template/templates.h"#include "tls-support.h"#include "compat/string.h"#include "rcptid.h"#include "template/macros.h"#include "host-id.h"#include "ack-tracker/ack_tracker.h"#include "apphook.h"#include "scratch-buffers.h"#include "str-format.h"#include <glib/gprintf.h>#include <sys/types.h>#include <time.h>#include <unistd.h>#include <stdlib.h>#include <ctype.h>#include <syslog.h>
Functions | |
| const gchar * | log_msg_value_type_to_str (LogMessageValueType self) |
| gboolean | log_msg_value_type_from_str (const gchar *in_str, LogMessageValueType *out_type) |
| void | log_msg_write_protect (LogMessage *self) |
| LogMessage * | log_msg_make_writable (LogMessage **pself, const LogPathOptions *path_options) |
| NVHandle | log_msg_get_value_handle (const gchar *value_name) |
| gboolean | log_msg_is_value_name_valid (const gchar *value) |
| const gchar * | log_msg_get_macro_value (const LogMessage *self, gint id, gssize *value_len, LogMessageValueType *type) |
| LogMessageQueueNode * | log_msg_alloc_queue_node (LogMessage *msg, const LogPathOptions *path_options) |
| LogMessageQueueNode * | log_msg_alloc_dynamic_queue_node (LogMessage *msg, const LogPathOptions *path_options) |
| void | log_msg_free_queue_node (LogMessageQueueNode *node) |
| void | log_msg_rename_value (LogMessage *self, NVHandle from, NVHandle to) |
| void | log_msg_set_value_with_type (LogMessage *self, NVHandle handle, const gchar *value, gssize value_len, LogMessageValueType type) |
| void | log_msg_set_value (LogMessage *self, NVHandle handle, const gchar *value, gssize value_len) |
| void | log_msg_unset_value (LogMessage *self, NVHandle handle) |
| void | log_msg_unset_value_by_name (LogMessage *self, const gchar *name) |
| void | log_msg_set_value_indirect_with_type (LogMessage *self, NVHandle handle, NVHandle ref_handle, guint16 ofs, guint16 len, LogMessageValueType type) |
| void | log_msg_set_value_indirect (LogMessage *self, NVHandle handle, NVHandle ref_handle, guint16 ofs, guint16 len) |
| gboolean | log_msg_values_foreach (const LogMessage *self, NVTableForeachFunc func, gpointer user_data) |
| NVHandle | log_msg_get_match_handle (gint index_) |
| gint | log_msg_get_match_index (NVHandle handle) |
| void | log_msg_set_match_with_type (LogMessage *self, gint index_, const gchar *value, gssize value_len, LogMessageValueType type) |
| void | log_msg_set_match (LogMessage *self, gint index_, const gchar *value, gssize value_len) |
| void | log_msg_set_match_indirect_with_type (LogMessage *self, gint index_, NVHandle ref_handle, guint16 ofs, guint16 len, LogMessageValueType type) |
| void | log_msg_set_match_indirect (LogMessage *self, gint index_, NVHandle ref_handle, guint16 ofs, guint16 len) |
| const gchar * | log_msg_get_match_if_set_with_type (const LogMessage *self, gint index_, gssize *value_len, LogMessageValueType *type) |
| const gchar * | log_msg_get_match_with_type (const LogMessage *self, gint index_, gssize *value_len, LogMessageValueType *type) |
| const gchar * | log_msg_get_match (const LogMessage *self, gint index_, gssize *value_len) |
| void | log_msg_unset_match (LogMessage *self, gint index_) |
| void | log_msg_truncate_matches (LogMessage *self, gint n) |
| void | log_msg_clear_matches (LogMessage *self) |
| void | log_msg_tags_foreach (const LogMessage *self, LogMessageTagsForeachFunc callback, gpointer user_data) |
| void | log_msg_set_tag_by_id_onoff (LogMessage *self, LogTagId id, gboolean on) |
| void | log_msg_set_tag_by_id (LogMessage *self, LogTagId id) |
| void | log_msg_set_tag_by_name (LogMessage *self, const gchar *name) |
| void | log_msg_clear_tag_by_id (LogMessage *self, LogTagId id) |
| void | log_msg_clear_tag_by_name (LogMessage *self, const gchar *name) |
| gboolean | log_msg_is_tag_by_id (LogMessage *self, LogTagId id) |
| gboolean | log_msg_is_tag_by_name (LogMessage *self, const gchar *name) |
| void | log_msg_append_format_sdata (const LogMessage *self, GString *result, guint32 seq_num) |
| void | log_msg_format_sdata (const LogMessage *self, GString *result, guint32 seq_num) |
| void | log_msg_clear_sdata (LogMessage *self) |
| gboolean | log_msg_append_tags_callback (const LogMessage *self, LogTagId tag_id, const gchar *name, gpointer user_data) |
| void | log_msg_format_tags (const LogMessage *self, GString *result, gboolean include_localtags) |
| void | log_msg_format_matches (const LogMessage *self, GString *result) |
| void | log_msg_set_saddr (LogMessage *self, GSockAddr *saddr) |
| void | log_msg_set_saddr_ref (LogMessage *self, GSockAddr *saddr) |
| void | log_msg_set_daddr (LogMessage *self, GSockAddr *daddr) |
| void | log_msg_set_daddr_ref (LogMessage *self, GSockAddr *daddr) |
| void | log_msg_clear (LogMessage *self) |
| void | log_msg_merge_context (LogMessage *self, LogMessage **context, gsize context_len) |
| LogMessage * | log_msg_clone_cow (LogMessage *msg, const LogPathOptions *path_options) |
| LogMessage * | log_msg_sized_new (gsize payload_size) |
| LogMessage * | log_msg_new_empty (void) |
| LogMessage * | log_msg_new_local (void) |
| LogMessage * | log_msg_new_internal (gint prio, const gchar *msg) |
| LogMessage * | log_msg_new_mark (void) |
| void | log_msg_drop (LogMessage *msg, const LogPathOptions *path_options, AckType ack_type) |
| LogMessage * | log_msg_ref (LogMessage *self) |
| void | log_msg_unref (LogMessage *self) |
| void | log_msg_add_ack (LogMessage *self, const LogPathOptions *path_options) |
| void | log_msg_ack (LogMessage *self, const LogPathOptions *path_options, AckType ack_type) |
| const LogPathOptions * | log_msg_break_ack (LogMessage *msg, const LogPathOptions *path_options, LogPathOptions *local_path_options) |
| void | log_msg_refcache_start_producer (LogMessage *self) |
| void | log_msg_refcache_start_consumer (LogMessage *self, const LogPathOptions *path_options) |
| void | log_msg_refcache_stop (void) |
| void | log_msg_tags_init (void) |
| void | log_msg_registry_init (void) |
| void | log_msg_registry_deinit (void) |
| void | log_msg_registry_foreach (GHFunc func, gpointer user_data) |
| void | log_msg_global_init (void) |
| const gchar * | log_msg_get_handle_name (NVHandle handle, gssize *length) |
| void | log_msg_global_deinit (void) |
| gint | log_msg_lookup_time_stamp_name (const gchar *name) |
| gssize | log_msg_get_size (LogMessage *self) |
Variables | |
| TLS_BLOCK_START | |
| gboolean | logmsg_cached_ack_needed |
| gint | logmsg_cached_refs |
| gint | logmsg_cached_acks |
| gboolean | logmsg_cached_abort |
| gboolean | logmsg_cached_suspend |
| TLS_BLOCK_END | |
| const gchar * | builtin_value_names [] |
| NVRegistry * | logmsg_registry |
| const char | logmsg_sd_prefix [] = ".SDATA." |
| const gint | logmsg_sd_prefix_len = sizeof(logmsg_sd_prefix) - 1 |
| gint | logmsg_queue_node_max = 1 |
| #define logmsg_cached_abort __slng_tls_deref(logmsg_cached_abort) |
| #define logmsg_cached_ack_needed __slng_tls_deref(logmsg_cached_ack_needed) |
| #define logmsg_cached_acks __slng_tls_deref(logmsg_cached_acks) |
| #define logmsg_cached_refs __slng_tls_deref(logmsg_cached_refs) |
| #define logmsg_cached_suspend __slng_tls_deref(logmsg_cached_suspend) |
| #define logmsg_current __slng_tls_deref(logmsg_current) |
| #define LOGMSG_REFCACHE_ABORT_MASK 0x40000000 /* bit mask to extract the ABORT flag */ |
| #define LOGMSG_REFCACHE_ABORT_SHIFT 30 /* number of bits to shift to get the ABORT flag */ |
| #define LOGMSG_REFCACHE_ABORT_TO_VALUE | ( | x | ) | (((x) << LOGMSG_REFCACHE_ABORT_SHIFT) & LOGMSG_REFCACHE_ABORT_MASK) |
| #define LOGMSG_REFCACHE_ACK_MASK 0x3FFF8000 /* bit mask to extract the ACK counter */ |
| #define LOGMSG_REFCACHE_ACK_SHIFT 15 /* number of bits to shift to get the ACK counter */ |
| #define LOGMSG_REFCACHE_ACK_TO_VALUE | ( | x | ) | (((x) << LOGMSG_REFCACHE_ACK_SHIFT) & LOGMSG_REFCACHE_ACK_MASK) |
| #define LOGMSG_REFCACHE_BIAS 0x00002000 /* the BIAS we add to the ref counter in refcache_start */ |
| #define LOGMSG_REFCACHE_REF_MASK 0x00007FFF /* bit mask to extract the ACK counter */ |
| #define LOGMSG_REFCACHE_REF_SHIFT 0 /* number of bits to shift to get the REF counter */ |
| #define LOGMSG_REFCACHE_REF_TO_VALUE | ( | x | ) | (((x) << LOGMSG_REFCACHE_REF_SHIFT) & LOGMSG_REFCACHE_REF_MASK) |
| #define LOGMSG_REFCACHE_SUSPEND_MASK 0x80000000 /* bit mask to extract the SUSPEND flag */ |
| #define LOGMSG_REFCACHE_SUSPEND_SHIFT 31 /* number of bits to shift to get the SUSPEND flag */ |
| #define LOGMSG_REFCACHE_SUSPEND_TO_VALUE | ( | x | ) | (((x) << LOGMSG_REFCACHE_SUSPEND_SHIFT) & LOGMSG_REFCACHE_SUSPEND_MASK) |
| #define LOGMSG_REFCACHE_VALUE_TO_ABORT | ( | x | ) | (((x) & LOGMSG_REFCACHE_ABORT_MASK) >> LOGMSG_REFCACHE_ABORT_SHIFT) |
| #define LOGMSG_REFCACHE_VALUE_TO_ACK | ( | x | ) | (((x) & LOGMSG_REFCACHE_ACK_MASK) >> LOGMSG_REFCACHE_ACK_SHIFT) |
| #define LOGMSG_REFCACHE_VALUE_TO_REF | ( | x | ) | (((x) & LOGMSG_REFCACHE_REF_MASK) >> LOGMSG_REFCACHE_REF_SHIFT) |
| #define LOGMSG_REFCACHE_VALUE_TO_SUSPEND | ( | x | ) | (((x) & LOGMSG_REFCACHE_SUSPEND_MASK) >> LOGMSG_REFCACHE_SUSPEND_SHIFT) |
| void log_msg_ack | ( | LogMessage * | self, |
| const LogPathOptions * | path_options, | ||
| AckType | ack_type | ||
| ) |
log_msg_ack: @msg: LogMessage instance @path_options: path specific options @acked: TRUE: positive ack, FALSE: negative ACK
Indicate that the message was processed successfully and the sender can queue further messages.
| void log_msg_add_ack | ( | LogMessage * | self, |
| const LogPathOptions * | path_options | ||
| ) |
log_msg_add_ack: @m: LogMessage instance
This function increments the number of required acknowledges.
| LogMessageQueueNode* log_msg_alloc_dynamic_queue_node | ( | LogMessage * | msg, |
| const LogPathOptions * | path_options | ||
| ) |
| LogMessageQueueNode* log_msg_alloc_queue_node | ( | LogMessage * | msg, |
| const LogPathOptions * | path_options | ||
| ) |
| void log_msg_append_format_sdata | ( | const LogMessage * | self, |
| GString * | result, | ||
| guint32 | seq_num | ||
| ) |
| gboolean log_msg_append_tags_callback | ( | const LogMessage * | self, |
| LogTagId | tag_id, | ||
| const gchar * | name, | ||
| gpointer | user_data | ||
| ) |
| const LogPathOptions* log_msg_break_ack | ( | LogMessage * | msg, |
| const LogPathOptions * | path_options, | ||
| LogPathOptions * | local_path_options | ||
| ) |
| void log_msg_clear | ( | LogMessage * | self | ) |
| void log_msg_clear_matches | ( | LogMessage * | self | ) |
| void log_msg_clear_sdata | ( | LogMessage * | self | ) |
| void log_msg_clear_tag_by_id | ( | LogMessage * | self, |
| LogTagId | id | ||
| ) |
| void log_msg_clear_tag_by_name | ( | LogMessage * | self, |
| const gchar * | name | ||
| ) |
| LogMessage* log_msg_clone_cow | ( | LogMessage * | msg, |
| const LogPathOptions * | path_options | ||
| ) |
| void log_msg_drop | ( | LogMessage * | msg, |
| const LogPathOptions * | path_options, | ||
| AckType | ack_type | ||
| ) |
log_msg_drop: @msg: LogMessage instance @path_options: path specific options
This function is called whenever a destination driver feels that it is unable to process this message. It acks and unrefs the message.
| void log_msg_format_matches | ( | const LogMessage * | self, |
| GString * | result | ||
| ) |
| void log_msg_format_sdata | ( | const LogMessage * | self, |
| GString * | result, | ||
| guint32 | seq_num | ||
| ) |
| void log_msg_format_tags | ( | const LogMessage * | self, |
| GString * | result, | ||
| gboolean | include_localtags | ||
| ) |
| void log_msg_free_queue_node | ( | LogMessageQueueNode * | node | ) |
| const gchar* log_msg_get_handle_name | ( | NVHandle | handle, |
| gssize * | length | ||
| ) |
| const gchar* log_msg_get_macro_value | ( | const LogMessage * | self, |
| gint | id, | ||
| gssize * | value_len, | ||
| LogMessageValueType * | type | ||
| ) |
| const gchar* log_msg_get_match | ( | const LogMessage * | self, |
| gint | index_, | ||
| gssize * | value_len | ||
| ) |
| NVHandle log_msg_get_match_handle | ( | gint | index_ | ) |
| const gchar* log_msg_get_match_if_set_with_type | ( | const LogMessage * | self, |
| gint | index_, | ||
| gssize * | value_len, | ||
| LogMessageValueType * | type | ||
| ) |
| gint log_msg_get_match_index | ( | NVHandle | handle | ) |
| const gchar * log_msg_get_match_with_type | ( | const LogMessage * | self, |
| gint | index_, | ||
| gssize * | value_len, | ||
| LogMessageValueType * | type | ||
| ) |
| gssize log_msg_get_size | ( | LogMessage * | self | ) |
| NVHandle log_msg_get_value_handle | ( | const gchar * | value_name | ) |
| void log_msg_global_deinit | ( | void | ) |
| void log_msg_global_init | ( | void | ) |
| gboolean log_msg_is_tag_by_id | ( | LogMessage * | self, |
| LogTagId | id | ||
| ) |
| gboolean log_msg_is_tag_by_name | ( | LogMessage * | self, |
| const gchar * | name | ||
| ) |
| gboolean log_msg_is_value_name_valid | ( | const gchar * | value | ) |
| gint log_msg_lookup_time_stamp_name | ( | const gchar * | name | ) |
| LogMessage* log_msg_make_writable | ( | LogMessage ** | pself, |
| const LogPathOptions * | path_options | ||
| ) |
| void log_msg_merge_context | ( | LogMessage * | self, |
| LogMessage ** | context, | ||
| gsize | context_len | ||
| ) |
| LogMessage* log_msg_new_empty | ( | void | ) |
| LogMessage* log_msg_new_internal | ( | gint | prio, |
| const gchar * | msg | ||
| ) |
log_msg_new_internal: @prio: message priority (LOG_*) @msg: message text @flags: parse flags (LP_*)
This function creates a new log message for messages originating internally to syslog-ng
| LogMessage* log_msg_new_local | ( | void | ) |
| LogMessage* log_msg_new_mark | ( | void | ) |
log_msg_new_mark:
This function returns a new MARK message. MARK messages have the LF_MARK flag set.
| LogMessage* log_msg_ref | ( | LogMessage * | self | ) |
log_msg_ref: @self: LogMessage instance
Increment reference count of @self and return the new reference.
| void log_msg_refcache_start_consumer | ( | LogMessage * | self, |
| const LogPathOptions * | path_options | ||
| ) |
| void log_msg_refcache_start_producer | ( | LogMessage * | self | ) |
| void log_msg_refcache_stop | ( | void | ) |
| void log_msg_registry_deinit | ( | void | ) |
| void log_msg_registry_foreach | ( | GHFunc | func, |
| gpointer | user_data | ||
| ) |
| void log_msg_registry_init | ( | void | ) |
| void log_msg_set_daddr | ( | LogMessage * | self, |
| GSockAddr * | daddr | ||
| ) |
| void log_msg_set_daddr_ref | ( | LogMessage * | self, |
| GSockAddr * | daddr | ||
| ) |
| void log_msg_set_match | ( | LogMessage * | self, |
| gint | index_, | ||
| const gchar * | value, | ||
| gssize | value_len | ||
| ) |
| void log_msg_set_match_indirect | ( | LogMessage * | self, |
| gint | index_, | ||
| NVHandle | ref_handle, | ||
| guint16 | ofs, | ||
| guint16 | len | ||
| ) |
| void log_msg_set_match_indirect_with_type | ( | LogMessage * | self, |
| gint | index_, | ||
| NVHandle | ref_handle, | ||
| guint16 | ofs, | ||
| guint16 | len, | ||
| LogMessageValueType | type | ||
| ) |
| void log_msg_set_match_with_type | ( | LogMessage * | self, |
| gint | index_, | ||
| const gchar * | value, | ||
| gssize | value_len, | ||
| LogMessageValueType | type | ||
| ) |
| void log_msg_set_saddr | ( | LogMessage * | self, |
| GSockAddr * | saddr | ||
| ) |
| void log_msg_set_saddr_ref | ( | LogMessage * | self, |
| GSockAddr * | saddr | ||
| ) |
| void log_msg_set_tag_by_id | ( | LogMessage * | self, |
| LogTagId | id | ||
| ) |
| void log_msg_set_tag_by_id_onoff | ( | LogMessage * | self, |
| LogTagId | id, | ||
| gboolean | on | ||
| ) |
| void log_msg_set_tag_by_name | ( | LogMessage * | self, |
| const gchar * | name | ||
| ) |
| void log_msg_set_value | ( | LogMessage * | self, |
| NVHandle | handle, | ||
| const gchar * | value, | ||
| gssize | value_len | ||
| ) |
| void log_msg_set_value_indirect | ( | LogMessage * | self, |
| NVHandle | handle, | ||
| NVHandle | ref_handle, | ||
| guint16 | ofs, | ||
| guint16 | len | ||
| ) |
| void log_msg_set_value_indirect_with_type | ( | LogMessage * | self, |
| NVHandle | handle, | ||
| NVHandle | ref_handle, | ||
| guint16 | ofs, | ||
| guint16 | len, | ||
| LogMessageValueType | type | ||
| ) |
| void log_msg_set_value_with_type | ( | LogMessage * | self, |
| NVHandle | handle, | ||
| const gchar * | value, | ||
| gssize | value_len, | ||
| LogMessageValueType | type | ||
| ) |
| LogMessage* log_msg_sized_new | ( | gsize | payload_size | ) |
| void log_msg_tags_foreach | ( | const LogMessage * | self, |
| LogMessageTagsForeachFunc | callback, | ||
| gpointer | user_data | ||
| ) |
| void log_msg_tags_init | ( | void | ) |
| void log_msg_truncate_matches | ( | LogMessage * | self, |
| gint | n | ||
| ) |
| void log_msg_unref | ( | LogMessage * | self | ) |
log_msg_unref: @self: LogMessage instance
Decrement reference count and free self if the reference count becomes 0.
| void log_msg_unset_match | ( | LogMessage * | self, |
| gint | index_ | ||
| ) |
| void log_msg_unset_value | ( | LogMessage * | self, |
| NVHandle | handle | ||
| ) |
| void log_msg_unset_value_by_name | ( | LogMessage * | self, |
| const gchar * | name | ||
| ) |
| gboolean log_msg_value_type_from_str | ( | const gchar * | in_str, |
| LogMessageValueType * | out_type | ||
| ) |
| const gchar* log_msg_value_type_to_str | ( | LogMessageValueType | self | ) |
| gboolean log_msg_values_foreach | ( | const LogMessage * | self, |
| NVTableForeachFunc | func, | ||
| gpointer | user_data | ||
| ) |
| void log_msg_write_protect | ( | LogMessage * | self | ) |
| const gchar* builtin_value_names[] |
| gboolean logmsg_cached_abort |
| gboolean logmsg_cached_ack_needed |
| gint logmsg_cached_acks |
| gint logmsg_cached_refs |
| gboolean logmsg_cached_suspend |
| gint logmsg_queue_node_max = 1 |
| NVRegistry* logmsg_registry |
| const char logmsg_sd_prefix[] = ".SDATA." |
| const gint logmsg_sd_prefix_len = sizeof(logmsg_sd_prefix) - 1 |
| TLS_BLOCK_END |
| TLS_BLOCK_START |