static int run(int argc, char **argv) {
        _cleanup_(notify_on_cleanup) const char *notify_message = NULL;
        _cleanup_(journal_remote_server_destroy) RemoteServer s = {};
        _cleanup_free_ char *key = NULL, *cert = NULL, *trust = NULL;
        int r;

        log_show_color(true);
        log_parse_environment();

        /* The journal merging logic potentially needs a lot of fds. */
        (void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);

        r = parse_config();
        if (r < 0)
                return r;

        r = parse_argv(argc, argv);
        if (r <= 0)
                return r;

        if (arg_listen_http || arg_listen_https) {
                r = setup_gnutls_logger(arg_gnutls_log);
                if (r < 0)
                        return r;
        }

        if (arg_listen_https || https_socket >= 0) {
                r = load_certificates(&key, &cert, &trust);
                if (r < 0)
                        return r;

                s.check_trust = !arg_trust_all;
        }

        r = create_remoteserver(&s, key, cert, trust);
        if (r < 0)
                return r;

        r = sd_event_set_watchdog(s.events, true);
        if (r < 0)
                return log_error_errno(r, "Failed to enable watchdog: %m");

        log_debug("Watchdog is %sd.", enable_disable(r > 0));

        log_debug("%s running as pid "PID_FMT,
                  program_invocation_short_name, getpid_cached());

        notify_message = notify_start(NOTIFY_READY, NOTIFY_STOPPING);

        while (s.active) {
                r = sd_event_get_state(s.events);
                if (r < 0)
                        return r;
                if (r == SD_EVENT_FINISHED)
                        break;

                r = sd_event_run(s.events, -1);
                if (r < 0)
                        return log_error_errno(r, "Failed to run event loop: %m");
        }

        notify_message = NULL;
        (void) sd_notifyf(false,
                          "STOPPING=1\n"
                          "STATUS=Shutting down after writing %" PRIu64 " entries...", s.event_count);

        log_info("Finishing after writing %" PRIu64 " entries", s.event_count);

        return 0;
}
static int run(int argc, char **argv) {
        _cleanup_(notify_on_cleanup) const char *notify_message = NULL;
        _cleanup_(journal_remote_server_destroy) RemoteServer s = {};
        _cleanup_free_ char *key = NULL, *cert = NULL, *trust = NULL;
        int r;

        log_show_color(true);
        log_parse_environment();

         
        (void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);

        r = parse_config();
        if (r < 0)
                return r;

        r = parse_argv(argc, argv);
        if (r <= 0)
                return r;

        if (arg_listen_http || arg_listen_https) {
                r = setup_gnutls_logger(arg_gnutls_log);
                if (r < 0)
                        return r;
        }

        if (arg_listen_https || https_socket >= 0) {
                r = load_certificates(&key, &cert, &trust);
                if (r < 0)
                        return r;

                s.check_trust = !arg_trust_all;
        }

        r = create_remoteserver(&s, key, cert, trust);
        if (r < 0)
                return r;

        r = sd_event_set_watchdog(s.events, true);
        if (r < 0)
                return log_error_errno(r, "Failed to enable watchdog: %m");

        log_debug("Watchdog is %sd.", enable_disable(r > 0));

        log_debug("%s running as pid "PID_FMT,
                  program_invocation_short_name, getpid_cached());

        notify_message = notify_start(NOTIFY_READY, NOTIFY_STOPPING);

        while (s.active) {
                r = sd_event_get_state(s.events);
                if (r < 0)
                        return r;
                if (r == SD_EVENT_FINISHED)
                        break;

                r = sd_event_run(s.events, -1);
                if (r < 0)
                        return log_error_errno(r, "Failed to run event loop: %m");
        }

        notify_message = NULL;
        (void) sd_notifyf(false,
                          "STOPPING=1\n"
                          "STATUS=Shutting down after writing %" PRIu64 " entries...", s.event_count);

        log_info("Finishing after writing %" PRIu64 " entries", s.event_count);

        return 0;
}