Where can i find log of portainer.io on docker?

I just want to set up a fail2ban rule to prevent portainer connections, but I can’t find a log file of UI connections, and can’t even get into the container…
Version of portainer container : 2.6.3.

How do I construct a terminal process that displays lines as they are added to a log file?

I’m needed to monitor a log file while I’m doing some debugging. The script I’m debugging writes to the terminal (STDIO) so having debugging info mixed in with that is annoying and I miss things.

What I would like to do is write my debugging info to a log file, simply appending each entry, and have a separate terminal window that is monitoring that file and displaying each entry as it is added.

Could I do something like:

echo << "=-EOF-="

where that somehow reads from the file and echoes each line until it encounters the magic termination string?

I have a feeling that this is possible, but I don’t really know where to begin.

Any suggestions?

Thanks.

I’m on 10.14 Mojave, so I’m using Bash

c++ – Are there conventions on what exactly to log in a game?

I am currently developing a game in C++, using SDL2. For logging, I wrote this Log class:

Log.h

#ifndef LOG_H
#define LOG_H

#include "Singleton.h"

#include <fstream>
#include <string>

class Log : public Singleton<Log>
{
public:

    Log();
    ~Log();

    void regular_log(const std::string& msg); // writes to "file"
    void warning_log(const std::string& msg); // writes to "file", but adds (WARNING) prefix
    void fatal_log(const std::string& msg); // writes to "file", but adds (FATAL) prefix and throws runtime exception

private:

    std::string get_datetime(std::string format) const;

    std::ofstream file;

};
#endif

Log.cpp

#include "Log.h" 

#include <chrono>
#include <ctime>
#include <filesystem>
#include <exception>

Log::Log()
{
    std::filesystem::create_directory("Logs\");
    file.open("Logs\" + get_datetime("%F %H-%M-%S.txt"), std::ios::out);
}

Log::~Log()
{
    file.close();
}

void Log::regular_log(const std::string& msg)
{
    file << "(" << get_datetime("%X") << ")" << " - " << msg << "n";
}

void Log::warning_log(const std::string& msg)
{
    file << "(" << get_datetime("%X") << ")" << "(WARNING)" << " - " << msg << std::endl;
}

void Log::fatal_log(const std::string& msg)
{
    file << "(" << get_datetime("%X") << ")" << "(FATAL)" << " - " << msg << std::endl;
    throw std::runtime_error(msg);
}

std::string Log::get_datetime(const std::string format) const
{
    std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());

    char buf(100) = { 0 };
    std::strftime(buf, sizeof(buf), format.c_str(), std::localtime(&now));

    return buf;
}

My problem is that I am not entirely sure what to log in my code. Is every little altering of the game state worth a regular log, things like “Object created”, “Object moved from xyz to xyz”, “Inventory opened by player 123”? Or should logging be reserved for more important causes? Where do I draw the line?

windows – What is a secure way to log onto the domain controller?

From explanation it looks like a normal case of using a single administrator user credentials for all infrastructure which most of the people do to avoid inconvenience.

If you see the problem here, it’s very simple to understand that an administrator account of Domain Controller was used to access an SQL Database server and for which you were able to extract the ticket. Now when it comes to recommendations I’d advise as follows.

These are general recommendations which should be taken care by every administrator.

  1. Use of Local Administrator Account should be preferred instead of Domain Administration Account’s password being sprinkled everywhere. If somebody can do this for every server they would save themselves from such incidents.

  2. All the servers (at the minimum) should be set to “Not Cache Credentials” This can be done from Computer ConfigurationWindows Settings Security SettingsLocal PolicesSecurity OptionsInteractive Logon: Number of previous logons to cache. Set it to 0.

The problem with point 2 would be that if AD isn’t available users might not be able to login. So here is a bit of trade off that should be considered.

  1. Administrators should use separate accounts for their administrative tasks.

What other recommendations are there?

I have shared above.

Use credential guard to protect against dumping of kerberos tickets

Yes this should be used and It is also recommended to have a proper SIEM tool and configured in a way to detect such attempts so proper actions can be taken in time.

What is the correct/secure way to log onto the DC? I assume a jumpbox?

Follow the above recommendations and Jumpbox is one additional layer that can be used.

php – a log in function keep on sending to the wrong url/page even tho i log in correctly

So i made a simple login system and my problem is that it keeps on sending me to login.php?error=wrongpassword and that means i entered the wrong password even tho i logged in the correct password and the correct username

my functions.inc.php codes look like this

function uidExists($conn, $username) {
   $sql = "SELECT * FROM highscore WHERE username = ?;";
   $stmt = mysqli_stmt_init($conn);
   if (!mysqli_stmt_prepare($stmt, $sql)) {
     header("location: signup.php?error=usernametaken");
     exit();
   }

   mysqli_stmt_bind_param($stmt, "s", $username);
   mysqli_stmt_execute($stmt);


   $resultData = mysqli_stmt_get_result($stmt);

   if ($row = mysqli_fetch_assoc($resultData)) {
     return $row;
   }

else {
    $result = false;
    return $result;
  }

  mysqli_stmt_close($stmt);
}   

function loginUser($conn, $username, $pwd) {
      $uidExists = uidExists($conn, $username );
    
      if ($uidExists === false) {
        header("location: login.php?error=wrongusername");
        exit();
      }
    
      $pwdHashed = $uidExists ("password");
      $checkPwd = password_verify($pwd, $pwdHashed);
    
      if ($checkPwd === false) {
        header("location: login.php?error=wrongpassword");
        exit();
      }
    
      else if ($checkPwd === true) {
        session_start();
        $_SESSION("userid") = $uidExists ("userid");
        $_SESSION("username") = $uidExists ("username");
        header("location: index2.php");
        exit();
      }

heres my login.php

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>
  <h2>Log In</h2>
  <form action="login.inc.php" method="POST">
    <input type="text" name="username" placeholder="Username...">
    <input type="password" name="pwd" placeholder="Password...">
    <button type = "submit" name="submit">Sign Up</button>
  </form>

and heres my login.inc.php

<?php

if (isset($_POST("submit"))) {
    
    $username = $_POST("username");
    $pwd = $_POST("pwd");

  require_once 'dbh.inc.php';
  require_once 'functions.inc.php';

    if (emptyInputLogin($username, $pwd) !== false){
    header("location: login.php?error=emptyinput");
    exit();
  }

  loginUser($conn, $username, $pwd);
}

else {
    header("location: login.php");
    exit();
}

?>

This how my database looks like

 userid | username | password | score
    1   |    123   |    123   |   1
    2   |    312   |    312   |   3

I tried checking if I type the column name from the database wrong but no i typed it correctly.
I also tried making a new username and password and logged that in but still the same result.

Credits to the youtuber name Dani Krossing i got all this codes from him.

linux – How to pipe/dump error output to a log file?

I am running a Perl wrapper script which internally calls a tcl script. I see some long error dumped by the tcl script on the terminal but dont see the output in the log file.

I have tried the following:

command |tee debug.log 

This does not contain the error from the tcl script in the terminal

command 2> error.log

I dont see the errors in this log

command 2>&1 all.log

I dont see all.log; file 1 is created but does not have any error that is on terminal

There is a long list of errors that i cannot debug by scrolling on the terminal,
enter image description here

More info:

Command used that is giving the error:

$PERC_PATH/bin/runperc.pl -block tbn6_setlsrange -cdl -ruleset aip |tee debug.log

The runperc.pl script is calling another tcl script which is aborting midway:

system("tclsh $ENV{PERC_PATH}/bin/setup_extract.tcl");

javascript – Implement complex, intersecting limitations on when and when not to log

It is a classic problem to handle ever changing requirements in a cleaner way without using too many nested if statements.
Here is my current code in JavaScript.

fetchApiData(url){
//log before start
  Logger.logFetchStartedEvent();
  try {
    data = backendApi.get(url);
    Logger.logFetchSucceededEvent();
    return data;
  } catch (error) {
    Logger.logFetchFailedEvent();
  }
}

Everything was going on a happy path. But I received a requirement that for some specific URLs we do not want to log at all.

No problem. I added a flag and switch and called it a day.

fetchApiData(url, shouldLog){
//log before start
  if(shouldLog) {
    Logger.logFetchStartedEvent();
  }
  try {
    data = backendApi.get(url);
    if(shouldLog) {
      Logger.logFetchSucceededEvent();
    }
    return data;
  } catch (error) {
    if(shouldLog) {
      Logger.logFetchFailedEvent();
    }
  }
}

And it didn’t stop there.
New requirement drops in and asked to change to accommodate following requirements

  • some url will log everything
  • some url will log only error
  • some url will log only if the API call url is an external site
  • in some cases logging of fetchSucceeded event is needed, in some cases it is not needed.

I think you got the point.
I can add countless nested if/else conditionals and get it done but now I am sure there must be a better way for this type of issue. Now I feel like one method will become a whole if/else state machine god method.

This is what I came up with

fetchApiData(url,logOnStart, logOnSuccess, logOnFailure, logOnlyExternalLink){
  //log on start
  if(logOnStart) {
    if(logOnlyExternalLink) {
      if(isExternalLink(url)) {
        Logger.logFetchStartedEvent();
      }
    } else {
      Logger.logFetchStartedEvent();
    } 
  }
  try {
    data = backendApi.get(url);
    //log on success
    if(logOnSuccess) {
      // may need external url check again
      Logger.logFetchSucceededEvent();
    }
    return data;
  } catch (error) {
    if(logOnFailure) {
      if(errorType(error) === TimeOut)
      {
        Logger.logFetchFailedTimeOutEvent();
      } else if (errorType(error) === 404) {
        Logger.logFetchFailed404Event();
      } else {
        Logger.logFetchFailedEvent();
      }
    }
  }
}

I did read a lot of questions about nested if/else problem but most of them end up with a foo/bar type examples and vague explanation which make no practical sense to me due to lack of experience.

Please point me to the right direction.

Can users only be allowed to open certain sites when they log in in sharepoint

Let’s say I have a site collection and 5 subsites (A, B, C, D, E). Is it possible that when certain users log in, they will be directly presented with subsite B.

So far, in my experience, every user when he or she logs in, they will always be presented with a default page. From that page, they choose which subsite they want to open.

No update notifications for gnome-software: Which log to check?

I’m not getting update notifications (since a couple of months) for gnome-software though available updates (e.g. for snaps and flatpaks) show in the application and automatic updates are enabled.

I’m a bit lost at finding the right log to see what error keeps those notifications from appearing.

gnome-software 3.38.1 on Ubuntu 21.04

That’s what I did find after a reboot:

Aug 30 07:51:15 system gnome-software(2066): not handling error failed for action get-updates-historical: failed to build result for b8f11848dfcbf441df375b9f11b0e42d085f688b
Aug 30 07:51:16 system gnome-software(2066): not handling error failed for action refresh: E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/hirsute/InRelease
Aug 30 07:51:17 system gnome-software(2066): CSS parse error 1:107: Using one color stop with linear-gradient() is deprecated.
Aug 30 07:51:17 system snap-store(2120): not handling error failed for action get-updates-historical: failed to build result for b8f11848dfcbf441df375b9f11b0e42d085f688b

Cant log into ubuntu server after installing xubuntu gui on rasberry pi 4

I have a raspberry pi 4 and flashed Ubuntu Server 20.04.3 LTS. I can log into the CLI using login name: ubuntu and pw: ubuntu. I am prompted to change the pw and I set my own pw. Once I do updates and install the xubuntu desktop and the gui login screen appears, the gui will not accept my password.

I have reflashed and tried using tasksel to install as well but still the gui does not like my new pw

Any ideas