/**
 * @author Thomas Novotny
 * @packageDocumentation
 */
/// <reference types="node" />
/// <reference types="node" />
import EventEmitter from "events";
import { ChildProcessWithoutNullStreams } from "child_process";
import { JournalDEntry, JournalDEntryMinimal, JournalDPriority } from "./JournalDEntry";
/**
 * JournalCtl filter object, with key being the field name (all caps) and value being the desired value
 * Only entries where all keys exist and have the specified value are returned from Journalctl
 */
export declare type JournalCtlFilters = {
    [key: string]: string;
};
/**
 * Date in the format "2012-10-30 18:17:16". If the time part is omitted, "00:00:00" is assumed. If only the
 * seconds component is omitted, ":00" is assumed. If the date component is omitted, the current day is assumed.
 */
export declare type JournalDDateString = `${number}${number}${number}${number}-${number}${number}-${number}${number}${`${number}${number}:${number}${number}${`:${number}${number}` | ''}` | ''}` | `${`${number}${number}:${number}${number}${`:${number}${number}` | ''}` | ''}`;
export declare type JournalCtlOptions = {
    /** Show all fields in full, even if they include unprintable characters or are very long.
     * @default false
     */
    all?: boolean;
    /** Show the most recent journal events and limit the number of events shown.
     * @default 10 If neither since and until are set
     */
    lines?: number;
    /** Start showing entries on or newer than the specified date.
     * Date specifications as strings must be in the format "2012-10-30 18:17:16". If the time part is omitted, "00:00:00" is assumed. */
    since?: JournalDDateString | Date;
    /** Show entries only until specified date. When this option is set, tailing will be disabled.
     * Date specifications as strings must be in the format "2012-10-30 18:17:16". If the time part is omitted, "00:00:00" is assumed. */
    until?: JournalDDateString | Date;
    /** Show messages for the specified syslog identifier SYSLOG_IDENTIFIER. */
    identifier?: string;
    /** Show messages for the specified systemd unit (such as a service unit) */
    unit?: string;
    /** Additional filters for metadata fields. */
    filter?: JournalCtlFilters;
    /** Priority */
    priority?: JournalDPriority | {
        from: JournalDPriority;
        to: JournalDPriority;
    };
};
/** Events that the Journalctl EventEmitter supports */
export declare type JournalCtlEvent = "message" | "exit" | "error";
/** JournalD entry with explicit field names which are defined by a const string array */
export declare type JournalDEntryWithExplicitFieldNames<FieldNames extends readonly string[]> = {
    [key in FieldNames[number]]?: string;
} & JournalDEntryMinimal;
/**
 * This class is an EventEmitter that watches the local systemd journal for events and emits them.
 * @typeParam FieldNames List of field names that should be included in the JournalD messages. If left undefined, the messages will include all available fields.
 */
export default class JournalCtl<FieldNames extends readonly string[] | undefined = undefined> extends EventEmitter {
    /** The journalctl process instance */
    protected journalCtl: ChildProcessWithoutNullStreams;
    /** stdErr */
    protected stdErrorText: string | null;
    /** Tracks whether an asyncgenerator exists already */
    protected generatorInstanceExtists: boolean;
    /**
     * Create a new JournalCtl interface with the specified options
     *
     * @param options Optional options object
     * @throws Error if options are malformed or if the journalctl process can not be spawned
     */
    constructor(options?: JournalCtlOptions, outputFields?: FieldNames);
    /**
     * Registers event handler for "exit" event
     * @param event "exit"
     * @param callBack Callback function that gets executed when the journalctl process is closed or killed
     */
    on(event: "exit", callBack: () => void): this;
    /**
     * Registers event handler for "message" event
     * @param event "message"
     * @param callBack Callback function which gets called with the incoming message object as sole argument
     */
    on(event: "message", callBack: (message: FieldNames extends readonly string[] ? JournalDEntryWithExplicitFieldNames<FieldNames> : JournalDEntry) => void): this;
    /**
     * Registers event handler for "error" event
     * @param event "error"
     * @param callBack Callback function which gets called when any error occurs during the reading of the systemd journal
     */
    on(event: "error", callBack: (err: Error) => void): this;
    /**
     * Creates an AsyncGenerator for this instance
     * @returns AsyncGenerator which yields one journald message at a time as they come in
     */
    createGenerator(): AsyncGenerator<FieldNames extends readonly string[] ? JournalDEntryWithExplicitFieldNames<FieldNames> : JournalDEntry, {
        totalEntries: number;
    }>;
    /**
     * Stops the journalctl process and causes this instance to eventually emit the 'exit' event
     * @returns the return value of ChildProcess.kill()
     */
    stop(): boolean;
}
//# sourceMappingURL=JournalCtl.d.ts.map