PrePAN

Sign in to PrePAN

Log::CJournald C-Style Journald access

Good

Synopsis

use Log::CJournalD qw(:all) ;

my ($handle, $cursor, $data ) ;

# Logging
sd_journal_print( 1, "%s", "data" ) ;
sd_journal_sendv( {PRIORITY=>1, MESSAGE => "sd_journal_sendv 1", KEY2 => "value2"} ) ,

# Log retrieval (requires special priviledges)
sd_journal_open( \$handle, SD_JOURNAL_LOCAL_ONLY)
    and carp ( "cannot open journal" ) ;

sd_journal_next ( $handle )
    or carp ( "cannot seek journal handle" ) ;

sd_journal_enumerate_data( $handle, \$data )
    or carp ( "cannot enumerate" ) ;

sd_journal_getv ( $handle, \$data )
    and carp ( "cannot getv" ) ;

Description

Journald access c-style. Provides structured logging via sendv, log opening, seeking + retrieval.

Comments

Please sign up to post a review.