// Copyright (C) 2026 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto2";

package perfetto.protos;

// A journald log event packet, collected from the Linux systemd journal.
// Emitted by the "linux.systemd_journald" data source in traced_probes.
// Next field id: 13, statistics starting at 20
message SystemdJournaldEvent {
  // _PID: PID of the process that wrote the log entry (trusted).
  optional uint32 pid = 1;

  // _TID: thread ID of the logging thread (trusted, set by journald for
  // native journal protocol entries). Absent for syslog, stdout-piped, and
  // kernel entries.
  optional uint32 tid = 2;

  // _UID: user ID of the process (trusted).
  optional uint32 uid = 3;

  // _GID: group ID of the process (trusted).
  optional uint32 gid = 4;

  // PRIORITY: syslog priority level 0 (EMERG) .. 7 (DEBUG).
  optional uint32 prio = 5;

  // SYSLOG_IDENTIFIER: program name / tag, set by the logging application.
  optional string tag = 6;

  // MESSAGE: the human-readable log message text.
  optional string message = 7;

  // _COMM: short process name as known to the kernel (trusted).
  optional string comm = 8;

  // _EXE: full executable path (trusted).
  optional string exe = 9;

  // _SYSTEMD_UNIT: the systemd unit that owns this process (trusted).
  optional string systemd_unit = 10;

  // _HOSTNAME: hostname of the machine (trusted).
  optional string hostname = 11;

  // _TRANSPORT: how the entry was received by journald (trusted).
  // Values: "audit", "driver", "syslog", "journal", "stdout", "kernel".
  optional string transport = 12;

  // These statistics emitted once on Flush()
  optional uint64 num_total = 20;
  optional uint64 num_failed = 21;
}
