Just do:
#!/bin/sh -
{
printf '%s\n' "${1-default-id}"
awk '/abc/ && /def/ && ! /ghi/'
} | socat - tcp:n.n.n.n:7777
${1-default-id} expands to the first positional parameter if specified or default-id otherwise. Replace with ${1?} to exit with an error if not passed any argument instead (or ${1?The error message} to specify an error message instead of the default).
Or to only print the ID if and when one line has been read and matches:
#!/bin/sh -
ID=${1-default-id} awk '
/abc/ && /def/ && ! /ghi/ {
if (!already_printed++) print ENVIRON["ID"]
print
}' | socat - tcp:n.n.n.n:7777
Or to prepend the ID (and a space character) to every line:
#!/bin/sh -
ID=${1-default-id} awk '
/abc/ && /def/ && ! /ghi/ {
print ENVIRON["ID"], $0
}' | socat - tcp:n.n.n.n:7777
Beware awk, like grep will buffer their output when it goes to a pipe (to anything other than a tty device). With the GNU implementation of awk (aka gawk), you can add a call to fflush() after each print to force the flushing of that buffer. See also the -Winteractive of mawk. In most awk implementations, doing a system("") would also force a flush. The GNU implementation of grep has a --line-buffered option to force a flush after each line of output.
Also note that tail -f logfile is short for tail -n 10 -f logfile. Chances are you actually want either tail -n +1 -f logfile for the whole log file to be processed, and then tail carrying on following the file, or tail -n 0 -f logfile to process only the lines being added from now on.