Coder Social home page Coder Social logo

tscat's Introduction

SYNOPSIS

tscat option [label]

DESCRIPTION

tscat: timestamp stdin to stdout/stderr

tscat timestamps standard input and writes the output to standard output, standard error or both.

EXAMPLES

$ echo test | tscat
2020-10-11T07:09:13-0400 test

$ echo test | tscat foo
2020-10-11T07:09:15-0400 foo test

# duplicate output to stdout/stderr
$ echo test | tscat -o 3 foo
2020-10-11T07:09:15-0400 foo 2020-10-11T07:09:15-0400 foo test
test

$ echo test | tscat -o 3 foo > /dev/null
2020-10-11T07:09:15-0400 foo test

$ echo test | tscat -o 3 foo 2> /dev/null
2020-10-11T07:09:15-0400 foo test

Build

make

# selecting process restrictions
RESTRICT_PROCESS=seccomp make

#### using musl
RESTRICT_PROCESS=rlimit ./musl-make

## linux seccomp sandbox: requires kernel headers

# clone the kernel headers somewhere
export MUSL_INCLUDE=/tmp
git clone https://github.com/sabotage-linux/kernel-headers.git $MUSL_INCLUDE/kernel-headers

# then compile
./musl-make clean all

OPTIONS

-o, --output 1|2|3 : stdout=1, stderr=2, both=3 (default: 1)

-f, --format fmt : timestamp format (see strftime(3)) (default: %F%T%z)

-W, --write-error exit|drop|block : behaviour if write buffer is full (default: block)

-h, --help : usage summary

ALTERNATIVES

#!/bin/sh

LABEL="${1-""}"
exec awk -v service="$LABEL" '{
  t = strftime("%FT%T%z")
  printf("%s %s %s\n", t, service, $0) > "/dev/stderr"
  printf("%s %s %s\n", t, service, $0)
  fflush()
}'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.