Move over to ABSL logging and flags.

Removes gperftools too since that wants gflags.

Here come the fireworks.

Change-Id: I79cb7bcf60f1047fbfa28bfffc21a0fd692e4b1c
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/network/BUILD b/aos/network/BUILD
index 96f8b50..57dba97 100644
--- a/aos/network/BUILD
+++ b/aos/network/BUILD
@@ -173,7 +173,9 @@
     ],
     target_compatible_with = ["@platforms//os:linux"],
     deps = [
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/flags:flag",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
         "@com_google_absl//absl/strings",
     ],
 )
@@ -203,7 +205,9 @@
     deps = [
         "//aos:unique_malloc_ptr",
         "//aos/util:file",
-        "@com_github_google_glog//:glog",
+        "@com_google_absl//absl/flags:flag",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
         "@com_google_absl//absl/types:span",
     ],
 )
@@ -290,8 +294,9 @@
         ":remote_message_fbs",
         "//aos:configuration",
         "//aos/events:event_loop",
-        "@com_github_google_glog//:glog",
         "@com_google_absl//absl/container:btree",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
         "@com_google_absl//absl/strings",
     ],
 )
@@ -353,6 +358,7 @@
     target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":sctp_lib",
+        "@com_google_absl//absl/flags:flag",
     ],
 )
 
@@ -713,8 +719,9 @@
         "//aos/mutex",
         "//aos/seasocks:seasocks_logger",
         "//third_party/seasocks",
-        "@com_github_google_glog//:glog",
         "@com_github_rawrtc_rawrtc//:rawrtc",
+        "@com_google_absl//absl/log",
+        "@com_google_absl//absl/log:check",
     ],
 )
 
@@ -926,5 +933,7 @@
         ":sctp_server",
         "//aos:init",
         "//aos/events:shm_event_loop",
+        "@com_google_absl//absl/flags:flag",
+        "@com_google_absl//absl/flags:usage",
     ],
 )
diff --git a/aos/network/log_web_proxy_main.cc b/aos/network/log_web_proxy_main.cc
index 12276c3..dc55ff1 100644
--- a/aos/network/log_web_proxy_main.cc
+++ b/aos/network/log_web_proxy_main.cc
@@ -4,7 +4,8 @@
 // /path/to/logfile And then opening the plotting webpage at
 // http://localhost:8080/graph.html
 
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
 
 #include "aos/configuration.h"
 #include "aos/events/logging/log_reader.h"
@@ -13,13 +14,14 @@
 #include "aos/init.h"
 #include "aos/network/web_proxy.h"
 
-DEFINE_string(data_dir, "www", "Directory to serve data files from");
-DEFINE_string(node, "", "Directory to serve data files from");
-DEFINE_int32(buffer_size, -1, "-1 if infinite, in # of messages / channel.");
-DEFINE_double(monotonic_start_time, -1.0, "Start time (sec)");
-DEFINE_double(monotonic_end_time, -1.0, "End time (sec)");
-DEFINE_double(
-    replay_rate, -1,
+ABSL_FLAG(std::string, data_dir, "www", "Directory to serve data files from");
+ABSL_FLAG(std::string, node, "", "Directory to serve data files from");
+ABSL_FLAG(int32_t, buffer_size, -1,
+          "-1 if infinite, in # of messages / channel.");
+ABSL_FLAG(double, monotonic_start_time, -1.0, "Start time (sec)");
+ABSL_FLAG(double, monotonic_end_time, -1.0, "End time (sec)");
+ABSL_FLAG(
+    double, replay_rate, -1,
     "-1 to replay as fast as possible; 1.0 = realtime, 0.5 = half speed.");
 
 int main(int argc, char **argv) {
@@ -34,44 +36,46 @@
 
   // If going for "as fast as possible" don't actually use infinity, because we
   // don't want the log reading blocking our use of the epoll handlers.
-  reader.SetRealtimeReplayRate(FLAGS_replay_rate == -1.0
+  reader.SetRealtimeReplayRate(absl::GetFlag(FLAGS_replay_rate) == -1.0
                                    ? std::numeric_limits<double>::max()
-                                   : FLAGS_replay_rate);
+                                   : absl::GetFlag(FLAGS_replay_rate));
 
   std::unique_ptr<aos::EventLoop> event_loop;
 
-  if (FLAGS_node.empty()) {
+  if (absl::GetFlag(FLAGS_node).empty()) {
     CHECK(!aos::configuration::MultiNode(reader.configuration()))
         << "If using a multi-node logfile, please specify --node.";
     event_loop = reader.event_loop_factory()->MakeEventLoop("web_proxy");
   } else {
     event_loop = reader.event_loop_factory()->MakeEventLoop(
-        "web_proxy",
-        aos::configuration::GetNode(reader.configuration(), FLAGS_node));
+        "web_proxy", aos::configuration::GetNode(reader.configuration(),
+                                                 absl::GetFlag(FLAGS_node)));
   }
 
   event_loop->SkipTimingReport();
 
-  if (FLAGS_monotonic_start_time > 0) {
+  if (absl::GetFlag(FLAGS_monotonic_start_time) > 0) {
     event_loop->AddTimer([&reader]() { reader.event_loop_factory()->Exit(); })
         ->Schedule(aos::monotonic_clock::time_point(
             std::chrono::duration_cast<std::chrono::nanoseconds>(
-                std::chrono::duration<double>(FLAGS_monotonic_start_time))));
+                std::chrono::duration<double>(
+                    absl::GetFlag(FLAGS_monotonic_start_time)))));
 
     reader.event_loop_factory()->Run();
   }
 
   aos::web_proxy::WebProxy web_proxy(
       event_loop.get(), reader.event_loop_factory()->scheduler_epoll(),
-      aos::web_proxy::StoreHistory::kYes, FLAGS_buffer_size);
+      aos::web_proxy::StoreHistory::kYes, absl::GetFlag(FLAGS_buffer_size));
 
-  web_proxy.SetDataPath(FLAGS_data_dir.c_str());
+  web_proxy.SetDataPath(absl::GetFlag(FLAGS_data_dir).c_str());
 
-  if (FLAGS_monotonic_end_time > 0) {
+  if (absl::GetFlag(FLAGS_monotonic_end_time) > 0) {
     event_loop->AddTimer([&web_proxy]() { web_proxy.StopRecording(); })
         ->Schedule(aos::monotonic_clock::time_point(
             std::chrono::duration_cast<std::chrono::nanoseconds>(
-                std::chrono::duration<double>(FLAGS_monotonic_end_time))));
+                std::chrono::duration<double>(
+                    absl::GetFlag(FLAGS_monotonic_end_time)))));
   }
 
   reader.event_loop_factory()->Run();
diff --git a/aos/network/message_bridge_auth_client_lib.cc b/aos/network/message_bridge_auth_client_lib.cc
index c277b4f..2b520ba 100644
--- a/aos/network/message_bridge_auth_client_lib.cc
+++ b/aos/network/message_bridge_auth_client_lib.cc
@@ -2,7 +2,8 @@
 
 #include <vector>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/events/event_loop.h"
 #include "aos/network/message_bridge_auth.grpc.pb.h"
diff --git a/aos/network/message_bridge_auth_server_lib.cc b/aos/network/message_bridge_auth_server_lib.cc
index 6a9dc7e..f2a03c8 100644
--- a/aos/network/message_bridge_auth_server_lib.cc
+++ b/aos/network/message_bridge_auth_server_lib.cc
@@ -3,7 +3,8 @@
 #include <cstdio>
 #include <fstream>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "grpc/grpc.h"
 #include "grpcpp/server_context.h"
diff --git a/aos/network/message_bridge_client.cc b/aos/network/message_bridge_client.cc
index 4a1992a..e6b71ea 100644
--- a/aos/network/message_bridge_client.cc
+++ b/aos/network/message_bridge_client.cc
@@ -1,3 +1,5 @@
+#include "absl/flags/flag.h"
+
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
 #include "aos/logging/dynamic_logging.h"
@@ -6,11 +8,10 @@
 #include "aos/sha256.h"
 #include "aos/util/file.h"
 
-DEFINE_string(config, "aos_config.json", "Path to the config.");
-DEFINE_int32(rt_priority, -1, "If > 0, run as this RT priority");
-DEFINE_bool(
-    wants_sctp_authentication, false,
-    "When set, try to use SCTP authentication if provided by the kernel");
+ABSL_FLAG(std::string, config, "aos_config.json", "Path to the config.");
+ABSL_FLAG(int32_t, rt_priority, -1, "If > 0, run as this RT priority");
+ABSL_FLAG(bool, wants_sctp_authentication, false,
+          "When set, try to use SCTP authentication if provided by the kernel");
 
 namespace aos::message_bridge {
 
@@ -18,15 +19,15 @@
 
 int Main() {
   aos::FlatbufferDetachedBuffer<aos::Configuration> config =
-      aos::configuration::ReadConfig(FLAGS_config);
+      aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
 
   aos::ShmEventLoop event_loop(&config.message());
-  if (FLAGS_rt_priority > 0) {
-    event_loop.SetRuntimeRealtimePriority(FLAGS_rt_priority);
+  if (absl::GetFlag(FLAGS_rt_priority) > 0) {
+    event_loop.SetRuntimeRealtimePriority(absl::GetFlag(FLAGS_rt_priority));
   }
 
   MessageBridgeClient app(&event_loop, Sha256(config.span()),
-                          FLAGS_wants_sctp_authentication
+                          absl::GetFlag(FLAGS_wants_sctp_authentication)
                               ? SctpAuthMethod::kAuth
                               : SctpAuthMethod::kNoAuth);
 
diff --git a/aos/network/message_bridge_client_lib.cc b/aos/network/message_bridge_client_lib.cc
index cf52a69..d9fa91d 100644
--- a/aos/network/message_bridge_client_lib.cc
+++ b/aos/network/message_bridge_client_lib.cc
@@ -3,8 +3,9 @@
 #include <chrono>
 #include <string_view>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/shm_event_loop.h"
@@ -24,7 +25,7 @@
 #pragma clang diagnostic ignored "-Wcast-align"
 #endif
 
-DECLARE_bool(use_sctp_authentication);
+ABSL_DECLARE_FLAG(bool, use_sctp_authentication);
 
 // This application receives messages from another node and re-publishes them on
 // this node.
diff --git a/aos/network/message_bridge_retry_test.cc b/aos/network/message_bridge_retry_test.cc
index e90bcb0..52ed3c9 100644
--- a/aos/network/message_bridge_retry_test.cc
+++ b/aos/network/message_bridge_retry_test.cc
@@ -1,6 +1,7 @@
 #include <chrono>
 #include <thread>
 
+#include "absl/flags/declare.h"
 #include "absl/strings/str_cat.h"
 #include "gtest/gtest.h"
 
@@ -16,7 +17,7 @@
 #include "aos/testing/path.h"
 #include "aos/util/file.h"
 
-DECLARE_int32(force_wmem_max);
+ABSL_DECLARE_FLAG(int32_t, force_wmem_max);
 
 namespace aos::message_bridge::testing {
 
@@ -37,10 +38,10 @@
 // message_bridge_test, so we kept it separate.
 TEST_P(MessageBridgeParameterizedTest, ReliableRetries) {
   // Set an absurdly small wmem max. This will help to trigger retries.
-  FLAGS_force_wmem_max = 1024;
+  absl::SetFlag(&FLAGS_force_wmem_max, 1024);
   pi1_.OnPi();
 
-  FLAGS_application_name = "sender";
+  absl::SetFlag(&FLAGS_application_name, "sender");
   aos::ShmEventLoop send_event_loop(&config_.message());
   aos::Sender<examples::Ping> ping_sender =
       send_event_loop.MakeSender<examples::Ping>("/test");
diff --git a/aos/network/message_bridge_server.cc b/aos/network/message_bridge_server.cc
index 64c57f5..2df5704 100644
--- a/aos/network/message_bridge_server.cc
+++ b/aos/network/message_bridge_server.cc
@@ -1,5 +1,6 @@
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
@@ -8,11 +9,10 @@
 #include "aos/network/sctp_lib.h"
 #include "aos/sha256.h"
 
-DEFINE_string(config, "aos_config.json", "Path to the config.");
-DEFINE_int32(rt_priority, -1, "If > 0, run as this RT priority");
-DEFINE_bool(
-    wants_sctp_authentication, false,
-    "When set, try to use SCTP authentication if provided by the kernel");
+ABSL_FLAG(std::string, config, "aos_config.json", "Path to the config.");
+ABSL_FLAG(int32_t, rt_priority, -1, "If > 0, run as this RT priority");
+ABSL_FLAG(bool, wants_sctp_authentication, false,
+          "When set, try to use SCTP authentication if provided by the kernel");
 
 namespace aos::message_bridge {
 
@@ -20,15 +20,15 @@
 
 int Main() {
   aos::FlatbufferDetachedBuffer<aos::Configuration> config =
-      aos::configuration::ReadConfig(FLAGS_config);
+      aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
 
   aos::ShmEventLoop event_loop(&config.message());
-  if (FLAGS_rt_priority > 0) {
-    event_loop.SetRuntimeRealtimePriority(FLAGS_rt_priority);
+  if (absl::GetFlag(FLAGS_rt_priority) > 0) {
+    event_loop.SetRuntimeRealtimePriority(absl::GetFlag(FLAGS_rt_priority));
   }
 
   MessageBridgeServer app(&event_loop, Sha256(config.span()),
-                          FLAGS_wants_sctp_authentication
+                          absl::GetFlag(FLAGS_wants_sctp_authentication)
                               ? SctpAuthMethod::kAuth
                               : SctpAuthMethod::kNoAuth);
 
diff --git a/aos/network/message_bridge_server_lib.cc b/aos/network/message_bridge_server_lib.cc
index a3f429a..7f6ad53 100644
--- a/aos/network/message_bridge_server_lib.cc
+++ b/aos/network/message_bridge_server_lib.cc
@@ -1,9 +1,10 @@
 #include "aos/network/message_bridge_server_lib.h"
 
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/strings/str_cat.h"
 #include "absl/types/span.h"
-#include "glog/logging.h"
-#include "glog/raw_logging.h"
 
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/logging/logger_generated.h"
@@ -31,31 +32,31 @@
 // that hopefully it is a relatively minor blip for anything that isn't
 // timing-critical (and timing-critical things that hit the retry logic are
 // probably in trouble).
-DEFINE_uint32(min_retry_period_ms, 10,
-              "Maximum retry timer period--the exponential backoff will not "
-              "exceed this period, in milliseconds.");
+ABSL_FLAG(uint32_t, min_retry_period_ms, 10,
+          "Maximum retry timer period--the exponential backoff will not "
+          "exceed this period, in milliseconds.");
 // Amount of backoff to add every time a retry fails. Chosen semi-arbitrarily;
 // 100ms is large enough that the backoff actually does increase at a reasonable
 // rate, while preventing the period from growing so fast that it can readily
 // take multiple seconds for a retry to occur.
-DEFINE_uint32(retry_period_additive_backoff_ms, 100,
-              "Amount of time to add to the retry period every time a retry "
-              "fails, in milliseconds.");
+ABSL_FLAG(uint32_t, retry_period_additive_backoff_ms, 100,
+          "Amount of time to add to the retry period every time a retry "
+          "fails, in milliseconds.");
 // Max out retry period at 10 seconds---this is generally a much longer
 // timescale than anything normally happening on our systems, while still being
 // short enough that the retries will regularly happen (basically, the maximum
 // should be short enough that a human trying to debug issues with the system
 // will still see the retries regularly happening as they debug, rather than
 // having to wait minutes or hours for a retry to occur).
-DEFINE_uint32(max_retry_period_ms, 10000,
-              "Maximum retry timer period--the additive backoff will not "
-              "exceed this period, in milliseconds.");
+ABSL_FLAG(uint32_t, max_retry_period_ms, 10000,
+          "Maximum retry timer period--the additive backoff will not "
+          "exceed this period, in milliseconds.");
 
-DEFINE_int32(force_wmem_max, -1,
-             "If set to a nonnegative numbers, the wmem buffer size to use, in "
-             "bytes. Intended solely for testing purposes.");
+ABSL_FLAG(int32_t, force_wmem_max, -1,
+          "If set to a nonnegative numbers, the wmem buffer size to use, in "
+          "bytes. Intended solely for testing purposes.");
 
-DECLARE_bool(use_sctp_authentication);
+ABSL_DECLARE_FLAG(bool, use_sctp_authentication);
 
 namespace aos::message_bridge {
 namespace chrono = std::chrono;
@@ -115,7 +116,8 @@
       allocator_(allocator),
       last_message_fetcher_(event_loop->MakeRawFetcher(channel)),
       retry_timer_(event_loop->AddTimer([this]() { SendData(); })),
-      retry_period_(std::chrono::milliseconds(FLAGS_min_retry_period_ms)) {
+      retry_period_(
+          std::chrono::milliseconds(absl::GetFlag(FLAGS_min_retry_period_ms))) {
   retry_timer_->set_name(absl::StrFormat("retry%d", channel_index));
 }
 
@@ -164,7 +166,8 @@
   // either (a) we run out of messages to send or (b) sends start to fail.
   do {
     if (ReadyToFetchNext()) {
-      retry_period_ = std::chrono::milliseconds(FLAGS_min_retry_period_ms);
+      retry_period_ =
+          std::chrono::milliseconds(absl::GetFlag(FLAGS_min_retry_period_ms));
       if (!last_message_fetcher_->FetchNext()) {
         return;
       }
@@ -231,9 +234,9 @@
   if (retry_required) {
     retry_timer_->Schedule(event_loop_->monotonic_now() + retry_period_);
     retry_period_ = std::min(
-        retry_period_ +
-            std::chrono::milliseconds(FLAGS_retry_period_additive_backoff_ms),
-        std::chrono::milliseconds(FLAGS_max_retry_period_ms));
+        retry_period_ + std::chrono::milliseconds(absl::GetFlag(
+                            FLAGS_retry_period_additive_backoff_ms)),
+        std::chrono::milliseconds(absl::GetFlag(FLAGS_max_retry_period_ms)));
   }
 
   if (logged_remotely) {
@@ -369,13 +372,13 @@
         reconnected->push_back(peer.sac_assoc_id);
         if (peer.sac_assoc_id == assoc_id) {
           if (VLOG_IS_ON(1)) {
-            LOG_EVERY_T(WARNING, 0.025)
+            LOG_EVERY_N_SEC(WARNING, 0.025)
                 << "Node " << node->name()->string_view() << " reconnecting on "
                 << assoc_id << " with the same ID, something got lost";
           }
         } else {
           if (VLOG_IS_ON(1)) {
-            LOG_EVERY_T(WARNING, 0.025)
+            LOG_EVERY_N_SEC(WARNING, 0.025)
                 << "Node " << node->name()->string_view() << " "
                 << " already connected on " << peer.sac_assoc_id
                 << " aborting old connection and switching to " << assoc_id;
@@ -395,7 +398,8 @@
       if (!AnyNodeConnected()) {
         // If no one else is connected yet, reset the Fetcher.
         last_message_fetcher_->Fetch();
-        retry_period_ = std::chrono::milliseconds(FLAGS_min_retry_period_ms);
+        retry_period_ =
+            std::chrono::milliseconds(absl::GetFlag(FLAGS_min_retry_period_ms));
       }
       // Unreliable channels aren't supposed to send out the latest fetched
       // message.
@@ -581,8 +585,8 @@
   LOG(INFO) << "Reliable buffer size for all clients is "
             << reliable_buffer_size;
   server_.SetMaxReadSize(max_size);
-  if (FLAGS_force_wmem_max >= 0) {
-    server_.SetMaxWriteSize(FLAGS_force_wmem_max);
+  if (absl::GetFlag(FLAGS_force_wmem_max) >= 0) {
+    server_.SetMaxWriteSize(absl::GetFlag(FLAGS_force_wmem_max));
   } else {
     server_.SetMaxWriteSize(
         std::max(max_channel_buffer_size, reliable_buffer_size));
@@ -696,7 +700,7 @@
       flatbuffers::Verifier verifier(message->data(), message->size);
       if (!connect->Verify(verifier)) {
         if (VLOG_IS_ON(1)) {
-          LOG_EVERY_T(WARNING, 1.0)
+          LOG_EVERY_N_SEC(WARNING, 1.0)
               << "Failed to verify message, disconnecting client";
         }
         server_.Abort(message->header.rcvinfo.rcv_assoc_id);
diff --git a/aos/network/message_bridge_server_lib.h b/aos/network/message_bridge_server_lib.h
index 1c3903f..1b20743 100644
--- a/aos/network/message_bridge_server_lib.h
+++ b/aos/network/message_bridge_server_lib.h
@@ -3,8 +3,9 @@
 
 #include <deque>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/types/span.h"
-#include "glog/logging.h"
 
 #include "aos/events/logging/log_reader.h"
 #include "aos/events/logging/logger_generated.h"
diff --git a/aos/network/message_bridge_test.cc b/aos/network/message_bridge_test.cc
index 350cf26..a923f81 100644
--- a/aos/network/message_bridge_test.cc
+++ b/aos/network/message_bridge_test.cc
@@ -1,6 +1,9 @@
 #include <chrono>
 #include <thread>
 
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/strings/str_cat.h"
 #include "gtest/gtest.h"
 
@@ -54,7 +57,7 @@
   const std::string long_data = std::string(10000, 'a');
 
   // And build the app which sends the pings.
-  FLAGS_application_name = "ping";
+  absl::SetFlag(&FLAGS_application_name, "ping");
   aos::ShmEventLoop ping_event_loop(&config_.message());
   aos::Sender<examples::Ping> ping_sender =
       ping_event_loop.MakeSender<examples::Ping>("/test");
@@ -78,11 +81,11 @@
   pi2_.MakeServer();
 
   // And build the app which sends the pongs.
-  FLAGS_application_name = "pong";
+  absl::SetFlag(&FLAGS_application_name, "pong");
   aos::ShmEventLoop pong_event_loop(&config_.message());
 
   // And build the app for testing.
-  FLAGS_application_name = "test";
+  absl::SetFlag(&FLAGS_application_name, "test");
   aos::ShmEventLoop test_event_loop(&config_.message());
 
   aos::Fetcher<ClientStatistics> client_statistics_fetcher =
@@ -112,7 +115,7 @@
     VLOG(1) << "Got ping back " << FlatbufferToJson(&ping);
   });
 
-  FLAGS_override_hostname = "";
+  absl::SetFlag(&FLAGS_override_hostname, "");
 
   // Wait until we are connected, then send.
   int ping_count = 0;
@@ -805,7 +808,7 @@
 TEST_P(MessageBridgeParameterizedTest, ReliableSentBeforeClientStartup) {
   pi1_.OnPi();
 
-  FLAGS_application_name = "sender";
+  absl::SetFlag(&FLAGS_application_name, "sender");
   aos::ShmEventLoop send_event_loop(&config_.message());
   aos::Sender<examples::Ping> ping_sender =
       send_event_loop.MakeSender<examples::Ping>("/test");
@@ -817,7 +820,7 @@
   pi1_.MakeServer();
   pi1_.MakeClient();
 
-  FLAGS_application_name = "pi1_timestamp";
+  absl::SetFlag(&FLAGS_application_name, "pi1_timestamp");
   aos::ShmEventLoop pi1_remote_timestamp_event_loop(&config_.message());
 
   // Now do it for "raspberrypi2", the client.
@@ -953,7 +956,7 @@
   // Force ourselves to be "raspberrypi" and allocate everything.
   pi1_.OnPi();
 
-  FLAGS_application_name = "sender";
+  absl::SetFlag(&FLAGS_application_name, "sender");
   aos::ShmEventLoop send_event_loop(&config_.message());
   aos::Sender<examples::Ping> ping_sender =
       send_event_loop.MakeSender<examples::Ping>("/test");
@@ -967,7 +970,7 @@
 
   pi1_.MakeClient();
 
-  FLAGS_application_name = "pi1_timestamp";
+  absl::SetFlag(&FLAGS_application_name, "pi1_timestamp");
   aos::ShmEventLoop pi1_remote_timestamp_event_loop(&config_.message());
 
   const size_t ping_channel_index = configuration::ChannelIndex(
@@ -1077,7 +1080,7 @@
 TEST_P(MessageBridgeParameterizedTest, ReliableSentDuringClientReboot) {
   pi1_.OnPi();
 
-  FLAGS_application_name = "sender";
+  absl::SetFlag(&FLAGS_application_name, "sender");
   aos::ShmEventLoop send_event_loop(&config_.message());
   aos::Sender<examples::Ping> ping_sender =
       send_event_loop.MakeSender<examples::Ping>("/test");
@@ -1087,7 +1090,7 @@
   pi1_.MakeServer();
   pi1_.MakeClient();
 
-  FLAGS_application_name = "pi1_timestamp";
+  absl::SetFlag(&FLAGS_application_name, "pi1_timestamp");
   aos::ShmEventLoop pi1_remote_timestamp_event_loop(&config_.message());
 
   // Now do it for "raspberrypi2", the client.
@@ -1363,7 +1366,7 @@
     // Now, spin up a SctpClient and send a massive hunk of data.  This should
     // trigger a disconnect, but no crash.
     pi2_.OnPi();
-    FLAGS_application_name = "pi2_message_bridge_client";
+    absl::SetFlag(&FLAGS_application_name, "pi2_message_bridge_client");
     pi2_.client_event_loop_ =
         std::make_unique<aos::ShmEventLoop>(&config_.message());
     pi2_.client_event_loop_->SetRuntimeRealtimePriority(1);
diff --git a/aos/network/message_bridge_test_lib.cc b/aos/network/message_bridge_test_lib.cc
index 6b8b49e..eed1698 100644
--- a/aos/network/message_bridge_test_lib.cc
+++ b/aos/network/message_bridge_test_lib.cc
@@ -1,6 +1,9 @@
 #include "aos/network/message_bridge_test_lib.h"
 
-DECLARE_string(boot_uuid);
+#include "absl/flags/flag.h"
+#include "absl/log/log.h"
+
+ABSL_DECLARE_FLAG(std::string, boot_uuid);
 
 namespace aos::message_bridge::testing {
 
@@ -69,14 +72,14 @@
 
 void PiNode::OnPi() {
   DoSetShmBase(node_name_);
-  FLAGS_override_hostname = host_name_;
-  FLAGS_boot_uuid = boot_uuid_.ToString();
+  absl::SetFlag(&FLAGS_override_hostname, host_name_);
+  absl::SetFlag(&FLAGS_boot_uuid, boot_uuid_.ToString());
 }
 
 void PiNode::MakeServer(const std::string server_config_sha256) {
   OnPi();
   LOG(INFO) << "Making " << node_name_ << " server";
-  FLAGS_application_name = app_name_;
+  absl::SetFlag(&FLAGS_application_name, app_name_);
   server_event_loop_ = std::make_unique<aos::ShmEventLoop>(&config_.message());
   server_event_loop_->SetRuntimeRealtimePriority(1);
   message_bridge_server_ = std::make_unique<MessageBridgeServer>(
@@ -114,7 +117,7 @@
 void PiNode::MakeClient() {
   OnPi();
   LOG(INFO) << "Making " << node_name_ << " client";
-  FLAGS_application_name = app_name_;
+  absl::SetFlag(&FLAGS_application_name, app_name_);
   client_event_loop_ = std::make_unique<aos::ShmEventLoop>(&config_.message());
   client_event_loop_->SetRuntimeRealtimePriority(1);
   message_bridge_client_ = std::make_unique<MessageBridgeClient>(
@@ -138,7 +141,7 @@
                       const PiNode *other_node) {
   OnPi();
   LOG(INFO) << "Making " << node_name_ << " test";
-  FLAGS_application_name = test_app_name;
+  absl::SetFlag(&FLAGS_application_name, test_app_name);
   test_event_loop_ = std::make_unique<aos::ShmEventLoop>(&config_.message());
 
   std::string channel_name = "/" + node_name_ + "/aos";
diff --git a/aos/network/message_bridge_test_lib.h b/aos/network/message_bridge_test_lib.h
index f8c0a3a..613f792 100644
--- a/aos/network/message_bridge_test_lib.h
+++ b/aos/network/message_bridge_test_lib.h
@@ -3,6 +3,7 @@
 #include <chrono>
 #include <thread>
 
+#include "absl/flags/reflection.h"
 #include "absl/strings/str_cat.h"
 #include "gtest/gtest.h"
 
@@ -92,7 +93,7 @@
 
   bool shared() const;
 
-  gflags::FlagSaver flag_saver_;
+  absl::FlagSaver flag_saver_;
 
   PiNode pi1_;
   PiNode pi2_;
diff --git a/aos/network/multinode_timestamp_filter.cc b/aos/network/multinode_timestamp_filter.cc
index 42e4299..263d52b 100644
--- a/aos/network/multinode_timestamp_filter.cc
+++ b/aos/network/multinode_timestamp_filter.cc
@@ -4,8 +4,10 @@
 #include <functional>
 #include <map>
 
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/strings/str_join.h"
-#include "glog/logging.h"
 
 #include "aos/configuration.h"
 #include "aos/events/logging/boot_timestamp.h"
@@ -13,53 +15,54 @@
 #include "aos/network/timestamp_filter.h"
 #include "aos/time/time.h"
 
-DEFINE_bool(timestamps_to_csv, false,
-            "If true, write all the time synchronization information to a set "
-            "of CSV files in /tmp/.  This should only be needed when debugging "
-            "time synchronization.");
+ABSL_FLAG(bool, timestamps_to_csv, false,
+          "If true, write all the time synchronization information to a set "
+          "of CSV files in /tmp/.  This should only be needed when debugging "
+          "time synchronization.");
 
-DEFINE_string(timestamp_csv_folder, "/tmp", "Folder to drop CSVs in");
+ABSL_FLAG(std::string, timestamp_csv_folder, "/tmp", "Folder to drop CSVs in");
 
-DEFINE_int32(max_invalid_distance_ns, 0,
-             "The max amount of time we will let the solver go backwards.");
+ABSL_FLAG(int32_t, max_invalid_distance_ns, 0,
+          "The max amount of time we will let the solver go backwards.");
 
-DEFINE_int32(debug_solve_number, -1,
-             "If nonzero, print out all the state for the provided solve "
-             "number.  This is typically used by solving once, taking note of "
-             "which solution failed to converge, and then re-running with "
-             "debug turned on for just that problem.");
+ABSL_FLAG(int32_t, debug_solve_number, -1,
+          "If nonzero, print out all the state for the provided solve "
+          "number.  This is typically used by solving once, taking note of "
+          "which solution failed to converge, and then re-running with "
+          "debug turned on for just that problem.");
 
-DEFINE_bool(bounds_offset_error, false,
-            "If true, use the offset to the bounds for solving instead of to "
-            "the interpolation lines.  This seems to make startup a bit "
-            "better, but won't track the middle as well.");
+ABSL_FLAG(bool, bounds_offset_error, false,
+          "If true, use the offset to the bounds for solving instead of to "
+          "the interpolation lines.  This seems to make startup a bit "
+          "better, but won't track the middle as well.");
 
-DEFINE_bool(
-    crash_on_solve_failure, true,
+ABSL_FLAG(
+    bool, crash_on_solve_failure, true,
     "If true, crash when the solver fails to converge.  If false, keep going.  "
     "This should only be set to false when trying to see if future problems "
     "would be solvable.  This won't process a valid log");
 
-DEFINE_bool(attempt_simultaneous_constrained_solve, true,
-            "If true, try the simultaneous, constrained solver.  If false, "
-            "only solve constrained problems sequentially.");
+ABSL_FLAG(bool, attempt_simultaneous_constrained_solve, true,
+          "If true, try the simultaneous, constrained solver.  If false, "
+          "only solve constrained problems sequentially.");
 
-DEFINE_bool(
-    remove_unlikely_constraints, true,
+ABSL_FLAG(
+    bool, remove_unlikely_constraints, true,
     "If true, when solving, try with our best guess at which constraints will "
     "be relevant and resolve if that proves wrong with an updated set.  For "
     "expensive problems, this reduces solve time significantly.");
 
-DEFINE_int32(solve_verbosity, 1, "Verbosity to use when debugging the solver.");
+ABSL_FLAG(int32_t, solve_verbosity, 1,
+          "Verbosity to use when debugging the solver.");
 
-DEFINE_bool(constrained_solve, true,
-            "If true, use the constrained solver.  If false, only solve "
-            "unconstrained.");
+ABSL_FLAG(bool, constrained_solve, true,
+          "If true, use the constrained solver.  If false, only solve "
+          "unconstrained.");
 
-#define SOLVE_VLOG_IS_ON(solve_number, v)                             \
-  (VLOG_IS_ON(v) ||                                                   \
-   (static_cast<int32_t>(solve_number) == FLAGS_debug_solve_number && \
-    v <= FLAGS_solve_verbosity))
+#define SOLVE_VLOG_IS_ON(solve_number, v)                           \
+  (VLOG_IS_ON(v) || (static_cast<int32_t>(solve_number) ==          \
+                         absl::GetFlag(FLAGS_debug_solve_number) && \
+                     v <= absl::GetFlag(FLAGS_solve_verbosity)))
 
 #define SOLVE_VLOG(solve_number, v) \
   LOG_IF(INFO, SOLVE_VLOG_IS_ON(solve_number, v))
@@ -77,7 +80,7 @@
 
 template <class... Args>
 std::string CsvPath(Args &&...args) {
-  return absl::StrCat(FLAGS_timestamp_csv_folder, "/",
+  return absl::StrCat(absl::GetFlag(FLAGS_timestamp_csv_folder), "/",
                       std::forward<Args>(args)...);
 }
 }  // namespace
@@ -329,7 +332,7 @@
       std::pair<NoncausalTimestampFilter::Pointer,
                 std::tuple<chrono::nanoseconds, double, double>>
           offset_error =
-              FLAGS_bounds_offset_error
+              absl::GetFlag(FLAGS_bounds_offset_error)
                   ? filter.filter->BoundsOffsetError(
                         filter.b_filter, std::move(filter.pointer),
                         base_clock_[i], time_offsets(a_solution_index),
@@ -1049,7 +1052,8 @@
             << " Considering constraint " << i << " from before";
         active_constraints.emplace_back(i);
         ++original_constraint_index;
-      } else if (derivatives.f(i) > 0.0 || !FLAGS_remove_unlikely_constraints) {
+      } else if (derivatives.f(i) > 0.0 ||
+                 !absl::GetFlag(FLAGS_remove_unlikely_constraints)) {
         SOLVE_VLOG(my_solve_number_, 1) << " Considering constraint " << i;
         active_constraints.emplace_back(i);
       }
@@ -1306,7 +1310,8 @@
     }
   }
 
-  if (iteration > max_iterations && FLAGS_crash_on_solve_failure) {
+  if (iteration > max_iterations &&
+      absl::GetFlag(FLAGS_crash_on_solve_failure)) {
     LOG(ERROR) << "Failed to converge on solve " << my_solve_number_;
     return std::nullopt;
   }
@@ -1417,7 +1422,7 @@
         // hitting this anymore.  I'm also likely the one who will be debugging
         // it next and would rather spend the time debugging it when I get a bug
         // report.
-        if (FLAGS_bounds_offset_error) {
+        if (absl::GetFlag(FLAGS_bounds_offset_error)) {
           gradients[i].emplace_back(
               std::string("- ") +
               filter.filter->DebugOffsetError(
@@ -1789,7 +1794,7 @@
   CHECK_EQ(boots_->boots.size(), NodesCount());
   filters_per_node_.resize(NodesCount());
   last_monotonics_.resize(NodesCount(), BootTimestamp::epoch());
-  if (FLAGS_timestamps_to_csv && multi_node) {
+  if (absl::GetFlag(FLAGS_timestamps_to_csv) && multi_node) {
     fp_ = fopen(CsvPath("timestamp_noncausal_offsets.csv").c_str(), "w");
     fprintf(fp_, "# distributed");
     for (const Node *node : configuration::GetNodes(logged_configuration)) {
@@ -1925,7 +1930,7 @@
 
 void MultiNodeNoncausalOffsetEstimator::Start(
     std::vector<monotonic_clock::time_point> times) {
-  if (FLAGS_timestamps_to_csv) {
+  if (absl::GetFlag(FLAGS_timestamps_to_csv)) {
     std::fstream s(CsvPath("timestamp_noncausal_starttime.csv").c_str(),
                    s.trunc | s.out);
     CHECK(s.is_open());
@@ -2636,7 +2641,8 @@
                                  SOLVE_VLOG_IS_ON(solver.my_solve_number(), 2),
                              solution_y);
 
-    if (iterations > kMaxIterations && FLAGS_crash_on_solve_failure) {
+    if (iterations > kMaxIterations &&
+        absl::GetFlag(FLAGS_crash_on_solve_failure)) {
       UpdateSolution(std::move(solution));
       if (!FlushAndClose(false)) {
         return std::nullopt;
@@ -2646,7 +2652,7 @@
     }
 
     if (!problem->ValidateSolution(solution, true)) {
-      if (!FLAGS_constrained_solve) {
+      if (!absl::GetFlag(FLAGS_constrained_solve)) {
         problem->ValidateSolution(solution, false);
         LOG(WARNING) << "Invalid solution, constraints not met for problem "
                      << solver.my_solve_number();
@@ -2671,7 +2677,7 @@
           problem->set_base_clock(node_index, solution[node_index]);
         }
 
-        if (!FLAGS_attempt_simultaneous_constrained_solve) {
+        if (!absl::GetFlag(FLAGS_attempt_simultaneous_constrained_solve)) {
           VLOG(1) << "Falling back to sequential constrained Newton.";
           return SequentialSolution(problem, candidate_times, base_times);
         }
@@ -2687,7 +2693,8 @@
         std::tie(std::ignore, std::ignore, solution_index, iterations) =
             *solver_result;
 
-        if (iterations > kMaxIterations && FLAGS_crash_on_solve_failure) {
+        if (iterations > kMaxIterations &&
+            absl::GetFlag(FLAGS_crash_on_solve_failure)) {
           UpdateSolution(std::move(solution));
           if (!FlushAndClose(false)) {
             return std::nullopt;
@@ -2729,7 +2736,8 @@
   // If times are close enough, drop the invalid time.
   const chrono::nanoseconds invalid_distance =
       InvalidDistance(result_times, solution);
-  if (invalid_distance <= chrono::nanoseconds(FLAGS_max_invalid_distance_ns)) {
+  if (invalid_distance <=
+      chrono::nanoseconds(absl::GetFlag(FLAGS_max_invalid_distance_ns))) {
     VLOG(1) << "Times can't be compared by " << invalid_distance.count()
             << "ns";
     for (size_t i = 0; i < result_times.size(); ++i) {
@@ -2867,7 +2875,8 @@
                                  SOLVE_VLOG_IS_ON(solver.my_solve_number(), 2),
                              solution_y);
 
-    if (iterations > kMaxIterations && FLAGS_crash_on_solve_failure) {
+    if (iterations > kMaxIterations &&
+        absl::GetFlag(FLAGS_crash_on_solve_failure)) {
       UpdateSolution(std::move(solution));
       if (!FlushAndClose(false)) {
         return std::nullopt;
@@ -2881,7 +2890,7 @@
     // CSV file so we can view the problem and figure out what to do.  The
     // results won't make sense.
     if (!problem->ValidateSolution(solution, true)) {
-      if (!FLAGS_constrained_solve) {
+      if (!absl::GetFlag(FLAGS_constrained_solve)) {
         // Do it non-quiet now.
         problem->ValidateSolution(solution, false);
 
@@ -2918,7 +2927,8 @@
         std::tie(std::ignore, std::ignore, solution_index, iterations) =
             *solver_result;
 
-        if (iterations > kMaxIterations && FLAGS_crash_on_solve_failure) {
+        if (iterations > kMaxIterations &&
+            absl::GetFlag(FLAGS_crash_on_solve_failure)) {
           UpdateSolution(std::move(solution));
           if (!FlushAndClose(false)) {
             return std::nullopt;
@@ -3238,7 +3248,7 @@
         const chrono::nanoseconds invalid_distance =
             InvalidDistance(last_monotonics_, result_times);
         if (invalid_distance <=
-            chrono::nanoseconds(FLAGS_max_invalid_distance_ns)) {
+            chrono::nanoseconds(absl::GetFlag(FLAGS_max_invalid_distance_ns))) {
           WriteFilter(next_filter, sample);
           return NextTimestamp();
         }
diff --git a/aos/network/multinode_timestamp_filter.h b/aos/network/multinode_timestamp_filter.h
index 66dcbff..8d560b6 100644
--- a/aos/network/multinode_timestamp_filter.h
+++ b/aos/network/multinode_timestamp_filter.h
@@ -8,7 +8,8 @@
 
 #include "Eigen/Dense"
 #include "absl/container/btree_set.h"
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/configuration.h"
 #include "aos/events/logging/boot_timestamp.h"
diff --git a/aos/network/ping.cc b/aos/network/ping.cc
index f105133..6aceaee 100644
--- a/aos/network/ping.cc
+++ b/aos/network/ping.cc
@@ -1,17 +1,17 @@
 #include <chrono>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/log.h"
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
 #include "aos/network/sctp_server.h"
 
-DEFINE_string(config, "aos_config.json", "Path to the config.");
-DEFINE_uint32(port, 1323, "Port to pingpong on");
-DEFINE_uint32(size, 1000000, "Size of data to send in bytes");
-DEFINE_uint32(duration, 1000, "Period to send at in milliseconds");
-DEFINE_uint32(ttl, 0, "TTL in milliseconds");
+ABSL_FLAG(std::string, config, "aos_config.json", "Path to the config.");
+ABSL_FLAG(uint32_t, port, 1323, "Port to pingpong on");
+ABSL_FLAG(uint32_t, size, 1000000, "Size of data to send in bytes");
+ABSL_FLAG(uint32_t, duration, 1000, "Period to send at in milliseconds");
+ABSL_FLAG(uint32_t, ttl, 0, "TTL in milliseconds");
 
 namespace aos {
 namespace message_bridge {
@@ -21,17 +21,17 @@
 class PingServer {
  public:
   PingServer(aos::ShmEventLoop *event_loop)
-      : event_loop_(event_loop), server_(2, "::", FLAGS_port) {
+      : event_loop_(event_loop), server_(2, "::", absl::GetFlag(FLAGS_port)) {
     event_loop_->epoll()->OnReadable(server_.fd(),
                                      [this]() { MessageReceived(); });
-    server_.SetMaxReadSize(FLAGS_size + 100);
-    server_.SetMaxWriteSize(FLAGS_size + 100);
+    server_.SetMaxReadSize(absl::GetFlag(FLAGS_size) + 100);
+    server_.SetMaxWriteSize(absl::GetFlag(FLAGS_size) + 100);
 
     timer_ = event_loop_->AddTimer([this]() { Timer(); });
 
     event_loop_->OnRun([this]() {
       timer_->Schedule(event_loop_->monotonic_now(),
-                       chrono::milliseconds(FLAGS_duration));
+                       chrono::milliseconds(absl::GetFlag(FLAGS_duration)));
     });
 
     event_loop_->SetRuntimeRealtimePriority(5);
@@ -48,9 +48,9 @@
       return;
     }
 
-    std::string data(FLAGS_size, 'a');
+    std::string data(absl::GetFlag(FLAGS_size), 'a');
 
-    if (server_.Send(data, sac_assoc_id_, 0, FLAGS_ttl)) {
+    if (server_.Send(data, sac_assoc_id_, 0, absl::GetFlag(FLAGS_ttl))) {
       LOG(INFO) << "Sent " << data.size();
     } else {
       PLOG(ERROR) << "Failed to send";
@@ -117,7 +117,7 @@
 
 int Main() {
   aos::FlatbufferDetachedBuffer<aos::Configuration> config =
-      aos::configuration::ReadConfig(FLAGS_config);
+      aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
 
   aos::ShmEventLoop event_loop(&config.message());
   PingServer server(&event_loop);
diff --git a/aos/network/pong.cc b/aos/network/pong.cc
index 8f08836..29253ec 100644
--- a/aos/network/pong.cc
+++ b/aos/network/pong.cc
@@ -1,19 +1,19 @@
 #include <chrono>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/log.h"
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
 #include "aos/network/sctp_client.h"
 
-DEFINE_string(config, "aos_config.json", "Path to the config.");
-DEFINE_uint32(port, 1323, "Port to pingpong on");
-DEFINE_string(target, "vpu0-0a", "Host to connect to");
-DEFINE_uint32(rx_size, 1000000,
-              "RX buffer size to set the max size to be in bytes.");
-DEFINE_uint32(size, 1000, "Size of data to send in bytes");
-DEFINE_uint32(ttl, 0, "TTL in milliseconds");
+ABSL_FLAG(std::string, config, "aos_config.json", "Path to the config.");
+ABSL_FLAG(uint32_t, port, 1323, "Port to pingpong on");
+ABSL_FLAG(std::string, target, "vpu0-0a", "Host to connect to");
+ABSL_FLAG(uint32_t, rx_size, 1000000,
+          "RX buffer size to set the max size to be in bytes.");
+ABSL_FLAG(uint32_t, size, 1000, "Size of data to send in bytes");
+ABSL_FLAG(uint32_t, ttl, 0, "TTL in milliseconds");
 
 namespace aos {
 namespace message_bridge {
@@ -23,9 +23,15 @@
 class PingClient {
  public:
   PingClient(aos::ShmEventLoop *event_loop)
-      : event_loop_(event_loop), client_(FLAGS_target, FLAGS_port, 2, "::", 0) {
-    client_.SetMaxReadSize(std::max(FLAGS_rx_size, FLAGS_size) + 100);
-    client_.SetMaxWriteSize(std::max(FLAGS_rx_size, FLAGS_size) + 100);
+      : event_loop_(event_loop),
+        client_(absl::GetFlag(FLAGS_target), absl::GetFlag(FLAGS_port), 2,
+                "::", 0) {
+    client_.SetMaxReadSize(
+        std::max(absl::GetFlag(FLAGS_rx_size), absl::GetFlag(FLAGS_size)) +
+        100);
+    client_.SetMaxWriteSize(
+        std::max(absl::GetFlag(FLAGS_rx_size), absl::GetFlag(FLAGS_size)) +
+        100);
 
     timer_ = event_loop_->AddTimer([this]() { Timer(); });
 
@@ -45,9 +51,9 @@
   sctp_assoc_t sac_assoc_id_ = 0;
 
   void Timer() {
-    std::string data(FLAGS_size, 'a');
+    std::string data(absl::GetFlag(FLAGS_size), 'a');
 
-    if (client_.Send(0, data, FLAGS_ttl)) {
+    if (client_.Send(0, data, absl::GetFlag(FLAGS_ttl))) {
       LOG(INFO) << "Sent " << data.size();
     } else {
       PLOG(ERROR) << "Failed to send";
@@ -119,7 +125,7 @@
 
 int Main() {
   aos::FlatbufferDetachedBuffer<aos::Configuration> config =
-      aos::configuration::ReadConfig(FLAGS_config);
+      aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
 
   aos::ShmEventLoop event_loop(&config.message());
   PingClient server(&event_loop);
diff --git a/aos/network/rawrtc.cc b/aos/network/rawrtc.cc
index 6d9bc3d..eddf696 100644
--- a/aos/network/rawrtc.cc
+++ b/aos/network/rawrtc.cc
@@ -9,13 +9,15 @@
 #include <functional>
 #include <string>
 
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "flatbuffers/flatbuffers.h"
-#include "glog/logging.h"
 
-DEFINE_int32(min_ice_port, -1,
-             "Minimum port number to use for ICE candidates.");
-DEFINE_int32(max_ice_port, -1,
-             "Maximum port number to use for ICE candidates.");
+ABSL_FLAG(int32_t, min_ice_port, -1,
+          "Minimum port number to use for ICE candidates.");
+ABSL_FLAG(int32_t, max_ice_port, -1,
+          "Maximum port number to use for ICE candidates.");
 
 namespace aos::web_proxy {
 namespace {
@@ -198,11 +200,14 @@
   CHECK_RAWRTC(rawrtc_peer_connection_configuration_set_sctp_buffer_length(
       configuration, TRANSPORT_BUFFER_LENGTH, TRANSPORT_BUFFER_LENGTH));
 
-  if (FLAGS_min_ice_port >= 0 && FLAGS_max_ice_port >= 0) {
-    CHECK_LT(FLAGS_min_ice_port, FLAGS_max_ice_port);
+  if (absl::GetFlag(FLAGS_min_ice_port) >= 0 &&
+      absl::GetFlag(FLAGS_max_ice_port) >= 0) {
+    CHECK_LT(absl::GetFlag(FLAGS_min_ice_port),
+             absl::GetFlag(FLAGS_max_ice_port));
     // Set the port range to use for ICE candidates.
     CHECK_RAWRTC(rawrtc_peer_connection_configuration_set_ice_udp_port_range(
-        configuration, FLAGS_min_ice_port, FLAGS_max_ice_port));
+        configuration, absl::GetFlag(FLAGS_min_ice_port),
+        absl::GetFlag(FLAGS_max_ice_port)));
   }
 
   // Create peer connection
diff --git a/aos/network/rawrtc.h b/aos/network/rawrtc.h
index 57153f0..7b919bf 100644
--- a/aos/network/rawrtc.h
+++ b/aos/network/rawrtc.h
@@ -10,8 +10,9 @@
 #include "rawrtcc/utils.h"
 }
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "flatbuffers/flatbuffers.h"
-#include "glog/logging.h"
 
 namespace aos::web_proxy {
 
diff --git a/aos/network/sctp_client.cc b/aos/network/sctp_client.cc
index 32347fd..b387e07 100644
--- a/aos/network/sctp_client.cc
+++ b/aos/network/sctp_client.cc
@@ -9,14 +9,16 @@
 #include <cstring>
 #include <string_view>
 
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/network/sctp_lib.h"
 #include "aos/unique_malloc_ptr.h"
 
-DEFINE_int32(sinit_max_init_timeout, 0,
-             "Timeout in milliseconds for retrying the INIT packet when "
-             "connecting to the message bridge server");
+ABSL_FLAG(int32_t, sinit_max_init_timeout, 0,
+          "Timeout in milliseconds for retrying the INIT packet when "
+          "connecting to the message bridge server");
 
 namespace aos::message_bridge {
 
@@ -35,7 +37,7 @@
     initmsg.sinit_num_ostreams = streams;
     initmsg.sinit_max_instreams = streams;
     // Max timeout in milliseconds for the INIT packet.
-    initmsg.sinit_max_init_timeo = FLAGS_sinit_max_init_timeout;
+    initmsg.sinit_max_init_timeo = absl::GetFlag(FLAGS_sinit_max_init_timeout);
     PCHECK(setsockopt(fd(), IPPROTO_SCTP, SCTP_INITMSG, &initmsg,
                       sizeof(struct sctp_initmsg)) == 0);
   }
diff --git a/aos/network/sctp_client.h b/aos/network/sctp_client.h
index 952d0e9..61e4e9e 100644
--- a/aos/network/sctp_client.h
+++ b/aos/network/sctp_client.h
@@ -5,8 +5,9 @@
 #include <cstdlib>
 #include <string_view>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/types/span.h"
-#include "glog/logging.h"
 
 #include "aos/network/sctp_lib.h"
 #include "aos/unique_malloc_ptr.h"
diff --git a/aos/network/sctp_lib.cc b/aos/network/sctp_lib.cc
index cf50ad6..1c55293 100644
--- a/aos/network/sctp_lib.cc
+++ b/aos/network/sctp_lib.cc
@@ -16,6 +16,10 @@
 #include <string_view>
 #include <vector>
 
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
+
 #include "aos/util/file.h"
 
 // The casts required to read datastructures from sockets trip - Wcast - align.
@@ -23,9 +27,9 @@
 #pragma clang diagnostic ignored "-Wcast-align"
 #endif
 
-DEFINE_string(interface, "", "network interface");
-DEFINE_bool(disable_ipv6, false, "disable ipv6");
-DEFINE_int32(rmem, 0, "If nonzero, set rmem to this size.");
+ABSL_FLAG(std::string, interface, "", "network interface");
+ABSL_FLAG(bool, disable_ipv6, false, "disable ipv6");
+ABSL_FLAG(int32_t, rmem, 0, "If nonzero, set rmem to this size.");
 
 // The Type of Service.
 // https://www.tucny.com/Home/dscp-tos
@@ -39,8 +43,8 @@
 // to zero. Those two bits are the "Explicit Congestion Notification" bits. They
 // are controlled by the IP stack itself (and used by the router). We don't
 // control that via the TOS value we set here.
-DEFINE_int32(
-    sctp_tos, 176,
+ABSL_FLAG(
+    int32_t, sctp_tos, 176,
     "The Type-Of-Service value to use. Defaults to a critical priority. "
     "Always set values here whose two least significant bits are set to zero. "
     "When using tcpdump, the `tos` field may show the least significant two "
@@ -88,7 +92,7 @@
 }  // namespace
 
 bool Ipv6Enabled() {
-  if (FLAGS_disable_ipv6) {
+  if (absl::GetFlag(FLAGS_disable_ipv6)) {
     return false;
   }
   int fd = socket(AF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP);
@@ -151,8 +155,9 @@
       t_addr6->sin6_family = addrinfo_result->ai_family;
       t_addr6->sin6_port = htons(port);
 
-      if (FLAGS_interface.size() > 0) {
-        t_addr6->sin6_scope_id = if_nametoindex(FLAGS_interface.c_str());
+      if (absl::GetFlag(FLAGS_interface).size() > 0) {
+        t_addr6->sin6_scope_id =
+            if_nametoindex(absl::GetFlag(FLAGS_interface).c_str());
       }
 
       break;
@@ -295,7 +300,7 @@
     // Set up Type-Of-Service.
     //
     // See comments for the --sctp_tos flag for more information.
-    int tos = IPTOS_DSCP(FLAGS_sctp_tos);
+    int tos = IPTOS_DSCP(absl::GetFlag(FLAGS_sctp_tos));
     PCHECK(setsockopt(fd_, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == 0);
   }
   {
@@ -683,8 +688,8 @@
   // The SO_RCVBUF option (also controlled by net.core.rmem_default) needs to be
   // decently large but the actual size can be measured by tuning.  The defaults
   // should be fine.  If it isn't big enough, transmission will fail.
-  if (FLAGS_rmem > 0) {
-    size_t rmem = FLAGS_rmem;
+  if (absl::GetFlag(FLAGS_rmem) > 0) {
+    size_t rmem = absl::GetFlag(FLAGS_rmem);
     PCHECK(setsockopt(fd(), SOL_SOCKET, SO_RCVBUF, &rmem, sizeof(rmem)) == 0);
   }
 }
diff --git a/aos/network/sctp_lib.h b/aos/network/sctp_lib.h
index 3430be8..97d9d20 100644
--- a/aos/network/sctp_lib.h
+++ b/aos/network/sctp_lib.h
@@ -11,9 +11,9 @@
 #include <string_view>
 #include <vector>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/types/span.h"
-#include "gflags/gflags.h"
-#include "glog/logging.h"
 
 #include "aos/unique_malloc_ptr.h"
 
diff --git a/aos/network/sctp_lib_test.cc b/aos/network/sctp_lib_test.cc
index f297a82..a822257 100644
--- a/aos/network/sctp_lib_test.cc
+++ b/aos/network/sctp_lib_test.cc
@@ -1,16 +1,17 @@
 #include "aos/network/sctp_lib.h"
 
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
 
 #include "aos/init.h"
 
-DEFINE_string(host, "", "host to resolve");
-DEFINE_int32(port, 2977, "port to use");
+ABSL_FLAG(std::string, host, "", "host to resolve");
+ABSL_FLAG(int32_t, port, 2977, "port to use");
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
   struct sockaddr_storage sockaddr = aos::message_bridge::ResolveSocket(
-      FLAGS_host, FLAGS_port, aos::message_bridge::Ipv6Enabled());
+      absl::GetFlag(FLAGS_host), absl::GetFlag(FLAGS_port),
+      aos::message_bridge::Ipv6Enabled());
   LOG(INFO) << "Family " << aos::message_bridge::Family(sockaddr);
   LOG(INFO) << "Address " << aos::message_bridge::Address(sockaddr);
   return 0;
diff --git a/aos/network/sctp_perf.cc b/aos/network/sctp_perf.cc
index db762de..dae8667 100644
--- a/aos/network/sctp_perf.cc
+++ b/aos/network/sctp_perf.cc
@@ -1,7 +1,9 @@
 #include <chrono>
 
-#include "gflags/gflags.h"
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/flags/usage.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
@@ -14,24 +16,24 @@
 #pragma clang diagnostic ignored "-Wcast-align"
 #endif
 
-DEFINE_string(config, "aos_config.json", "Path to the config.");
-DEFINE_uint32(port, 1323, "Port to run the sctp test on");
-DEFINE_uint32(payload_size, 1000, "Size of data to send in bytes");
-DEFINE_uint32(ttl, 0, "TTL in milliseconds");
-DEFINE_uint32(rx_size, 1000000,
-              "RX buffer size to set the max size to be in bytes.");
-DEFINE_string(host, "", "Server host (acts as server if unspecified)");
+ABSL_FLAG(std::string, config, "aos_config.json", "Path to the config.");
+ABSL_FLAG(uint32_t, port, 1323, "Port to run the sctp test on");
+ABSL_FLAG(uint32_t, payload_size, 1000, "Size of data to send in bytes");
+ABSL_FLAG(uint32_t, ttl, 0, "TTL in milliseconds");
+ABSL_FLAG(uint32_t, rx_size, 1000000,
+          "RX buffer size to set the max size to be in bytes.");
+ABSL_FLAG(std::string, host, "", "Server host (acts as server if unspecified)");
 
-DEFINE_bool(client, false,
-            "If true, then act as a client, otherwise act as a server");
-DEFINE_uint32(skip_first_n, 10,
-              "Skip the first 'n' messages when computing statistics.");
+ABSL_FLAG(bool, client, false,
+          "If true, then act as a client, otherwise act as a server");
+ABSL_FLAG(uint32_t, skip_first_n, 10,
+          "Skip the first 'n' messages when computing statistics.");
 
-DEFINE_string(sctp_auth_key_file, "",
-              "When set, use the provided key for SCTP authentication as "
-              "defined in RFC 4895");
+ABSL_FLAG(std::string, sctp_auth_key_file, "",
+          "When set, use the provided key for SCTP authentication as "
+          "defined in RFC 4895");
 
-DECLARE_bool(die_on_malloc);
+ABSL_DECLARE_FLAG(bool, die_on_malloc);
 
 namespace aos::message_bridge::perf {
 
@@ -40,15 +42,16 @@
 using util::ReadFileToVecOrDie;
 
 SctpAuthMethod SctpAuthMethod() {
-  return FLAGS_sctp_auth_key_file.empty() ? SctpAuthMethod::kNoAuth
-                                          : SctpAuthMethod::kAuth;
+  return absl::GetFlag(FLAGS_sctp_auth_key_file).empty()
+             ? SctpAuthMethod::kNoAuth
+             : SctpAuthMethod::kAuth;
 }
 
 std::vector<uint8_t> GetSctpAuthKey() {
   if (SctpAuthMethod() == SctpAuthMethod::kNoAuth) {
     return {};
   }
-  return ReadFileToVecOrDie(FLAGS_sctp_auth_key_file);
+  return ReadFileToVecOrDie(absl::GetFlag(FLAGS_sctp_auth_key_file));
 }
 
 }  // namespace
@@ -59,12 +62,12 @@
  public:
   Server(aos::ShmEventLoop *event_loop)
       : event_loop_(event_loop),
-        server_(2, "0.0.0.0", FLAGS_port, SctpAuthMethod()) {
+        server_(2, "0.0.0.0", absl::GetFlag(FLAGS_port), SctpAuthMethod()) {
     server_.SetAuthKey(GetSctpAuthKey());
     event_loop_->epoll()->OnReadable(server_.fd(),
                                      [this]() { MessageReceived(); });
-    server_.SetMaxReadSize(FLAGS_rx_size + 100);
-    server_.SetMaxWriteSize(FLAGS_rx_size + 100);
+    server_.SetMaxReadSize(absl::GetFlag(FLAGS_rx_size) + 100);
+    server_.SetMaxWriteSize(absl::GetFlag(FLAGS_rx_size) + 100);
 
     event_loop_->SetRuntimeRealtimePriority(5);
   }
@@ -76,7 +79,7 @@
       LOG(INFO) << "Lost connection to client. Not sending";
       return;
     }
-    if (server_.Send(message, sac_assoc_id_, 0, FLAGS_ttl)) {
+    if (server_.Send(message, sac_assoc_id_, 0, absl::GetFlag(FLAGS_ttl))) {
       LOG(INFO) << "Server reply with " << message.size() << "B";
     } else {
       PLOG(FATAL) << "Failed to send";
@@ -140,11 +143,11 @@
  public:
   Client(aos::ShmEventLoop *event_loop)
       : event_loop_(event_loop),
-        client_(FLAGS_host, FLAGS_port, 2, "0.0.0.0", FLAGS_port,
-                SctpAuthMethod()) {
+        client_(absl::GetFlag(FLAGS_host), absl::GetFlag(FLAGS_port), 2,
+                "0.0.0.0", absl::GetFlag(FLAGS_port), SctpAuthMethod()) {
     client_.SetAuthKey(GetSctpAuthKey());
-    client_.SetMaxReadSize(FLAGS_rx_size + 100);
-    client_.SetMaxWriteSize(FLAGS_rx_size + 100);
+    client_.SetMaxReadSize(absl::GetFlag(FLAGS_rx_size) + 100);
+    client_.SetMaxWriteSize(absl::GetFlag(FLAGS_rx_size) + 100);
 
     timer_ = event_loop_->AddTimer([this]() { Ping(); });
 
@@ -161,9 +164,9 @@
   ~Client() { event_loop_->epoll()->DeleteFd(client_.fd()); }
 
   void Ping() {
-    std::string payload(FLAGS_payload_size, 'a');
+    std::string payload(absl::GetFlag(FLAGS_payload_size), 'a');
     sent_time_ = aos::monotonic_clock::now();
-    if (client_.Send(0, payload, FLAGS_ttl)) {
+    if (client_.Send(0, payload, absl::GetFlag(FLAGS_ttl))) {
       LOG(INFO) << "Sending " << payload.size() << "B";
     } else {
       PLOG(ERROR) << "Failed to send";
@@ -226,8 +229,9 @@
             .count();
     avg_latency_ = (avg_latency_ * (count_ - 1) + elapsed_secs) / count_;
     // average one-way throughput
-    double throughput = FLAGS_payload_size * 2.0 / elapsed_secs;
-    double avg_throughput = FLAGS_payload_size * 2.0 / avg_latency_;
+    double throughput = absl::GetFlag(FLAGS_payload_size) * 2.0 / elapsed_secs;
+    double avg_throughput =
+        absl::GetFlag(FLAGS_payload_size) * 2.0 / avg_latency_;
     printf(
         "Round trip: %.2fms | %.2f KB/s | Avg RTL: %.2fms | %.2f KB/s | "
         "Count: %d\n",
@@ -240,25 +244,27 @@
   SctpClient client_;
   aos::TimerHandler *timer_;
   double avg_latency_ = 0.0;
-  int count_ = -FLAGS_skip_first_n;
+  int count_ = -absl::GetFlag(FLAGS_skip_first_n);
 
   aos::monotonic_clock::time_point sent_time_;
 };
 
 int Main() {
   aos::FlatbufferDetachedBuffer<aos::Configuration> config =
-      aos::configuration::ReadConfig(FLAGS_config);
+      aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
 
   aos::ShmEventLoop event_loop(&config.message());
-  if (FLAGS_client) {
-    CHECK(!FLAGS_host.empty()) << "Client Usage: `sctp_perf --client --host "
-                                  "abc.com --payload_size [bytes] "
-                                  "[--port PORT] [--config PATH]`";
+  if (absl::GetFlag(FLAGS_client)) {
+    CHECK(!absl::GetFlag(FLAGS_host).empty())
+        << "Client Usage: `sctp_perf --client --host "
+           "abc.com --payload_size [bytes] "
+           "[--port PORT] [--config PATH]`";
 
     Client client(&event_loop);
     event_loop.Run();
   } else {
-    CHECK(FLAGS_host.empty()) << "Server Usage: `sctp_perf [--config PATH]`";
+    CHECK(absl::GetFlag(FLAGS_host).empty())
+        << "Server Usage: `sctp_perf [--config PATH]`";
     Server server(&event_loop);
     event_loop.Run();
   }
@@ -269,12 +275,12 @@
 }  // namespace aos::message_bridge::perf
 
 int main(int argc, char **argv) {
-  gflags::SetUsageMessage(absl::StrCat(
+  absl::SetProgramUsageMessage(absl::StrCat(
       "Measure SCTP performance\n", "  Server Usage: `sctp_perf`\n",
       "  Client Usage: `sctp_perf --client --host abc.com`\n"));
   aos::InitGoogle(&argc, &argv);
 
   // Client and server need to malloc.
-  FLAGS_die_on_malloc = false;
+  absl::SetFlag(&FLAGS_die_on_malloc, false);
   return aos::message_bridge::perf::Main();
 }
diff --git a/aos/network/sctp_server.cc b/aos/network/sctp_server.cc
index 7f7a0ae..c495180 100644
--- a/aos/network/sctp_server.cc
+++ b/aos/network/sctp_server.cc
@@ -13,7 +13,8 @@
 #include <memory>
 #include <thread>
 
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/network/sctp_lib.h"
 #include "aos/unique_malloc_ptr.h"
diff --git a/aos/network/sctp_server.h b/aos/network/sctp_server.h
index 996645e..4dd295d 100644
--- a/aos/network/sctp_server.h
+++ b/aos/network/sctp_server.h
@@ -13,8 +13,9 @@
 #include <cstring>
 #include <memory>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/types/span.h"
-#include "glog/logging.h"
 
 #include "aos/network/sctp_lib.h"
 #include "aos/unique_malloc_ptr.h"
diff --git a/aos/network/sctp_test.cc b/aos/network/sctp_test.cc
index bce5c19..d202e5d 100644
--- a/aos/network/sctp_test.cc
+++ b/aos/network/sctp_test.cc
@@ -3,7 +3,8 @@
 #include <chrono>
 #include <functional>
 
-#include "gflags/gflags.h"
+#include "absl/flags/declare.h"
+#include "absl/flags/flag.h"
 #include "gmock/gmock-matchers.h"
 #include "gtest/gtest.h"
 
@@ -13,7 +14,7 @@
 #include "aos/network/sctp_server.h"
 #include "sctp_lib.h"
 
-DECLARE_bool(disable_ipv6);
+ABSL_DECLARE_FLAG(bool, disable_ipv6);
 
 namespace aos::message_bridge::testing {
 
@@ -128,7 +129,7 @@
   static void SetUpTestSuite() {
     EnableSctpAuthIfAvailable();
     // Buildkite seems to have issues with ipv6 sctp sockets...
-    FLAGS_disable_ipv6 = true;
+    absl::SetFlag(&FLAGS_disable_ipv6, true);
   }
 
   void SetUp() override { Run(); }
diff --git a/aos/network/team_number.cc b/aos/network/team_number.cc
index cc81e26..175c3a9 100644
--- a/aos/network/team_number.cc
+++ b/aos/network/team_number.cc
@@ -6,12 +6,14 @@
 #include <cinttypes>
 #include <cstdlib>
 
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/strings/numbers.h"
 
-DEFINE_string(
-    override_hostname, "",
-    "If set, this forces the hostname of this node to be the provided "
-    "hostname.");
+ABSL_FLAG(std::string, override_hostname, "",
+          "If set, this forces the hostname of this node to be the provided "
+          "hostname.");
 
 namespace aos::network {
 namespace team_number_internal {
@@ -106,13 +108,13 @@
 }  // namespace
 
 ::std::string GetHostname() {
-  if (FLAGS_override_hostname.empty()) {
+  if (absl::GetFlag(FLAGS_override_hostname).empty()) {
     char buf[256];
     buf[sizeof(buf) - 1] = '\0';
     PCHECK(gethostname(buf, sizeof(buf) - 1) == 0);
     return buf;
   } else {
-    return FLAGS_override_hostname;
+    return absl::GetFlag(FLAGS_override_hostname);
   }
 }
 
diff --git a/aos/network/team_number.h b/aos/network/team_number.h
index 7b9acbb..10f8921 100644
--- a/aos/network/team_number.h
+++ b/aos/network/team_number.h
@@ -5,9 +5,9 @@
 #include <optional>
 #include <string_view>
 
-#include "glog/logging.h"
+#include "absl/flags/declare.h"
 
-DECLARE_string(override_hostname);
+ABSL_DECLARE_FLAG(std::string, override_hostname);
 
 namespace aos {
 namespace network {
diff --git a/aos/network/timestamp_channel.cc b/aos/network/timestamp_channel.cc
index 778c2e7..1a821c5 100644
--- a/aos/network/timestamp_channel.cc
+++ b/aos/network/timestamp_channel.cc
@@ -1,14 +1,15 @@
 #include "aos/network/timestamp_channel.h"
 
+#include "absl/flags/flag.h"
 #include "absl/strings/str_cat.h"
 
-DEFINE_bool(combined_timestamp_channel_fallback, true,
-            "If true, fall back to using the combined timestamp channel if the "
-            "single timestamp channel doesn't exist for a timestamp.");
-DEFINE_bool(check_timestamp_channel_frequencies, true,
-            "If true, include a debug CHECK to ensure that remote timestamp "
-            "channels are configured to have at least as great a frequency as "
-            "the corresponding data channel.");
+ABSL_FLAG(bool, combined_timestamp_channel_fallback, true,
+          "If true, fall back to using the combined timestamp channel if the "
+          "single timestamp channel doesn't exist for a timestamp.");
+ABSL_FLAG(bool, check_timestamp_channel_frequencies, true,
+          "If true, include a debug CHECK to ensure that remote timestamp "
+          "channels are configured to have at least as great a frequency as "
+          "the corresponding data channel.");
 
 namespace aos::message_bridge {
 
@@ -55,7 +56,7 @@
     return split_timestamp_channel;
   }
 
-  if (!FLAGS_combined_timestamp_channel_fallback) {
+  if (!absl::GetFlag(FLAGS_combined_timestamp_channel_fallback)) {
     LOG(FATAL) << "Failed to find new timestamp channel {\"name\": \""
                << split_timestamp_channel_name << "\", \"type\": \""
                << RemoteMessage::GetFullyQualifiedName() << "\"} for "
@@ -112,7 +113,7 @@
 
   const Channel *timestamp_channel = finder.ForChannel(channel, connection);
 
-  if (FLAGS_check_timestamp_channel_frequencies) {
+  if (absl::GetFlag(FLAGS_check_timestamp_channel_frequencies)) {
     // Sanity-check that the timestamp channel can actually support full-rate
     // messages coming through on the source channel.
     CHECK_GE(timestamp_channel->frequency(), channel->frequency())
diff --git a/aos/network/timestamp_channel.h b/aos/network/timestamp_channel.h
index 7e48a00..0d57c82 100644
--- a/aos/network/timestamp_channel.h
+++ b/aos/network/timestamp_channel.h
@@ -5,7 +5,8 @@
 #include <vector>
 
 #include "absl/container/btree_map.h"
-#include "glog/logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/configuration.h"
 #include "aos/events/event_loop.h"
diff --git a/aos/network/timestamp_channel_test.cc b/aos/network/timestamp_channel_test.cc
index a217a74..9c0f57c 100644
--- a/aos/network/timestamp_channel_test.cc
+++ b/aos/network/timestamp_channel_test.cc
@@ -1,5 +1,7 @@
 #include "aos/network/timestamp_channel.h"
 
+#include "absl/flags/declare.h"
+#include "absl/flags/flag.h"
 #include "gtest/gtest.h"
 
 #include "aos/configuration.h"
@@ -9,16 +11,16 @@
 #include "aos/testing/path.h"
 #include "aos/testing/tmpdir.h"
 
-DECLARE_string(override_hostname);
+ABSL_DECLARE_FLAG(std::string, override_hostname);
 
 namespace aos::message_bridge::testing {
+
 class TimestampChannelTest : public ::testing::Test {
  protected:
   TimestampChannelTest()
       : config_(aos::configuration::ReadConfig(aos::testing::ArtifactPath(
             "aos/network/timestamp_channel_test_config.json"))) {
-    FLAGS_shm_base = aos::testing::TestTmpDir();
-    FLAGS_override_hostname = "pi1";
+    absl::SetFlag(&FLAGS_override_hostname, "pi1");
   }
   aos::FlatbufferDetachedBuffer<aos::Configuration> config_;
 };
diff --git a/aos/network/timestamp_filter.h b/aos/network/timestamp_filter.h
index 04ee605..5b24cd1 100644
--- a/aos/network/timestamp_filter.h
+++ b/aos/network/timestamp_filter.h
@@ -7,8 +7,9 @@
 #include <cstdio>
 #include <deque>
 
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 #include "absl/numeric/int128.h"
-#include "glog/logging.h"
 
 #include "aos/configuration.h"
 #include "aos/events/logging/boot_timestamp.h"
diff --git a/aos/network/web_proxy.cc b/aos/network/web_proxy.cc
index 6b71433..05bb7fa 100644
--- a/aos/network/web_proxy.cc
+++ b/aos/network/web_proxy.cc
@@ -1,6 +1,8 @@
 #include "aos/network/web_proxy.h"
 
-#include "glog/logging.h"
+#include "absl/flags/flag.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
 
 #include "aos/flatbuffer_merge.h"
 #include "aos/network/connect_generated.h"
@@ -18,21 +20,21 @@
 struct list *tmrl_get(void);
 }
 
-DEFINE_int32(proxy_port, 1180, "Port to use for the web proxy server.");
-DEFINE_int32(pre_send_messages, 10000,
-             "Number of messages / queue to send to a client before waiting on "
-             "confirmation that the initial message was received. If set to "
-             "-1, will not throttle messages at all. This prevents a situation "
-             "where, when run on localhost, the large number of WebRTC packets "
-             "can overwhelm the browser and crash the webpage.");
+ABSL_FLAG(int32_t, proxy_port, 1180, "Port to use for the web proxy server.");
+ABSL_FLAG(int32_t, pre_send_messages, 10000,
+          "Number of messages / queue to send to a client before waiting on "
+          "confirmation that the initial message was received. If set to "
+          "-1, will not throttle messages at all. This prevents a situation "
+          "where, when run on localhost, the large number of WebRTC packets "
+          "can overwhelm the browser and crash the webpage.");
 // Note: sometimes it appears that WebRTC buffer up and stop sending message
 // ack's back from the client page. It is not clear *why* WebRTC is doing this,
 // but since the only reason we use those ack's is to stop ourselves from
 // overloading the client webpage, this setting lets us fall back to just a
 // time-based rate-limit when we stop receiving acks.
-DEFINE_double(max_buffer_pause_sec, 0.1,
-              "If we have not received any ack's in this amount of time, we "
-              "start to continue sending messages.");
+ABSL_FLAG(double, max_buffer_pause_sec, 0.1,
+          "If we have not received any ack's in this amount of time, we "
+          "start to continue sending messages.");
 
 namespace aos::web_proxy {
 WebsocketHandler::WebsocketHandler(::seasocks::Server *server,
@@ -176,7 +178,7 @@
   });
 
   server_.addWebSocketHandler("/ws", websocket_handler_);
-  CHECK(server_.startListening(FLAGS_proxy_port));
+  CHECK(server_.startListening(absl::GetFlag(FLAGS_proxy_port)));
 
   epoll->OnReadable(server_.fd(), [this]() {
     CHECK(::seasocks::Server::PollResult::Continue == server_.poll(0));
@@ -351,17 +353,19 @@
     // We are still waiting on the next message to appear; return.
     return nullptr;
   }
-  if (FLAGS_pre_send_messages > 0) {
+  if (absl::GetFlag(FLAGS_pre_send_messages) > 0) {
     // Note: Uses actual clock to handle simulation time.
     const aos::monotonic_clock::time_point now = aos::monotonic_clock::now();
     if (channel->last_report.has_value() &&
         channel->last_report.value() +
                 std::chrono::duration_cast<std::chrono::nanoseconds>(
-                    std::chrono::duration<double>(FLAGS_max_buffer_pause_sec)) <
+                    std::chrono::duration<double>(
+                        absl::GetFlag(FLAGS_max_buffer_pause_sec))) <
             now) {
       // Increment the number of messages that we will send over to the client
       // webpage.
-      channel->reported_queue_index += FLAGS_pre_send_messages / 10;
+      channel->reported_queue_index +=
+          absl::GetFlag(FLAGS_pre_send_messages) / 10;
       channel->reported_packet_index = 0;
       channel->last_report = now;
     }
@@ -371,7 +375,7 @@
     // browser, not to be ultra precise about anything. It's also not clear that
     // message *size* is necessarily even the determining factor in causing
     // issues.
-    if (channel->reported_queue_index + FLAGS_pre_send_messages <
+    if (channel->reported_queue_index + absl::GetFlag(FLAGS_pre_send_messages) <
         channel->current_queue_index) {
       return nullptr;
     }
diff --git a/aos/network/web_proxy_main.cc b/aos/network/web_proxy_main.cc
index 7684b06..3b1977a 100644
--- a/aos/network/web_proxy_main.cc
+++ b/aos/network/web_proxy_main.cc
@@ -1,27 +1,29 @@
-#include "gflags/gflags.h"
+#include "absl/flags/flag.h"
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/flatbuffer_merge.h"
 #include "aos/init.h"
 #include "aos/network/web_proxy.h"
 
-DEFINE_string(config, "aos_config.json", "File path of aos configuration");
-DEFINE_string(data_dir, "www", "Directory to serve data files from");
-DEFINE_int32(buffer_size, 1000000,
-             "-1 if infinite, in bytes / channel. If there are no active "
-             "connections, will not store anything.");
+ABSL_FLAG(std::string, config, "aos_config.json",
+          "File path of aos configuration");
+ABSL_FLAG(std::string, data_dir, "www", "Directory to serve data files from");
+ABSL_FLAG(int32_t, buffer_size, 1000000,
+          "-1 if infinite, in bytes / channel. If there are no active "
+          "connections, will not store anything.");
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
 
   aos::FlatbufferDetachedBuffer<aos::Configuration> config =
-      aos::configuration::ReadConfig(FLAGS_config);
+      aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
 
   aos::ShmEventLoop event_loop(&config.message());
 
-  aos::web_proxy::WebProxy web_proxy(
-      &event_loop, aos::web_proxy::StoreHistory::kNo, FLAGS_buffer_size);
-  web_proxy.SetDataPath(FLAGS_data_dir.c_str());
+  aos::web_proxy::WebProxy web_proxy(&event_loop,
+                                     aos::web_proxy::StoreHistory::kNo,
+                                     absl::GetFlag(FLAGS_buffer_size));
+  web_proxy.SetDataPath(absl::GetFlag(FLAGS_data_dir).c_str());
 
   event_loop.Run();
 }